From c01abcd657eef22628e42c93aa31c494b01498ef Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 28 May 2017 23:40:46 +0200 Subject: [PATCH] Mock StlFixer in StlConverterTest --- composer.lock | 123 ++++++++++++++---- tests/Service/BaseTest.php | 5 + .../Stl/StlConverter/StlConverterTest.php | 8 +- 3 files changed, 108 insertions(+), 28 deletions(-) diff --git a/composer.lock b/composer.lock index 6195ad8..36b7af3 100644 --- a/composer.lock +++ b/composer.lock @@ -1909,6 +1909,75 @@ ], "time": "2017-04-24T08:44:27+00:00" }, + { + "name": "pagerfanta/pagerfanta", + "version": "v1.0.5", + "source": { + "type": "git", + "url": "https://github.com/whiteoctober/Pagerfanta.git", + "reference": "29aade64addfdfb12c05aabf160f09d1aea6b143" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/whiteoctober/Pagerfanta/zipball/29aade64addfdfb12c05aabf160f09d1aea6b143", + "reference": "29aade64addfdfb12c05aabf160f09d1aea6b143", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "doctrine/orm": "~2.3", + "doctrine/phpcr-odm": "1.*", + "jackalope/jackalope-doctrine-dbal": "1.*", + "jmikola/geojson": "~1.0", + "mandango/mandango": "~1.0@dev", + "mandango/mondator": "~1.0@dev", + "phpunit/phpunit": "~4 | ~5", + "propel/propel": "~2.0@dev", + "propel/propel1": "~1.6", + "ruflin/elastica": "~1.3", + "solarium/solarium": "~3.1" + }, + "suggest": { + "doctrine/mongodb-odm": "To use the DoctrineODMMongoDBAdapter.", + "doctrine/orm": "To use the DoctrineORMAdapter.", + "doctrine/phpcr-odm": "To use the DoctrineODMPhpcrAdapter. >= 1.1.0", + "mandango/mandango": "To use the MandangoAdapter.", + "propel/propel": "To use the Propel2Adapter", + "propel/propel1": "To use the PropelAdapter", + "solarium/solarium": "To use the SolariumAdapter." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pagerfanta\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Pablo Díez", + "email": "pablodip@gmail.com" + } + ], + "description": "Pagination for PHP 5.3", + "keywords": [ + "page", + "pagination", + "paginator", + "paging" + ], + "time": "2017-03-20T13:46:15+00:00" + }, { "name": "paragonie/random_compat", "version": "v2.0.10", @@ -2777,21 +2846,21 @@ }, { "name": "symfony/swiftmailer-bundle", - "version": "v2.5.4", + "version": "v2.6.2", "source": { "type": "git", "url": "https://github.com/symfony/swiftmailer-bundle.git", - "reference": "8ab32ce31a7156621fb92e0466586186beb89759" + "reference": "deabc81120c2086571f7c4484ab785c5e1b84f75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/8ab32ce31a7156621fb92e0466586186beb89759", - "reference": "8ab32ce31a7156621fb92e0466586186beb89759", + "url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/deabc81120c2086571f7c4484ab785c5e1b84f75", + "reference": "deabc81120c2086571f7c4484ab785c5e1b84f75", "shasum": "" }, "require": { "php": ">=5.3.2", - "swiftmailer/swiftmailer": ">=4.2.0,~5.0", + "swiftmailer/swiftmailer": "~4.2|~5.0", "symfony/config": "~2.7|~3.0", "symfony/dependency-injection": "~2.7|~3.0", "symfony/http-kernel": "~2.7|~3.0" @@ -2799,7 +2868,7 @@ "require-dev": { "symfony/console": "~2.7|~3.0", "symfony/framework-bundle": "~2.7|~3.0", - "symfony/phpunit-bridge": "~2.7|~3.0", + "symfony/phpunit-bridge": "~3.3@dev", "symfony/yaml": "~2.7|~3.0" }, "suggest": { @@ -2808,7 +2877,7 @@ "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -2832,7 +2901,7 @@ ], "description": "Symfony SwiftmailerBundle", "homepage": "http://symfony.com", - "time": "2017-03-21T21:47:36+00:00" + "time": "2017-05-22T04:58:24+00:00" }, { "name": "symfony/symfony", @@ -4259,16 +4328,16 @@ }, { "name": "phpunit/phpunit", - "version": "6.1.3", + "version": "6.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "824d02024916525a36b2db21847a5ef91db9e4a8" + "reference": "42b7f394a8e009516582331b1e03a1aba40175d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/824d02024916525a36b2db21847a5ef91db9e4a8", - "reference": "824d02024916525a36b2db21847a5ef91db9e4a8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/42b7f394a8e009516582331b1e03a1aba40175d1", + "reference": "42b7f394a8e009516582331b1e03a1aba40175d1", "shasum": "" }, "require": { @@ -4288,8 +4357,8 @@ "phpunit/php-timer": "^1.0.6", "phpunit/phpunit-mock-objects": "^4.0", "sebastian/comparator": "^2.0", - "sebastian/diff": "^1.2", - "sebastian/environment": "^3.0.1", + "sebastian/diff": "^1.4.3 || ^2.0", + "sebastian/environment": "^3.0.2", "sebastian/exporter": "^3.1", "sebastian/global-state": "^1.1 || ^2.0", "sebastian/object-enumerator": "^3.0.2", @@ -4339,7 +4408,7 @@ "testing", "xunit" ], - "time": "2017-04-29T10:40:17+00:00" + "time": "2017-05-22T07:45:30+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -4511,23 +4580,23 @@ }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { @@ -4559,7 +4628,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08T07:14:41+00:00" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", @@ -5015,16 +5084,16 @@ }, { "name": "symfony/phpunit-bridge", - "version": "dev-master", + "version": "3.3.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "9706535602ce13c31aee49ccee5d6bfd895aadb5" + "reference": "f3c575cdc1ae01cc93b17f8fc13508b87e418f32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/9706535602ce13c31aee49ccee5d6bfd895aadb5", - "reference": "9706535602ce13c31aee49ccee5d6bfd895aadb5", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/f3c575cdc1ae01cc93b17f8fc13508b87e418f32", + "reference": "f3c575cdc1ae01cc93b17f8fc13508b87e418f32", "shasum": "" }, "require": { @@ -5073,7 +5142,7 @@ ], "description": "Symfony PHPUnit Bridge", "homepage": "https://symfony.com", - "time": "2017-04-12 14:14:56" + "time": "2017-05-21 17:39:57" }, { "name": "symfony/polyfill-php54", diff --git a/tests/Service/BaseTest.php b/tests/Service/BaseTest.php index f6e333a..1b36b54 100644 --- a/tests/Service/BaseTest.php +++ b/tests/Service/BaseTest.php @@ -43,4 +43,9 @@ abstract class BaseTest extends WebTestCase { return $this->_container->get($service); } + + protected function getParameter($parameter) + { + return $this->_container->getParameter($parameter); + } } diff --git a/tests/Service/Stl/StlConverter/StlConverterTest.php b/tests/Service/Stl/StlConverter/StlConverterTest.php index 856c34a..0e24aed 100644 --- a/tests/Service/Stl/StlConverter/StlConverterTest.php +++ b/tests/Service/Stl/StlConverter/StlConverterTest.php @@ -3,6 +3,7 @@ namespace Tests\AppBundle\Service\Stl; use AppBundle\Service\Stl\StlConverterService; +use AppBundle\Service\Stl\StlFixerService; use League\Flysystem\Adapter\Local; use League\Flysystem\Filesystem; use Tests\AppBundle\Service\BaseTest; @@ -15,7 +16,12 @@ class StlConverterTest extends BaseTest public function setUp() { - $this->stlConverter = $this->get('service.stl.converter'); + $ldview = $this->getParameter('ldview_bin'); + + $stlFixer = $this->createMock(StlFixerService::class); + $stlFixer->method('fix'); + + $this->stlConverter = new StlConverterService($ldview,$this->filesystem,$stlFixer); $adapter = new Local(__DIR__.'/fixtures/ldraw'); $ldrawLibraryContext = new Filesystem($adapter);