diff --git a/.travis.yml b/.travis.yml index ed7ee60..3b65d0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: php php: + - "7.2" - "7.1" - "7.0" - "5.6" @@ -8,5 +9,5 @@ install: - composer install script: - - phpunit + - vendor/bin/phpunit diff --git a/composer.json b/composer.json index d235f4f..2b30628 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,9 @@ "php": ">=5.5", "ext-json": "*" }, + "require-dev": { + "phpunit/phpunit": ">5.7" + }, "suggest": { "ext-curl": "*" }, diff --git a/src/BaseModel.php b/src/BaseModel.php index 295b78f..23800a6 100644 --- a/src/BaseModel.php +++ b/src/BaseModel.php @@ -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) { diff --git a/src/BinderObject.php b/src/BinderObject.php index 62e3ea0..ff8f08d 100644 --- a/src/BinderObject.php +++ b/src/BinderObject.php @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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() { diff --git a/tests/Serialize/BaseModelTest.php b/tests/Serialize/BaseModelTest.php index 49febdf..7a73efa 100644 --- a/tests/Serialize/BaseModelTest.php +++ b/tests/Serialize/BaseModelTest.php @@ -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 { /** diff --git a/tests/Serialize/BinderObjectTest.php b/tests/Serialize/BinderObjectTest.php index 22f7491..6488e8c 100644 --- a/tests/Serialize/BinderObjectTest.php +++ b/tests/Serialize/BinderObjectTest.php @@ -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 { /** diff --git a/tests/Serialize/SerializerObjectTest.php b/tests/Serialize/SerializerObjectTest.php index 367bfd3..65bd0d2 100644 --- a/tests/Serialize/SerializerObjectTest.php +++ b/tests/Serialize/SerializerObjectTest.php @@ -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; @@ -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 { /**