From af77018a7519549c781d5c00b2ec2fef5853fba3 Mon Sep 17 00:00:00 2001 From: Darryn Ten Date: Fri, 17 Aug 2018 11:38:44 +0200 Subject: [PATCH 1/7] PHP 7.2 Support --- .travis.yml | 1 + src/Layers/BaseLayer.php | 2 +- src/Layers/Layer/TextLayer.php | 29 +++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 191edc1..014af4c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: php php: - 7.1 + - 7.2 before_script: - sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libgif-dev webp openjpeg-tools - wget https://github.com/ImageMagick/ImageMagick/archive/7.0.7-21.tar.gz diff --git a/src/Layers/BaseLayer.php b/src/Layers/BaseLayer.php index b95ace8..fd91b8c 100644 --- a/src/Layers/BaseLayer.php +++ b/src/Layers/BaseLayer.php @@ -254,7 +254,7 @@ public function getLayerDetailsJson() public function render() { - if (sizeof($this->filters->collection > 0)) { + if (sizeof($this->filters->collection)) { foreach ($this->filters->collection as $filter) { $filter->setImage($this->canvas); $filter->render(); diff --git a/src/Layers/Layer/TextLayer.php b/src/Layers/Layer/TextLayer.php index ac7d006..f934dc5 100644 --- a/src/Layers/Layer/TextLayer.php +++ b/src/Layers/Layer/TextLayer.php @@ -122,6 +122,13 @@ class TextLayer extends BaseLayer */ public $strokeOpacity; + /** + * Rotation + * + * @var float $rotation The angle of the text. + */ + public $rotation; + /** * Construct the text layer */ @@ -187,6 +194,10 @@ public function __construct(array $config) !empty($config['strokeOpacity']) ? $config['strokeOpacity'] : 0.0 ); + $this->rotation( + !empty($config['rotation']) ? $config['rotation'] : 0.0 + ); + parent::__construct($config); } @@ -430,6 +441,22 @@ public function textDecoration(int $textDecoration = null) return $this->textDecoration = $textDecoration; } + /** + * Get and set the rotation + * + * @param null|float $rotation The rotation in degrees + * + * @return boolean|float + */ + public function rotation(float $rotation = null) + { + if ($rotation === null) { + return $this->rotation; + } + + return $this->rotation = $rotation; + } + /** * Get and set the text * @@ -479,6 +506,8 @@ public function render() $this->positionY = $this->positionY + $dimensions['textHeight'] * 0.66; $this->canvas->annotateImage($draw, $this->positionX, $this->positionY, 0, $this->text); + $this->canvas->rotateImage(new \ImagickPixel('#00000000'), $this->rotation); + $this->canvas->setImagePage($this->canvas->getImageWidth(), $this->canvas->getImageHeight(), 0, 0); return $this->canvas; } From 33718905fde730d1311e6c2d349b89d38d882ec4 Mon Sep 17 00:00:00 2001 From: Darryn Ten Date: Fri, 17 Aug 2018 13:29:07 +0200 Subject: [PATCH 2/7] Update to PHPUnit 7 and update Tests --- composer.json | 2 +- composer.lock | 625 +++++++++--------- phpunit.xml | 4 +- src/Layers/BaseLayer.php | 2 +- .../Exceptions/PslayersExceptionTest.php | 2 +- .../Filters/Filter/BlankFilterTest.php | 2 +- .../StainedGlass/StainedGlassFilterTest.php | 2 +- .../Pslayers/Filters/FilterCollectionTest.php | 2 +- .../Pslayers/Layers/Layer/BlankLayerTest.php | 2 +- .../Layers/Layer/GradientLayerTest.php | 2 +- .../Pslayers/Layers/Layer/GroupLayerTest.php | 14 +- .../Pslayers/Layers/Layer/ImageLayerTest.php | 4 +- .../Pslayers/Layers/Layer/SolidLayerTest.php | 2 +- tests/Pslayers/Layers/Layer/TextLayerTest.php | 5 +- tests/Pslayers/Layers/LayerCollectionTest.php | 2 +- tests/Pslayers/PslayersTest.php | 38 +- .../Validators/ColourValidatorTest.php | 2 +- .../Validators/ImageTypeValidatorTest.php | 2 +- .../Validators/TextLayerValidatorTest.php | 2 +- 19 files changed, 391 insertions(+), 325 deletions(-) diff --git a/composer.json b/composer.json index 26ebd98..0b6e1ca 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "darrynten/imagick-scripts": "~1.0.1" }, "require-dev": { - "phpunit/phpunit": "~5.0", + "phpunit/phpunit": "^7.0", "mockery/mockery": "dev-master" }, "config": { diff --git a/composer.lock b/composer.lock index 83c4b3b..0fab1db 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "596cb5af878cf5a5ce465f13ebc6813f", + "content-hash": "b3e7b448b2f2cc4f5e645fbd1e63c655", "packages": [ { "name": "darrynten/any-cache", @@ -322,16 +322,16 @@ }, { "name": "symfony/process", - "version": "v4.1.0", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "73445bd33b0d337c060eef9652b94df72b6b3434" + "reference": "f01fc7a4493572f7f506c49dcb50ad01fb3a2f56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/73445bd33b0d337c060eef9652b94df72b6b3434", - "reference": "73445bd33b0d337c060eef9652b94df72b6b3434", + "url": "https://api.github.com/repos/symfony/process/zipball/f01fc7a4493572f7f506c49dcb50ad01fb3a2f56", + "reference": "f01fc7a4493572f7f506c49dcb50ad01fb3a2f56", "shasum": "" }, "require": { @@ -367,7 +367,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-05-30T07:26:09+00:00" + "time": "2018-07-26T11:24:31+00:00" } ], "packages-dev": [ @@ -479,12 +479,12 @@ "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "99e29d3596b16dabe4982548527d5ddf90232e99" + "reference": "12d4d35c93959c45370f2959e8ee2234b61f13aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/99e29d3596b16dabe4982548527d5ddf90232e99", - "reference": "99e29d3596b16dabe4982548527d5ddf90232e99", + "url": "https://api.github.com/repos/mockery/mockery/zipball/12d4d35c93959c45370f2959e8ee2234b61f13aa", + "reference": "12d4d35c93959c45370f2959e8ee2234b61f13aa", "shasum": "" }, "require": { @@ -537,20 +537,20 @@ "test double", "testing" ], - "time": "2018-05-08T08:54:48+00:00" + "time": "2018-07-30T15:34:24+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.8.0", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6" + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/478465659fd987669df0bd8a9bf22a8710e5f1b6", - "reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", "shasum": "" }, "require": { @@ -585,7 +585,109 @@ "object", "object graph" ], - "time": "2018-05-29T17:25:09+00:00" + "time": "2018-06-11T23:09:50+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -741,16 +843,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.7.6", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "shasum": "" }, "require": { @@ -762,12 +864,12 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -800,44 +902,44 @@ "spy", "stub" ], - "time": "2018-04-18T13:57:24+00:00" + "time": "2018-08-05T17:53:17+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.8", + "version": "6.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" + "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/865662550c384bc1db7e51d29aeda1c2c161d69a", + "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" }, "require-dev": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^7.0" }, "suggest": { - "ext-xdebug": "^2.5.1" + "ext-xdebug": "^2.6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "6.0-dev" } }, "autoload": { @@ -852,7 +954,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -863,29 +965,29 @@ "testing", "xunit" ], - "time": "2017-04-02T07:44:40+00:00" + "time": "2018-06-01T07:51:50+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cecbc684605bb0cc288828eb5d65d93d5c676d3c", + "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -900,7 +1002,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -910,7 +1012,7 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "time": "2018-06-11T11:44:00+00:00" }, { "name": "phpunit/php-text-template", @@ -955,28 +1057,28 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.9", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -991,7 +1093,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1000,33 +1102,33 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" + "time": "2018-02-01T13:07:23+00:00" }, { "name": "phpunit/php-token-stream", - "version": "2.0.2", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" + "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/21ad88bbba7c3d93530d93994e0a33cd45f02ace", + "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.2.4" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1049,55 +1151,57 @@ "keywords": [ "tokenizer" ], - "time": "2017-11-27T05:48:46+00:00" + "time": "2018-02-01T13:16:43+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.27", + "version": "7.3.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c" + "reference": "f9b14c17860eccb440a0352a117a81eb754cff5a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f9b14c17860eccb440a0352a117a81eb754cff5a", + "reference": "f9b14c17860eccb440a0352a117a81eb754cff5a", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "^1.4.3", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "^1.0.6|^2.0.1", - "symfony/yaml": "~2.1|~3.0|~4.0" + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.0", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" }, "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" + "phpunit/phpunit-mock-objects": "*" }, "require-dev": { "ext-pdo": "*" }, "suggest": { + "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" + "phpunit/php-invoker": "^2.0" }, "bin": [ "phpunit" @@ -1105,7 +1209,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "7.3-dev" } }, "autoload": { @@ -1131,66 +1235,7 @@ "testing", "xunit" ], - "time": "2018-02-01T05:50:59+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2017-06-30T09:13:00+00:00" + "time": "2018-08-07T06:44:28+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1239,30 +1284,30 @@ }, { "name": "sebastian/comparator", - "version": "1.2.4", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1293,38 +1338,39 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-01-29T09:50:25+00:00" + "time": "2018-07-12T15:12:46+00:00" }, { "name": "sebastian/diff", - "version": "1.4.3", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + "reference": "366541b989927187c4ca70490a35615d3fef2dce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce", + "reference": "366541b989927187c4ca70490a35615d3fef2dce", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.0", + "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1349,34 +1395,37 @@ "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2017-05-22T07:24:03+00:00" + "time": "2018-06-10T07:54:39+00:00" }, { "name": "sebastian/environment", - "version": "2.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^6.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -1401,34 +1450,34 @@ "environment", "hhvm" ], - "time": "2016-11-26T07:53:53+00:00" + "time": "2017-07-01T08:51:00+00:00" }, { "name": "sebastian/exporter", - "version": "2.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -1468,27 +1517,27 @@ "export", "exporter" ], - "time": "2016-11-19T08:54:04+00:00" + "time": "2017-04-03T13:19:02+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-uopz": "*" @@ -1496,7 +1545,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1519,33 +1568,34 @@ "keywords": [ "global state" ], - "time": "2015-10-12T03:26:01+00:00" + "time": "2017-04-27T15:39:26+00:00" }, { "name": "sebastian/object-enumerator", - "version": "2.0.1", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1565,32 +1615,77 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" }, { "name": "sebastian/recursion-context", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1618,7 +1713,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" + "time": "2017-03-03T06:23:57+00:00" }, { "name": "sebastian/resource-operations", @@ -1706,118 +1801,44 @@ "time": "2016-10-03T07:35:21+00:00" }, { - "name": "symfony/polyfill-ctype", - "version": "v1.8.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2018-04-30T19:57:29+00:00" - }, - { - "name": "symfony/yaml", - "version": "v4.1.0", + "name": "theseer/tokenizer", + "version": "1.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "80e4bfa9685fc4a09acc4a857ec16974a9cd944e" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/80e4bfa9685fc4a09acc4a857ec16974a9cd944e", - "reference": "80e4bfa9685fc4a09acc4a857ec16974a9cd944e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" } ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2018-05-30T07:26:09+00:00" + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" }, { "name": "webmozart/assert", diff --git a/phpunit.xml b/phpunit.xml index 0694cef..eb1f4c9 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -10,14 +10,14 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" forceCoversAnnotation="false" - printerClass="PHPUnit_TextUI_ResultPrinter" + printerClass="PHPUnit\TextUI\ResultPrinter" processIsolation="false" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" stopOnRisky="false" - testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader" + testSuiteLoaderClass="PHPUnit\Runner\StandardTestSuiteLoader" timeoutForSmallTests="1" timeoutForMediumTests="10" timeoutForLargeTests="60" diff --git a/src/Layers/BaseLayer.php b/src/Layers/BaseLayer.php index fd91b8c..5bbbb6e 100644 --- a/src/Layers/BaseLayer.php +++ b/src/Layers/BaseLayer.php @@ -254,7 +254,7 @@ public function getLayerDetailsJson() public function render() { - if (sizeof($this->filters->collection)) { + if (sizeof($this->filters->collection) > 0) { foreach ($this->filters->collection as $filter) { $filter->setImage($this->canvas); $filter->render(); diff --git a/tests/Pslayers/Exceptions/PslayersExceptionTest.php b/tests/Pslayers/Exceptions/PslayersExceptionTest.php index 619bcb3..f2800c9 100644 --- a/tests/Pslayers/Exceptions/PslayersExceptionTest.php +++ b/tests/Pslayers/Exceptions/PslayersExceptionTest.php @@ -13,7 +13,7 @@ use DarrynTen\Pslayers\Filters\Filter\Standard\Blur\BlurFilter; use DarrynTen\Pslayers\Validators\ColourValidator; -class PslayersExceptionTest extends \PHPUnit_Framework_TestCase +class PslayersExceptionTest extends \PHPUnit\Framework\TestCase { public function testJsonException() { diff --git a/tests/Pslayers/Filters/Filter/BlankFilterTest.php b/tests/Pslayers/Filters/Filter/BlankFilterTest.php index 4b8e2ec..96a0674 100644 --- a/tests/Pslayers/Filters/Filter/BlankFilterTest.php +++ b/tests/Pslayers/Filters/Filter/BlankFilterTest.php @@ -6,7 +6,7 @@ use DarrynTen\Pslayers\Filters\Filter\BlankFilter; use DarrynTen\Pslayers\Exceptions\PslayersException; -class BlankFilterTest extends \PHPUnit_Framework_TestCase +class BlankFilterTest extends \PHPUnit\Framework\TestCase { public function getTestImage() { diff --git a/tests/Pslayers/Filters/Filter/Fred/StainedGlass/StainedGlassFilterTest.php b/tests/Pslayers/Filters/Filter/Fred/StainedGlass/StainedGlassFilterTest.php index c93c296..c369cfc 100644 --- a/tests/Pslayers/Filters/Filter/Fred/StainedGlass/StainedGlassFilterTest.php +++ b/tests/Pslayers/Filters/Filter/Fred/StainedGlass/StainedGlassFilterTest.php @@ -8,7 +8,7 @@ use DarrynTen\Pslayers\Filters\Filter\Fred\StainedGlass\StainedGlassFilter; use DarrynTen\Pslayers\Exceptions\PslayersException; -class StainedGlassFilterTest extends \PHPUnit_Framework_TestCase +class StainedGlassFilterTest extends \PHPUnit\Framework\TestCase { public function getTestImage() { diff --git a/tests/Pslayers/Filters/FilterCollectionTest.php b/tests/Pslayers/Filters/FilterCollectionTest.php index 58155c7..c628382 100644 --- a/tests/Pslayers/Filters/FilterCollectionTest.php +++ b/tests/Pslayers/Filters/FilterCollectionTest.php @@ -5,7 +5,7 @@ use DarrynTen\Pslayers\Filters\Filter\BlankFilter; use DarrynTen\Pslayers\Filters\FilterCollection; -class FilterCollectionTest extends \PHPUnit_Framework_TestCase +class FilterCollectionTest extends \PHPUnit\Framework\TestCase { public function getTestImage() { diff --git a/tests/Pslayers/Layers/Layer/BlankLayerTest.php b/tests/Pslayers/Layers/Layer/BlankLayerTest.php index adbdbfd..655b9a2 100644 --- a/tests/Pslayers/Layers/Layer/BlankLayerTest.php +++ b/tests/Pslayers/Layers/Layer/BlankLayerTest.php @@ -5,7 +5,7 @@ use Imagick; use DarrynTen\Pslayers\Layers\Layer\BlankLayer; -class BlankLayerTest extends \PHPUnit_Framework_TestCase +class BlankLayerTest extends \PHPUnit\Framework\TestCase { public function testNewBlankLayer() { diff --git a/tests/Pslayers/Layers/Layer/GradientLayerTest.php b/tests/Pslayers/Layers/Layer/GradientLayerTest.php index 7fc83fb..b514065 100644 --- a/tests/Pslayers/Layers/Layer/GradientLayerTest.php +++ b/tests/Pslayers/Layers/Layer/GradientLayerTest.php @@ -5,7 +5,7 @@ use Imagick; use DarrynTen\Pslayers\Layers\Layer\GradientLayer; -class GradientLayerTest extends \PHPUnit_Framework_TestCase +class GradientLayerTest extends \PHPUnit\Framework\TestCase { public function testGradientLayer() { diff --git a/tests/Pslayers/Layers/Layer/GroupLayerTest.php b/tests/Pslayers/Layers/Layer/GroupLayerTest.php index ecd320c..49cfab9 100644 --- a/tests/Pslayers/Layers/Layer/GroupLayerTest.php +++ b/tests/Pslayers/Layers/Layer/GroupLayerTest.php @@ -7,7 +7,7 @@ use DarrynTen\Pslayers\Layers\Layer\GroupLayer; use DarrynTen\Pslayers\Layers\Layer\BlankLayer; -class GroupLayerTest extends \PHPUnit_Framework_TestCase +class GroupLayerTest extends \PHPUnit\Framework\TestCase { public function testNewGroupLayer() { @@ -47,8 +47,20 @@ public function testNewGroupLayer() 'id' => 3, 'width' => 200, 'height' => 200, + ]); + + $this->assertEmpty($anotherLayer->group->collection); + $anotherLayer->addLayer($newLayer, 9); + $this->assertNotEmpty($anotherLayer->group->collection); + + $anotherLayerWithGroup = new GroupLayer([ + 'id' => 3, + 'width' => 200, + 'height' => 200, 'group' => $collection ]); + + $this->assertNotEmpty($anotherLayerWithGroup->group->collection); } public function testGetGroupLayerArray() diff --git a/tests/Pslayers/Layers/Layer/ImageLayerTest.php b/tests/Pslayers/Layers/Layer/ImageLayerTest.php index 52f829b..7ceee71 100644 --- a/tests/Pslayers/Layers/Layer/ImageLayerTest.php +++ b/tests/Pslayers/Layers/Layer/ImageLayerTest.php @@ -3,10 +3,10 @@ namespace DarrynTen\Pslayers\Tests; use Imagick; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use DarrynTen\Pslayers\Layers\Layer\ImageLayer; -class ImageLayerTest extends PHPUnit_Framework_TestCase +class ImageLayerTest extends \PHPUnit\Framework\TestCase { public function testImageLayer() { diff --git a/tests/Pslayers/Layers/Layer/SolidLayerTest.php b/tests/Pslayers/Layers/Layer/SolidLayerTest.php index 6292a9a..81f91c1 100644 --- a/tests/Pslayers/Layers/Layer/SolidLayerTest.php +++ b/tests/Pslayers/Layers/Layer/SolidLayerTest.php @@ -5,7 +5,7 @@ use Imagick; use DarrynTen\Pslayers\Layers\Layer\SolidLayer; -class SolidLayerTest extends \PHPUnit_Framework_TestCase +class SolidLayerTest extends \PHPUnit\Framework\TestCase { public function testSolidLayer() { diff --git a/tests/Pslayers/Layers/Layer/TextLayerTest.php b/tests/Pslayers/Layers/Layer/TextLayerTest.php index 8d419ea..1df0ec2 100644 --- a/tests/Pslayers/Layers/Layer/TextLayerTest.php +++ b/tests/Pslayers/Layers/Layer/TextLayerTest.php @@ -5,7 +5,7 @@ use Imagick; use DarrynTen\Pslayers\Layers\Layer\TextLayer; -class TextLayerTest extends \PHPUnit_Framework_TestCase +class TextLayerTest extends \PHPUnit\Framework\TestCase { public function testNewTextLayer() { @@ -85,6 +85,9 @@ public function testText() $layer->strokeOpacity(1.0); $this->assertEquals(1.0, $layer->strokeOpacity()); + + $layer->rotation(1.0); + $this->assertEquals(1.0, $layer->rotation()); } public function testGetTextLayerArray() diff --git a/tests/Pslayers/Layers/LayerCollectionTest.php b/tests/Pslayers/Layers/LayerCollectionTest.php index 6d9706e..3dd0a21 100644 --- a/tests/Pslayers/Layers/LayerCollectionTest.php +++ b/tests/Pslayers/Layers/LayerCollectionTest.php @@ -6,7 +6,7 @@ use DarrynTen\Pslayers\Layers\LayerCollection; use DarrynTen\Pslayers\Filters\Filter\BlankFilter; -class LayerCollectionTest extends \PHPUnit_Framework_TestCase +class LayerCollectionTest extends \PHPUnit\Framework\TestCase { public function testNewLayers() { diff --git a/tests/Pslayers/PslayersTest.php b/tests/Pslayers/PslayersTest.php index 4db69e2..736e366 100644 --- a/tests/Pslayers/PslayersTest.php +++ b/tests/Pslayers/PslayersTest.php @@ -21,7 +21,7 @@ use DarrynTen\Pslayers\Filters\Filter\Fred\Dice\DiceFilter; use DarrynTen\Pslayers\Filters\Filter\Standard\Blur\BlurFilter; -class PslayersTest extends \PHPUnit_Framework_TestCase +class PslayersTest extends \PHPUnit\Framework\TestCase { public function testConstruct() { @@ -61,6 +61,29 @@ public function testConstruct() $this->assertArrayNotHasKey(2, $instance->layers->collection); } + public function testRender() + { + $config = [ + 'id' => 11, + 'width' => 800, + 'height' => 380, + 'outputPath' => '/tmp/test.png', + ]; + + $instance = new Pslayers($config); + $this->assertInstanceOf(Pslayers::class, $instance); + + $newLayer = new BlankLayer([ + 'id' => 'aaa', + 'width' => 20, + 'height' => 20 + ]); + + $instance->addLayer($newLayer, 1); + $instance->render(); + $this->assertFileExists('/tmp/test.png'); + } + public function testValidation() { $this->assertTrue(ImageTypeValidator::isValidImageType('jpg')); @@ -126,6 +149,8 @@ public function testMasterRender() ]); $instance->addLayer($radialGradientLayer, 2); + $this->assertEquals('#3FA', $radialGradientLayer->endColour()); + $this->assertEquals('#4A3', $radialGradientLayer->startColour()); // pattern layer $patternLayer = new PatternLayer([ @@ -142,6 +167,8 @@ public function testMasterRender() ]); $instance->addLayer($patternLayer, 3); + $this->assertEquals(1, $patternLayer->scale()); + $this->assertEquals('horizontal', $patternLayer->pattern()); // plasma layer $stainedGlassFilter = new StainedGlassFilter([ @@ -197,6 +224,7 @@ public function testMasterRender() 'text' => 'Some Text', 'composite' => Imagick::COMPOSITE_DEFAULT, 'fontColour' => '#FFF', + 'font' => __DIR__ . '/fonts/Passion_One/PassionOne-Regular.ttf', 'strokeColour' => 'none', 'strokeOpacity' => 0.0, 'fontSize' => 56, @@ -247,12 +275,14 @@ public function testMasterRender() ], ]); - // $instance->addLayer($imageLayer, 4); + $instance->addLayer($imageLayer, 7); - // $instance->render(); + $instance->render(); + $this->assertFileExists(__DIR__ . '/image/test.png'); + $this->assertFileExists('/tmp/tmp.png'); } - //Output path was not really optional + // Output path was not really optional public function testOptionalOutputPath() { $width = 830; diff --git a/tests/Pslayers/Validators/ColourValidatorTest.php b/tests/Pslayers/Validators/ColourValidatorTest.php index 97d26f3..faba74f 100644 --- a/tests/Pslayers/Validators/ColourValidatorTest.php +++ b/tests/Pslayers/Validators/ColourValidatorTest.php @@ -5,7 +5,7 @@ use DarrynTen\Pslayers\Validators\ColourValidator; use DarrynTen\Pslayers\Exceptions\PslayersException; -class ColourValidatorTest extends \PHPUnit_Framework_TestCase +class ColourValidatorTest extends \PHPUnit\Framework\TestCase { public function testValidation() { diff --git a/tests/Pslayers/Validators/ImageTypeValidatorTest.php b/tests/Pslayers/Validators/ImageTypeValidatorTest.php index 23f5680..411e95b 100644 --- a/tests/Pslayers/Validators/ImageTypeValidatorTest.php +++ b/tests/Pslayers/Validators/ImageTypeValidatorTest.php @@ -4,7 +4,7 @@ use DarrynTen\Pslayers\Validators\ImageTypeValidator; -class ImageTypeValidatorTest extends \PHPUnit_Framework_TestCase +class ImageTypeValidatorTest extends \PHPUnit\Framework\TestCase { public function testValidation() { diff --git a/tests/Pslayers/Validators/TextLayerValidatorTest.php b/tests/Pslayers/Validators/TextLayerValidatorTest.php index 5b901c2..232497b 100644 --- a/tests/Pslayers/Validators/TextLayerValidatorTest.php +++ b/tests/Pslayers/Validators/TextLayerValidatorTest.php @@ -5,7 +5,7 @@ use DarrynTen\Pslayers\Validators\TextLayerValidator; use DarrynTen\Pslayers\Exceptions\PslayersException; -class TextLayerValidatorTest extends \PHPUnit_Framework_TestCase +class TextLayerValidatorTest extends \PHPUnit\Framework\TestCase { public function testValidation() { From 8e77131e3ef754c1d9032cc7e421b03275938bea Mon Sep 17 00:00:00 2001 From: Darryn Ten Date: Fri, 17 Aug 2018 13:51:03 +0200 Subject: [PATCH 3/7] Master render test --- tests/Pslayers/PslayersTest.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/Pslayers/PslayersTest.php b/tests/Pslayers/PslayersTest.php index 736e366..bcd16b2 100644 --- a/tests/Pslayers/PslayersTest.php +++ b/tests/Pslayers/PslayersTest.php @@ -92,8 +92,6 @@ public function testValidation() public function testMasterRender() { - $output = '/tmp/tmp.png'; - $width = 830; $height = 360; @@ -101,7 +99,7 @@ public function testMasterRender() 'id' => 11, 'width' => $width, 'height' => $height, - 'outputPath' => $output, + 'outputPath' => '/tmp/testing.png', ]; $instance = new Pslayers($config); @@ -276,9 +274,9 @@ public function testMasterRender() ]); $instance->addLayer($imageLayer, 7); - $instance->render(); - $this->assertFileExists(__DIR__ . '/image/test.png'); + + $this->assertFileExists('/tmp/testing.png'); $this->assertFileExists('/tmp/tmp.png'); } From 1f93154524092f440e10791d4aeb8cb532bd97d2 Mon Sep 17 00:00:00 2001 From: Darryn Ten Date: Fri, 17 Aug 2018 14:01:00 +0200 Subject: [PATCH 4/7] Disable Fred Filter in Master render test --- tests/Pslayers/PslayersTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Pslayers/PslayersTest.php b/tests/Pslayers/PslayersTest.php index bcd16b2..1cd5611 100644 --- a/tests/Pslayers/PslayersTest.php +++ b/tests/Pslayers/PslayersTest.php @@ -207,7 +207,7 @@ public function testMasterRender() 'filters' => [ $blurFilter, // $diceFilter, - $stainedGlassFilter, + // $stainedGlassFilter, ], ]); From 3377a46b57dc226fe60a4464ecdf6de8ab80dea9 Mon Sep 17 00:00:00 2001 From: Darryn Ten Date: Fri, 17 Aug 2018 14:10:36 +0200 Subject: [PATCH 5/7] Switch the Filter used in the rendering tests --- tests/Pslayers/PslayersTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Pslayers/PslayersTest.php b/tests/Pslayers/PslayersTest.php index 1cd5611..8c67f22 100644 --- a/tests/Pslayers/PslayersTest.php +++ b/tests/Pslayers/PslayersTest.php @@ -269,7 +269,7 @@ public function testMasterRender() 'imageUrl' => __DIR__ . '/image/test.png', 'composite' => Imagick::COMPOSITE_MULTIPLY, 'filters' => [ - $stainedGlassFilter, + $blurFilter, ], ]); From 9d7024c4cca508fb1e3f169c06e29e58d09c1ea3 Mon Sep 17 00:00:00 2001 From: Darryn Ten Date: Fri, 17 Aug 2018 14:22:17 +0200 Subject: [PATCH 6/7] Fix broken assertion --- tests/Pslayers/PslayersTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Pslayers/PslayersTest.php b/tests/Pslayers/PslayersTest.php index 8c67f22..7bc4b22 100644 --- a/tests/Pslayers/PslayersTest.php +++ b/tests/Pslayers/PslayersTest.php @@ -277,7 +277,6 @@ public function testMasterRender() $instance->render(); $this->assertFileExists('/tmp/testing.png'); - $this->assertFileExists('/tmp/tmp.png'); } // Output path was not really optional From 3ef4626172af2d6e0cd5f65dba00a7aaff4cade7 Mon Sep 17 00:00:00 2001 From: Darryn Ten Date: Fri, 17 Aug 2018 14:34:22 +0200 Subject: [PATCH 7/7] Version bump --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0b6e1ca..6f4a42e 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "darrynten/pslayers", "description": "PHP Imagick Layers", - "version": "1.0.4", + "version": "1.0.5", "type": "library", "require": { "php": "^7.0",