Skip to content

Commit

Permalink
Removed Backward compatibility PHPUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
byjg committed Mar 9, 2018
1 parent ba002f3 commit 3b5c9a2
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: php
php:
- "7.2"
- "7.1"
- "7.0"
- "5.6"
Expand All @@ -8,5 +9,5 @@ install:
- composer install

script:
- phpunit
- vendor/bin/phpunit

3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"php": ">=5.5",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": ">5.7"
},
"suggest": {
"ext-curl": "*"
},
Expand Down
4 changes: 3 additions & 1 deletion src/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ abstract class BaseModel extends BinderObject
{

/**
* Construct a model and optionally can set (bind) your properties base and the attribute matching from SingleRow, IteratorInterface
* Construct a model and optionally can set (bind) your properties base and the attribute matching from SingleRow,
* IteratorInterface
*
* @param Object $object
* @param null $propertyPattern
* @throws \Exception
*/
public function __construct($object = null, $propertyPattern = null)
{
Expand Down
5 changes: 5 additions & 0 deletions src/BinderObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class BinderObject implements DumpToArrayInterface
* @param mixed $source
* @param mixed $target
* @param string $propertyPattern Regular Expression -> /searchPattern/replace/
* @throws \Exception
*/
public static function bindObject($source, $target, $propertyPattern = null)
{
Expand All @@ -27,6 +28,7 @@ public static function bindObject($source, $target, $propertyPattern = null)
*
* @param mixed $source
* @param null|string $propertyPattern Regular Expression -> /searchPattern/replace/
* @throws \Exception
*/
public function bind($source, $propertyPattern = null)
{
Expand All @@ -39,6 +41,7 @@ public function bind($source, $propertyPattern = null)
* @param mixed $source
* @param mixed $target
* @param string $propertyPattern Regular Expression -> /searchPattern/replace/
* @throws \Exception
*/
protected function bindObjectInternal($source, $target, $propertyPattern = null)
{
Expand Down Expand Up @@ -123,6 +126,7 @@ protected function setPropValue($obj, $propName, $value)
*
* @param mixed $target
* @param null|string $propertyPattern Regular Expression -> /searchPattern/replace/
* @throws \Exception
*/
public function bindTo($target, $propertyPattern = null)
{
Expand All @@ -133,6 +137,7 @@ public function bindTo($target, $propertyPattern = null)
* Get all properties from the current instance as an associative array
*
* @return array The object properties as array
* @throws \Exception
*/
public function toArray()
{
Expand Down
8 changes: 2 additions & 6 deletions tests/Serialize/BaseModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@

namespace ByJG\Serializer;

use PHPUnit\Framework\TestCase;
use Tests\Sample\ModelGetter;
use Tests\Sample\SampleModel;

// backward compatibility
if (!class_exists('\PHPUnit\Framework\TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}

class BaseModelTest extends \PHPUnit\Framework\TestCase
class BaseModelTest extends TestCase
{

/**
Expand Down
8 changes: 2 additions & 6 deletions tests/Serialize/BinderObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@

namespace ByJG\Serializer;

use PHPUnit\Framework\TestCase;
use Tests\Sample\ModelPropertyPattern;
use Tests\Sample\ModelPublic;
use Tests\Sample\SampleModel;

// backward compatibility
if (!class_exists('\PHPUnit\Framework\TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}

class BinderObjectTest extends \PHPUnit\Framework\TestCase
class BinderObjectTest extends TestCase
{

/**
Expand Down
8 changes: 2 additions & 6 deletions tests/Serialize/SerializerObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use ByJG\Serializer\Formatter\JsonFormatter;
use ByJG\Serializer\Formatter\PlainTextFormatter;
use ByJG\Serializer\Formatter\XmlFormatter;
use PHPUnit\Framework\TestCase;
use stdClass;
use Tests\Sample\ModelForceProperty;
use Tests\Sample\ModelGetter;
Expand All @@ -13,12 +14,7 @@
use Tests\Sample\ModelList3;
use Tests\Sample\ModelPublic;

// backward compatibility
if (!class_exists('\PHPUnit\Framework\TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}

class SerializerObjectTest extends \PHPUnit\Framework\TestCase
class SerializerObjectTest extends TestCase
{

/**
Expand Down

0 comments on commit 3b5c9a2

Please sign in to comment.