From 2b7c92d22b079bd9b25b6027eb923fb46f52f3c0 Mon Sep 17 00:00:00 2001 From: Kamil Kokot Date: Mon, 30 Apr 2018 11:50:54 +0200 Subject: [PATCH] Make PHPUnit package tests great again --- phpunit.xml.dist | 1 - .../Bundle/AddressingBundle/composer.json | 6 ++-- .../Bundle/AddressingBundle/phpunit.xml.dist | 6 ++-- .../AddressingBundle/test/app/autoload.php | 30 ------------------- .../src/Tests/SyliusAddressingBundleTest.php | 6 ++-- src/Sylius/Bundle/AdminBundle/composer.json | 2 +- .../Bundle/AdminBundle/phpunit.xml.dist | 5 +--- .../Bundle/AttributeBundle/composer.json | 6 ++-- .../Bundle/AttributeBundle/phpunit.xml.dist | 7 ++--- .../AttributeBundle/test/app/autoload.php | 30 ------------------- .../src/Tests/SyliusAttributeBundleTest.php | 8 +++-- src/Sylius/Bundle/ChannelBundle/composer.json | 6 ++-- .../Bundle/ChannelBundle/phpunit.xml.dist | 21 ++----------- .../ChannelBundle/test/app/autoload.php | 30 ------------------- .../src/Tests/SyliusChannelBundleTest.php | 12 ++++---- .../Application/SyliusPluginTraitTest.php | 5 +++- src/Sylius/Bundle/CoreBundle/phpunit.xml.dist | 8 ----- .../Bundle/CurrencyBundle/composer.json | 6 ++-- .../Bundle/CurrencyBundle/phpunit.xml.dist | 6 ++-- .../CurrencyBundle/test/app/autoload.php | 30 ------------------- .../src/Tests/SyliusCurrencyBundleTest.php | 12 ++++---- .../Bundle/CustomerBundle/composer.json | 6 ++-- .../Bundle/CustomerBundle/phpunit.xml.dist | 6 ++-- .../CustomerBundle/test/app/autoload.php | 30 ------------------- .../src/Tests/SyliusCustomerBundleTest.php | 12 ++++---- .../Bundle/FixturesBundle/composer.json | 6 ++-- .../Bundle/FixturesBundle/humbug.json.dist | 17 ----------- .../Bundle/FixturesBundle/phpunit.xml.dist | 17 ++--------- .../FixturesBundle/test/app/autoload.php | 30 ------------------- .../src/Tests/SyliusFixturesBundleTest.php | 12 ++++---- src/Sylius/Bundle/GridBundle/composer.json | 6 ++-- src/Sylius/Bundle/GridBundle/phpunit.xml.dist | 22 ++++---------- .../Bundle/GridBundle/test/app/autoload.php | 30 ------------------- .../test/src/Tests/SyliusGridBundleTest.php | 8 +++-- .../Bundle/InventoryBundle/composer.json | 6 ++-- .../Bundle/InventoryBundle/phpunit.xml.dist | 6 ++-- .../InventoryBundle/test/app/autoload.php | 30 ------------------- .../src/Tests/SyliusInventoryBundleTest.php | 10 ++++--- src/Sylius/Bundle/LocaleBundle/composer.json | 6 ++-- .../Bundle/LocaleBundle/phpunit.xml.dist | 6 ++-- .../Bundle/LocaleBundle/test/app/autoload.php | 30 ------------------- .../test/src/Tests/SyliusLocaleBundleTest.php | 12 ++++---- src/Sylius/Bundle/MailerBundle/composer.json | 6 ++-- .../Bundle/MailerBundle/phpunit.xml.dist | 6 ++-- .../test/src/Tests/SyliusMailerBundleTest.php | 8 +++-- src/Sylius/Bundle/MoneyBundle/composer.json | 6 ++-- .../Bundle/MoneyBundle/phpunit.xml.dist | 6 ++-- .../Bundle/MoneyBundle/test/app/autoload.php | 30 ------------------- .../test/src/Tests/SyliusMoneyBundleTest.php | 14 +++++---- .../RegisterOrderProcessorPassTest.php | 4 +-- src/Sylius/Bundle/OrderBundle/composer.json | 11 +++---- .../Bundle/OrderBundle/phpunit.xml.dist | 7 ++--- .../Bundle/OrderBundle/test/app/autoload.php | 30 ------------------- .../test/src/Tests/SyliusOrderBundleTest.php | 12 ++++---- src/Sylius/Bundle/PaymentBundle/composer.json | 6 ++-- .../Bundle/PaymentBundle/phpunit.xml.dist | 6 ++-- .../PaymentBundle/test/app/autoload.php | 30 ------------------- .../Bundle/PaymentBundle/test/app/db.sql | 0 .../src/Tests/SyliusPaymentBundleTest.php | 8 +++-- src/Sylius/Bundle/ProductBundle/composer.json | 6 ++-- .../Bundle/ProductBundle/phpunit.xml.dist | 6 ++-- .../ProductBundle/test/app/autoload.php | 30 ------------------- .../src/Tests/SyliusProductBundleTest.php | 8 +++-- .../Bundle/PromotionBundle/composer.json | 3 +- .../Bundle/PromotionBundle/phpunit.xml.dist | 17 ++--------- .../PromotionBundle/test/app/autoload.php | 30 ------------------- .../src/Tests/SyliusPromotionBundleTest.php | 8 +++-- .../PrioritizedCompositeServicePass.php | 10 ++----- .../Bundle/ResourceBundle/composer.json | 3 +- .../Bundle/ResourceBundle/phpunit.xml.dist | 5 ++-- .../ResourceBundle/test/app/autoload.php | 30 ------------------- .../src/Tests/SyliusResourceBundleTest.php | 12 ++++---- src/Sylius/Bundle/ReviewBundle/composer.json | 6 ++-- .../Bundle/ReviewBundle/phpunit.xml.dist | 8 ++--- .../Bundle/ReviewBundle/test/app/autoload.php | 30 ------------------- .../test/src/Tests/SyliusReviewBundleTest.php | 8 +++-- .../Bundle/ShippingBundle/composer.json | 5 +--- .../Bundle/ShippingBundle/phpunit.xml.dist | 6 ++-- .../ShippingBundle/test/app/autoload.php | 30 ------------------- .../src/Tests/SyliusShippingBundleTest.php | 8 +++-- src/Sylius/Bundle/ShopBundle/composer.json | 22 +++++++++----- src/Sylius/Bundle/ShopBundle/phpunit.xml.dist | 9 +++--- .../Bundle/TaxationBundle/composer.json | 6 ++-- .../Bundle/TaxationBundle/phpunit.xml.dist | 7 ++--- .../TaxationBundle/test/app/autoload.php | 30 ------------------- .../src/Tests/SyliusTaxationBundleTest.php | 8 +++-- .../Functional/SyliusTaxonomyBundleTest.php | 7 +++-- .../Bundle/TaxonomyBundle/phpunit.xml.dist | 6 ++-- .../Functional/SyliusThemeBundleTest.php | 7 +++-- .../Bundle/ThemeBundle/phpunit.xml.dist | 7 ++--- .../Tests/Functional/SyliusUserBundleTest.php | 7 +++-- src/Sylius/Bundle/UserBundle/phpunit.xml.dist | 6 ++-- src/Sylius/Component/Core/composer.json | 2 +- 93 files changed, 264 insertions(+), 870 deletions(-) delete mode 100644 src/Sylius/Bundle/AddressingBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/AttributeBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/ChannelBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/CurrencyBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/CustomerBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/FixturesBundle/humbug.json.dist delete mode 100644 src/Sylius/Bundle/FixturesBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/GridBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/InventoryBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/LocaleBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/MoneyBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/OrderBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/PaymentBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/PaymentBundle/test/app/db.sql delete mode 100644 src/Sylius/Bundle/ProductBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/PromotionBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/ResourceBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/ReviewBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/ShippingBundle/test/app/autoload.php delete mode 100644 src/Sylius/Bundle/TaxationBundle/test/app/autoload.php diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7991ae8923..a0b32618ab 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,7 +2,6 @@ diff --git a/src/Sylius/Bundle/AddressingBundle/composer.json b/src/Sylius/Bundle/AddressingBundle/composer.json index 3de5414695..8a6252ae3c 100644 --- a/src/Sylius/Bundle/AddressingBundle/composer.json +++ b/src/Sylius/Bundle/AddressingBundle/composer.json @@ -48,9 +48,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\AddressingBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\AddressingBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/AddressingBundle/phpunit.xml.dist b/src/Sylius/Bundle/AddressingBundle/phpunit.xml.dist index 0c17969de4..6f8a895e79 100644 --- a/src/Sylius/Bundle/AddressingBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/AddressingBundle/phpunit.xml.dist @@ -2,14 +2,12 @@ - - + + ./test/ diff --git a/src/Sylius/Bundle/AddressingBundle/test/app/autoload.php b/src/Sylius/Bundle/AddressingBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/AddressingBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/AdminBundle/composer.json b/src/Sylius/Bundle/AdminBundle/composer.json index 0ba8b13fab..1b8fad21b8 100644 --- a/src/Sylius/Bundle/AdminBundle/composer.json +++ b/src/Sylius/Bundle/AdminBundle/composer.json @@ -28,8 +28,8 @@ "symfony/framework-bundle": "^3.4|^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.5", "phpspec/phpspec": "^4.0", + "phpunit/phpunit": "^6.5", "symfony/dependency-injection": "^3.4|^4.0" }, "conflict": { diff --git a/src/Sylius/Bundle/AdminBundle/phpunit.xml.dist b/src/Sylius/Bundle/AdminBundle/phpunit.xml.dist index 4a103a2f8f..8e948485a4 100644 --- a/src/Sylius/Bundle/AdminBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/AdminBundle/phpunit.xml.dist @@ -1,15 +1,12 @@ - - ./Tests + ./Tests/ diff --git a/src/Sylius/Bundle/AttributeBundle/composer.json b/src/Sylius/Bundle/AttributeBundle/composer.json index 809bc068bd..f5e6886a8c 100644 --- a/src/Sylius/Bundle/AttributeBundle/composer.json +++ b/src/Sylius/Bundle/AttributeBundle/composer.json @@ -46,9 +46,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\AttributeBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\AttributeBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/AttributeBundle/phpunit.xml.dist b/src/Sylius/Bundle/AttributeBundle/phpunit.xml.dist index 3d5316df07..515f1ccf8f 100644 --- a/src/Sylius/Bundle/AttributeBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/AttributeBundle/phpunit.xml.dist @@ -2,17 +2,16 @@ - - + + ./test/ + ./Tests/ diff --git a/src/Sylius/Bundle/AttributeBundle/test/app/autoload.php b/src/Sylius/Bundle/AttributeBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/AttributeBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/ChannelBundle/composer.json b/src/Sylius/Bundle/ChannelBundle/composer.json index 44f2ceef3b..1c42ca404a 100644 --- a/src/Sylius/Bundle/ChannelBundle/composer.json +++ b/src/Sylius/Bundle/ChannelBundle/composer.json @@ -45,9 +45,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\ChannelBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\ChannelBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/ChannelBundle/phpunit.xml.dist b/src/Sylius/Bundle/ChannelBundle/phpunit.xml.dist index c1a3d69440..596a077a0e 100644 --- a/src/Sylius/Bundle/ChannelBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/ChannelBundle/phpunit.xml.dist @@ -1,32 +1,17 @@ - - - + - - Tests - - - + ./test/ + ./Tests/ - - - - - Resources - Tests - - - diff --git a/src/Sylius/Bundle/ChannelBundle/test/app/autoload.php b/src/Sylius/Bundle/ChannelBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/ChannelBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/CoreBundle/Tests/Application/SyliusPluginTraitTest.php b/src/Sylius/Bundle/CoreBundle/Tests/Application/SyliusPluginTraitTest.php index 4c26bf6dee..3157a6b9a5 100644 --- a/src/Sylius/Bundle/CoreBundle/Tests/Application/SyliusPluginTraitTest.php +++ b/src/Sylius/Bundle/CoreBundle/Tests/Application/SyliusPluginTraitTest.php @@ -13,6 +13,7 @@ declare(strict_types=1); namespace Sylius\Bundle\CoreBundle\Tests\Application; +use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; use Sylius\Bundle\CoreBundle\Application\SyliusPluginTrait; use Symfony\Component\HttpKernel\Bundle\Bundle; @@ -24,8 +25,10 @@ final class SyliusPluginTraitTest extends TestCase */ public function it_does_not_crash(): void { - new class() extends Bundle { + $class = new class() extends Bundle { use SyliusPluginTrait; }; + + Assert::assertNotNull($class); } } diff --git a/src/Sylius/Bundle/CoreBundle/phpunit.xml.dist b/src/Sylius/Bundle/CoreBundle/phpunit.xml.dist index cb8d986d0d..1167b623b8 100644 --- a/src/Sylius/Bundle/CoreBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/CoreBundle/phpunit.xml.dist @@ -3,19 +3,11 @@ ./Tests - - - - ./Tests - - diff --git a/src/Sylius/Bundle/CurrencyBundle/composer.json b/src/Sylius/Bundle/CurrencyBundle/composer.json index 75d45c2202..6fef680a26 100644 --- a/src/Sylius/Bundle/CurrencyBundle/composer.json +++ b/src/Sylius/Bundle/CurrencyBundle/composer.json @@ -48,9 +48,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\CurrencyBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\CurrencyBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/CurrencyBundle/phpunit.xml.dist b/src/Sylius/Bundle/CurrencyBundle/phpunit.xml.dist index e31a21bbca..ee9a3ec354 100644 --- a/src/Sylius/Bundle/CurrencyBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/CurrencyBundle/phpunit.xml.dist @@ -2,14 +2,12 @@ - - + + ./test/ diff --git a/src/Sylius/Bundle/CurrencyBundle/test/app/autoload.php b/src/Sylius/Bundle/CurrencyBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/CurrencyBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/CustomerBundle/composer.json b/src/Sylius/Bundle/CustomerBundle/composer.json index 689a93611b..87bbf62347 100644 --- a/src/Sylius/Bundle/CustomerBundle/composer.json +++ b/src/Sylius/Bundle/CustomerBundle/composer.json @@ -56,9 +56,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\CustomerBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\CustomerBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/CustomerBundle/phpunit.xml.dist b/src/Sylius/Bundle/CustomerBundle/phpunit.xml.dist index 0beec81acd..b88be054af 100644 --- a/src/Sylius/Bundle/CustomerBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/CustomerBundle/phpunit.xml.dist @@ -2,14 +2,12 @@ - - + + ./test/ diff --git a/src/Sylius/Bundle/CustomerBundle/test/app/autoload.php b/src/Sylius/Bundle/CustomerBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/CustomerBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/FixturesBundle/composer.json b/src/Sylius/Bundle/FixturesBundle/composer.json index 2755e5d1e9..d9b26c436d 100644 --- a/src/Sylius/Bundle/FixturesBundle/composer.json +++ b/src/Sylius/Bundle/FixturesBundle/composer.json @@ -53,9 +53,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\FixturesBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\FixturesBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/FixturesBundle/humbug.json.dist b/src/Sylius/Bundle/FixturesBundle/humbug.json.dist deleted file mode 100644 index 353452a063..0000000000 --- a/src/Sylius/Bundle/FixturesBundle/humbug.json.dist +++ /dev/null @@ -1,17 +0,0 @@ -{ - "source": { - "directories": [ - "." - ], - "excludes": [ - "bin", - "spec", - "Tests", - "vendor" - ] - }, - "timeout": 2, - "logs": { - "text": "humbuglog.txt" - } -} diff --git a/src/Sylius/Bundle/FixturesBundle/phpunit.xml.dist b/src/Sylius/Bundle/FixturesBundle/phpunit.xml.dist index 5ad84c71a8..809783fc9a 100644 --- a/src/Sylius/Bundle/FixturesBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/FixturesBundle/phpunit.xml.dist @@ -1,30 +1,17 @@ - - - + - - ./Tests - - ./test/ + ./Tests/ - - - - ./Tests - - diff --git a/src/Sylius/Bundle/FixturesBundle/test/app/autoload.php b/src/Sylius/Bundle/FixturesBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/FixturesBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/GridBundle/composer.json b/src/Sylius/Bundle/GridBundle/composer.json index ea13042015..3809507fbf 100644 --- a/src/Sylius/Bundle/GridBundle/composer.json +++ b/src/Sylius/Bundle/GridBundle/composer.json @@ -59,9 +59,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\GridBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\GridBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/GridBundle/phpunit.xml.dist b/src/Sylius/Bundle/GridBundle/phpunit.xml.dist index e4e8acba8a..66c7f0b297 100644 --- a/src/Sylius/Bundle/GridBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/GridBundle/phpunit.xml.dist @@ -1,29 +1,17 @@ - - - + - - - ./test/ - - - ./Tests + + + ./test/ + ./Tests/ - - - - ./Tests - - diff --git a/src/Sylius/Bundle/GridBundle/test/app/autoload.php b/src/Sylius/Bundle/GridBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/GridBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/InventoryBundle/composer.json b/src/Sylius/Bundle/InventoryBundle/composer.json index 94a80964e0..fcc347200c 100644 --- a/src/Sylius/Bundle/InventoryBundle/composer.json +++ b/src/Sylius/Bundle/InventoryBundle/composer.json @@ -48,9 +48,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\InventoryBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\InventoryBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/InventoryBundle/phpunit.xml.dist b/src/Sylius/Bundle/InventoryBundle/phpunit.xml.dist index 53e3bda378..1d03cd8dbd 100644 --- a/src/Sylius/Bundle/InventoryBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/InventoryBundle/phpunit.xml.dist @@ -2,14 +2,12 @@ - - + + ./test/ diff --git a/src/Sylius/Bundle/InventoryBundle/test/app/autoload.php b/src/Sylius/Bundle/InventoryBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/InventoryBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/LocaleBundle/composer.json b/src/Sylius/Bundle/LocaleBundle/composer.json index ba7b22b19c..a065494aa6 100644 --- a/src/Sylius/Bundle/LocaleBundle/composer.json +++ b/src/Sylius/Bundle/LocaleBundle/composer.json @@ -48,9 +48,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\LocaleBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\LocaleBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/LocaleBundle/phpunit.xml.dist b/src/Sylius/Bundle/LocaleBundle/phpunit.xml.dist index d49e2f58a9..05423274e6 100644 --- a/src/Sylius/Bundle/LocaleBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/LocaleBundle/phpunit.xml.dist @@ -2,14 +2,12 @@ - - + + ./test/ diff --git a/src/Sylius/Bundle/LocaleBundle/test/app/autoload.php b/src/Sylius/Bundle/LocaleBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/LocaleBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/MailerBundle/composer.json b/src/Sylius/Bundle/MailerBundle/composer.json index 0cee42d7e8..711ab75a8d 100644 --- a/src/Sylius/Bundle/MailerBundle/composer.json +++ b/src/Sylius/Bundle/MailerBundle/composer.json @@ -43,9 +43,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\MailerBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\MailerBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/MailerBundle/phpunit.xml.dist b/src/Sylius/Bundle/MailerBundle/phpunit.xml.dist index bd8af90d51..e41de44205 100644 --- a/src/Sylius/Bundle/MailerBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/MailerBundle/phpunit.xml.dist @@ -2,14 +2,12 @@ - - + + ./test/ diff --git a/src/Sylius/Bundle/MailerBundle/test/src/Tests/SyliusMailerBundleTest.php b/src/Sylius/Bundle/MailerBundle/test/src/Tests/SyliusMailerBundleTest.php index 0dac63ceb8..94f629513b 100644 --- a/src/Sylius/Bundle/MailerBundle/test/src/Tests/SyliusMailerBundleTest.php +++ b/src/Sylius/Bundle/MailerBundle/test/src/Tests/SyliusMailerBundleTest.php @@ -13,7 +13,9 @@ declare(strict_types=1); namespace Sylius\Bundle\MailerBundle\Tests; +use PHPUnit\Framework\Assert; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; final class SyliusMailerBundleTest extends WebTestCase @@ -23,17 +25,17 @@ final class SyliusMailerBundleTest extends WebTestCase */ public function its_services_are_initializable(): void { - /** @var ContainerInterface $container */ + /** @var ContainerBuilder $container */ $container = self::createClient()->getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/MoneyBundle/composer.json b/src/Sylius/Bundle/MoneyBundle/composer.json index 97c104bf26..0a245f8361 100644 --- a/src/Sylius/Bundle/MoneyBundle/composer.json +++ b/src/Sylius/Bundle/MoneyBundle/composer.json @@ -50,9 +50,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\MoneyBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\MoneyBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/MoneyBundle/phpunit.xml.dist b/src/Sylius/Bundle/MoneyBundle/phpunit.xml.dist index 37664ba415..3db715fe7b 100644 --- a/src/Sylius/Bundle/MoneyBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/MoneyBundle/phpunit.xml.dist @@ -2,14 +2,12 @@ - - + + ./test/ diff --git a/src/Sylius/Bundle/MoneyBundle/test/app/autoload.php b/src/Sylius/Bundle/MoneyBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/MoneyBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { - return false !== strpos($serviceId, 'sylius'); + $services = array_filter($services, function (string $serviceId): bool { + return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/OrderBundle/Tests/DependencyInjection/Compiler/RegisterOrderProcessorPassTest.php b/src/Sylius/Bundle/OrderBundle/Tests/DependencyInjection/Compiler/RegisterOrderProcessorPassTest.php index 3ecdcbe477..1247aa8049 100644 --- a/src/Sylius/Bundle/OrderBundle/Tests/DependencyInjection/Compiler/RegisterOrderProcessorPassTest.php +++ b/src/Sylius/Bundle/OrderBundle/Tests/DependencyInjection/Compiler/RegisterOrderProcessorPassTest.php @@ -31,7 +31,7 @@ final class RegisterOrderProcessorPassTest extends AbstractCompilerPassTestCase public function it_adds_method_call_to_composite_order_processor_if_exist(): void { $compositeOrderProcessorDefinition = new Definition(CompositeOrderProcessor::class); - $this->setDefinition('sylius.order_processing.order_processor', $compositeOrderProcessorDefinition); + $this->setDefinition('sylius.order_processing.order_processor.composite', $compositeOrderProcessorDefinition); $orderAdjustmentClearerDefinition = new Definition(OrderAdjustmentsClearer::class); $orderAdjustmentClearerDefinition->addTag('sylius.order_processor'); @@ -55,7 +55,7 @@ final class RegisterOrderProcessorPassTest extends AbstractCompilerPassTestCase public function it_adds_method_call_to_composite_order_processor_with_custom_priority(): void { $compositeOrderProcessorDefinition = new Definition(CompositeOrderProcessor::class); - $this->setDefinition('sylius.order_processing.order_processor', $compositeOrderProcessorDefinition); + $this->setDefinition('sylius.order_processing.order_processor.composite', $compositeOrderProcessorDefinition); $orderAdjustmentClearerDefinition = new Definition(OrderAdjustmentsClearer::class); $orderAdjustmentClearerDefinition->addTag('sylius.order_processor', ['priority' => 10]); diff --git a/src/Sylius/Bundle/OrderBundle/composer.json b/src/Sylius/Bundle/OrderBundle/composer.json index 7764e6e8d5..2341673b33 100644 --- a/src/Sylius/Bundle/OrderBundle/composer.json +++ b/src/Sylius/Bundle/OrderBundle/composer.json @@ -31,13 +31,14 @@ }, "require-dev": { "doctrine/orm": "^2.5", + "matthiasnoback/symfony-dependency-injection-test": "^2.0", "phpspec/phpspec": "^4.0", "phpunit/phpunit": "^6.5", + "polishsymfonycommunity/symfony-mocker-container": "^1.0", "symfony/browser-kit": "^3.4|^4.0", "symfony/dependency-injection": "^3.4|^4.0", "symfony/form": "^3.4|^4.0", - "symfony/validator": "^3.4|^4.0", - "polishsymfonycommunity/symfony-mocker-container": "^1.0" + "symfony/validator": "^3.4|^4.0" }, "conflict": { "twig/twig": "^1.0" @@ -50,9 +51,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\OrderBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\OrderBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/OrderBundle/phpunit.xml.dist b/src/Sylius/Bundle/OrderBundle/phpunit.xml.dist index 73cc516eea..e85f9862b5 100644 --- a/src/Sylius/Bundle/OrderBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/OrderBundle/phpunit.xml.dist @@ -2,17 +2,16 @@ - - + + ./test/ + ./Tests/ diff --git a/src/Sylius/Bundle/OrderBundle/test/app/autoload.php b/src/Sylius/Bundle/OrderBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/OrderBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/PaymentBundle/composer.json b/src/Sylius/Bundle/PaymentBundle/composer.json index 9de13036a9..29958b9c26 100644 --- a/src/Sylius/Bundle/PaymentBundle/composer.json +++ b/src/Sylius/Bundle/PaymentBundle/composer.json @@ -43,9 +43,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\PaymentBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\PaymentBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/PaymentBundle/phpunit.xml.dist b/src/Sylius/Bundle/PaymentBundle/phpunit.xml.dist index db2cee1ff7..06bdb3e9dc 100644 --- a/src/Sylius/Bundle/PaymentBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/PaymentBundle/phpunit.xml.dist @@ -2,14 +2,12 @@ - - + + ./test/ diff --git a/src/Sylius/Bundle/PaymentBundle/test/app/autoload.php b/src/Sylius/Bundle/PaymentBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/PaymentBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/ProductBundle/composer.json b/src/Sylius/Bundle/ProductBundle/composer.json index b12d3e78de..4edab47de5 100644 --- a/src/Sylius/Bundle/ProductBundle/composer.json +++ b/src/Sylius/Bundle/ProductBundle/composer.json @@ -47,9 +47,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\ProductBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\ProductBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/ProductBundle/phpunit.xml.dist b/src/Sylius/Bundle/ProductBundle/phpunit.xml.dist index 62e1812181..72bc08b324 100644 --- a/src/Sylius/Bundle/ProductBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/ProductBundle/phpunit.xml.dist @@ -2,14 +2,12 @@ - - + + ./test/ diff --git a/src/Sylius/Bundle/ProductBundle/test/app/autoload.php b/src/Sylius/Bundle/ProductBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/ProductBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/PromotionBundle/composer.json b/src/Sylius/Bundle/PromotionBundle/composer.json index b2893d7c77..5e15479bc2 100644 --- a/src/Sylius/Bundle/PromotionBundle/composer.json +++ b/src/Sylius/Bundle/PromotionBundle/composer.json @@ -50,7 +50,8 @@ "psr-4": { "Sylius\\Bundle\\PromotionBundle\\spec\\": "spec/", "AppBundle\\": "test/src/AppBundle/" - } + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/PromotionBundle/phpunit.xml.dist b/src/Sylius/Bundle/PromotionBundle/phpunit.xml.dist index 3865b763a4..6d88d6faef 100644 --- a/src/Sylius/Bundle/PromotionBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/PromotionBundle/phpunit.xml.dist @@ -1,28 +1,17 @@ - - - + + - - ./Tests - ./test/ + ./Tests/ - - - - ./Tests - - diff --git a/src/Sylius/Bundle/PromotionBundle/test/app/autoload.php b/src/Sylius/Bundle/PromotionBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/PromotionBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/ResourceBundle/DependencyInjection/Compiler/PrioritizedCompositeServicePass.php b/src/Sylius/Bundle/ResourceBundle/DependencyInjection/Compiler/PrioritizedCompositeServicePass.php index 8ac2dafe4f..b03392b7d9 100644 --- a/src/Sylius/Bundle/ResourceBundle/DependencyInjection/Compiler/PrioritizedCompositeServicePass.php +++ b/src/Sylius/Bundle/ResourceBundle/DependencyInjection/Compiler/PrioritizedCompositeServicePass.php @@ -59,7 +59,7 @@ abstract class PrioritizedCompositeServicePass implements CompilerPassInterface */ public function process(ContainerBuilder $container): void { - if (!$container->hasDefinition($this->compositeId)) { + if (!$container->has($this->compositeId)) { return; } @@ -111,12 +111,6 @@ abstract class PrioritizedCompositeServicePass implements CompilerPassInterface */ private function addMethodCall(Definition $contextDefinition, string $id, array $attributes): void { - $arguments = [new Reference($id)]; - - if (isset($attributes['priority'])) { - $arguments[] = $attributes['priority']; - } - - $contextDefinition->addMethodCall($this->methodName, $arguments); + $contextDefinition->addMethodCall($this->methodName, [new Reference($id), $attributes['priority'] ?? 0]); } } diff --git a/src/Sylius/Bundle/ResourceBundle/composer.json b/src/Sylius/Bundle/ResourceBundle/composer.json index 3097513884..6126538ec6 100644 --- a/src/Sylius/Bundle/ResourceBundle/composer.json +++ b/src/Sylius/Bundle/ResourceBundle/composer.json @@ -70,7 +70,8 @@ "psr-4": { "Sylius\\Bundle\\ResourceBundle\\spec\\": "spec/", "AppBundle\\": "test/src/AppBundle/" - } + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/ResourceBundle/phpunit.xml.dist b/src/Sylius/Bundle/ResourceBundle/phpunit.xml.dist index 533f8c4c59..2e672ad695 100644 --- a/src/Sylius/Bundle/ResourceBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/ResourceBundle/phpunit.xml.dist @@ -2,14 +2,13 @@ - + + ./test/ diff --git a/src/Sylius/Bundle/ResourceBundle/test/app/autoload.php b/src/Sylius/Bundle/ResourceBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/ResourceBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/ReviewBundle/composer.json b/src/Sylius/Bundle/ReviewBundle/composer.json index a0c90e339f..095b31b2f5 100644 --- a/src/Sylius/Bundle/ReviewBundle/composer.json +++ b/src/Sylius/Bundle/ReviewBundle/composer.json @@ -60,9 +60,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\ReviewBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\ReviewBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/ReviewBundle/phpunit.xml.dist b/src/Sylius/Bundle/ReviewBundle/phpunit.xml.dist index 04fcea1a84..142315c3e7 100644 --- a/src/Sylius/Bundle/ReviewBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/ReviewBundle/phpunit.xml.dist @@ -1,19 +1,17 @@ - - - + + ./test/ + ./Tests/ diff --git a/src/Sylius/Bundle/ReviewBundle/test/app/autoload.php b/src/Sylius/Bundle/ReviewBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/ReviewBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/ShippingBundle/composer.json b/src/Sylius/Bundle/ShippingBundle/composer.json index fe03cc841a..b3d1715b0c 100644 --- a/src/Sylius/Bundle/ShippingBundle/composer.json +++ b/src/Sylius/Bundle/ShippingBundle/composer.json @@ -45,10 +45,7 @@ "psr-4": { "Sylius\\Bundle\\ShippingBundle\\": "" } }, "autoload-dev": { - "psr-4": { - "Sylius\\Bundle\\ShippingBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/ShippingBundle/phpunit.xml.dist b/src/Sylius/Bundle/ShippingBundle/phpunit.xml.dist index efa9305f53..bb1d52bef8 100644 --- a/src/Sylius/Bundle/ShippingBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/ShippingBundle/phpunit.xml.dist @@ -2,14 +2,12 @@ - - + + ./test/ diff --git a/src/Sylius/Bundle/ShippingBundle/test/app/autoload.php b/src/Sylius/Bundle/ShippingBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/ShippingBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/ShopBundle/composer.json b/src/Sylius/Bundle/ShopBundle/composer.json index 46dc75815e..92bf42754c 100644 --- a/src/Sylius/Bundle/ShopBundle/composer.json +++ b/src/Sylius/Bundle/ShopBundle/composer.json @@ -2,26 +2,32 @@ "name": "sylius/shop-bundle", "type": "symfony-bundle", "description": "Sylius eCommerce storefront.", - "keywords": ["shop", "ecommerce", "store", "webshop", "sylius"], + "keywords": [ + "shop", + "ecommerce", + "store", + "webshop", + "sylius" + ], "homepage": "http://sylius.com", "license": "MIT", "authors": [ { - "name": "Paweł Jędrzejewski", + "name": "Paweł Jędrzejewski", "homepage": "http://pjedrzejewski.com" }, { - "name": "Sylius project", + "name": "Sylius project", "homepage": "http://sylius.com" }, { - "name": "Community contributions", + "name": "Community contributions", "homepage": "http://github.com/Sylius/Sylius/contributors" } ], "require": { "php": "^7.1", - + "sonata-project/intl-bundle": "^2.2", "sylius/core-bundle": "^1.0", "sylius/ui-bundle": "^1.0", @@ -30,15 +36,17 @@ "require-dev": { "matthiasnoback/symfony-config-test": "^3.0", "matthiasnoback/symfony-dependency-injection-test": "^2.0", - "phpunit/phpunit": "^6.5", "phpspec/phpspec": "^4.0", + "phpunit/phpunit": "^6.5", "symfony/dependency-injection": "^3.4|^4.0" }, "config": { "bin-dir": "bin" }, "autoload": { - "psr-4": { "Sylius\\Bundle\\ShopBundle\\": "" } + "psr-4": { + "Sylius\\Bundle\\ShopBundle\\": "" + } }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/ShopBundle/phpunit.xml.dist b/src/Sylius/Bundle/ShopBundle/phpunit.xml.dist index a16b756eab..f8b2c84fc8 100644 --- a/src/Sylius/Bundle/ShopBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/ShopBundle/phpunit.xml.dist @@ -1,15 +1,16 @@ - + + + + - ./Tests + ./Tests/ diff --git a/src/Sylius/Bundle/TaxationBundle/composer.json b/src/Sylius/Bundle/TaxationBundle/composer.json index d1c18fb558..dfff1974b8 100644 --- a/src/Sylius/Bundle/TaxationBundle/composer.json +++ b/src/Sylius/Bundle/TaxationBundle/composer.json @@ -45,9 +45,9 @@ }, "autoload-dev": { "psr-4": { - "Sylius\\Bundle\\TaxationBundle\\spec\\": "spec/", - "AppBundle\\": "test/src/AppBundle/" - } + "Sylius\\Bundle\\TaxationBundle\\spec\\": "spec/" + }, + "classmap": ["test/app/AppKernel.php"] }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Sylius/Bundle/TaxationBundle/phpunit.xml.dist b/src/Sylius/Bundle/TaxationBundle/phpunit.xml.dist index d6e7d45434..57d79f0285 100644 --- a/src/Sylius/Bundle/TaxationBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/TaxationBundle/phpunit.xml.dist @@ -2,17 +2,16 @@ - - + + ./test/ + ./Tests/ diff --git a/src/Sylius/Bundle/TaxationBundle/test/app/autoload.php b/src/Sylius/Bundle/TaxationBundle/test/app/autoload.php deleted file mode 100644 index 3aa013d4ae..0000000000 --- a/src/Sylius/Bundle/TaxationBundle/test/app/autoload.php +++ /dev/null @@ -1,30 +0,0 @@ -getContainer(); $services = $container->getServiceIds(); - $services = array_filter($services, function ($serviceId) { + $services = array_filter($services, function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); foreach ($services as $id) { - $container->get($id); + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/TaxonomyBundle/Tests/Functional/SyliusTaxonomyBundleTest.php b/src/Sylius/Bundle/TaxonomyBundle/Tests/Functional/SyliusTaxonomyBundleTest.php index 83bc4516c2..d1e5f1baa2 100644 --- a/src/Sylius/Bundle/TaxonomyBundle/Tests/Functional/SyliusTaxonomyBundleTest.php +++ b/src/Sylius/Bundle/TaxonomyBundle/Tests/Functional/SyliusTaxonomyBundleTest.php @@ -16,6 +16,7 @@ namespace Sylius\Bundle\TaxonomyBundle\Tests\Functional; use PHPUnit\Framework\Assert; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerInterface; final class SyliusTaxonomyBundleTest extends KernelTestCase { @@ -29,12 +30,12 @@ final class SyliusTaxonomyBundleTest extends KernelTestCase /** @var Container $container */ $container = self::$kernel->getContainer(); - $serviceIds = array_filter($container->getServiceIds(), function ($serviceId) { + $serviceIds = array_filter($container->getServiceIds(), function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); - foreach ($serviceIds as $serviceId) { - Assert::assertNotNull($container->get($serviceId)); + foreach ($serviceIds as $id) { + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/TaxonomyBundle/phpunit.xml.dist b/src/Sylius/Bundle/TaxonomyBundle/phpunit.xml.dist index 842ea7b5f9..648009ad7f 100644 --- a/src/Sylius/Bundle/TaxonomyBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/TaxonomyBundle/phpunit.xml.dist @@ -2,14 +2,12 @@ - - + + ./Tests/ diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/Functional/SyliusThemeBundleTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/Functional/SyliusThemeBundleTest.php index 4ce8988c5c..383946eef9 100644 --- a/src/Sylius/Bundle/ThemeBundle/Tests/Functional/SyliusThemeBundleTest.php +++ b/src/Sylius/Bundle/ThemeBundle/Tests/Functional/SyliusThemeBundleTest.php @@ -16,6 +16,7 @@ namespace Sylius\Bundle\ThemeBundle\Tests\Functional; use PHPUnit\Framework\Assert; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerInterface; final class SyliusThemeBundleTest extends KernelTestCase { @@ -29,12 +30,12 @@ final class SyliusThemeBundleTest extends KernelTestCase /** @var Container $container */ $container = self::$kernel->getContainer(); - $serviceIds = array_filter($container->getServiceIds(), function ($serviceId) { + $serviceIds = array_filter($container->getServiceIds(), function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); - foreach ($serviceIds as $serviceId) { - Assert::assertNotNull($container->get($serviceId)); + foreach ($serviceIds as $id) { + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/ThemeBundle/phpunit.xml.dist b/src/Sylius/Bundle/ThemeBundle/phpunit.xml.dist index d167538f33..be8c4f257a 100644 --- a/src/Sylius/Bundle/ThemeBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/ThemeBundle/phpunit.xml.dist @@ -1,16 +1,13 @@ - - - + + ./Tests/ diff --git a/src/Sylius/Bundle/UserBundle/Tests/Functional/SyliusUserBundleTest.php b/src/Sylius/Bundle/UserBundle/Tests/Functional/SyliusUserBundleTest.php index f2de2de0f4..b0f6707566 100644 --- a/src/Sylius/Bundle/UserBundle/Tests/Functional/SyliusUserBundleTest.php +++ b/src/Sylius/Bundle/UserBundle/Tests/Functional/SyliusUserBundleTest.php @@ -16,6 +16,7 @@ namespace Sylius\Bundle\UserBundle\Tests\Functional; use PHPUnit\Framework\Assert; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerInterface; final class SyliusUserBundleTest extends KernelTestCase { @@ -29,12 +30,12 @@ final class SyliusUserBundleTest extends KernelTestCase /** @var Container $container */ $container = self::$kernel->getContainer(); - $serviceIds = array_filter($container->getServiceIds(), function ($serviceId) { + $serviceIds = array_filter($container->getServiceIds(), function (string $serviceId): bool { return 0 === strpos($serviceId, 'sylius.'); }); - foreach ($serviceIds as $serviceId) { - Assert::assertNotNull($container->get($serviceId)); + foreach ($serviceIds as $id) { + Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)); } } } diff --git a/src/Sylius/Bundle/UserBundle/phpunit.xml.dist b/src/Sylius/Bundle/UserBundle/phpunit.xml.dist index a501e1e8fa..ea4f8b74a6 100644 --- a/src/Sylius/Bundle/UserBundle/phpunit.xml.dist +++ b/src/Sylius/Bundle/UserBundle/phpunit.xml.dist @@ -2,14 +2,12 @@ - - + + ./Tests/ diff --git a/src/Sylius/Component/Core/composer.json b/src/Sylius/Component/Core/composer.json index 10c2a043d0..cd055bbaf0 100644 --- a/src/Sylius/Component/Core/composer.json +++ b/src/Sylius/Component/Core/composer.json @@ -22,7 +22,7 @@ "require": { "php": "^7.1", - "knplabs/gaufrette": "^0.2", + "knplabs/gaufrette": "^0.5", "payum/payum": "^1.3", "php-http/guzzle6-adapter": "^1.1", "sylius/addressing": "^1.0",