Skip to content

Commit

Permalink
Skip modifying virtual proxies properties in TestAppKernel
Browse files Browse the repository at this point in the history
Uncaught Symfony\Component\Debug\Exception\ContextErrorException: Warning: Cannot bind closure to scope of internal class ReflectionProperty in /Users/pamil/Projects/Sylius/Sylius/var/cache/test/appTestProjectContainer.php:28784
Stack trace:
#0 [internal function]: SyliusBundleChannelBundleDoctrineORMChannelRepository_000000004a4ae55b000000001fee2e9bc41b18016a7f6458d1a51d748b49311b->__set('_entityName', NULL)
#1 /Users/pamil/Projects/Sylius/Sylius/app/TestAppKernel.php(72): ReflectionProperty->setValue(Object(SyliusBundleChannelBundleDoctrineORMChannelRepository_000000004a4ae55b000000001fee2e9bc41b18016a7f6458d1a51d748b49311b), NULL)
#2 /Users/pamil/Projects/Sylius/Sylius/app/TestAppKernel.php(41): TestAppKernel->cleanupContainer(Object(appTestProjectContainer))
#3 /Users/pamil/Projects/Sylius/Sylius/vendor/lakion/api-test-case/src/ApiTestCase.php(85): TestAppKernel->shutdown()
#4 /Users/pamil/Projects/Sylius/Sylius/vendor/phpunit/phpunit/src/Framework/TestSuite.php(727): Lakion\ApiTestCase\ApiTestCase::ensur in /Users/pamil/Projects/Sylius/Sylius/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php on line 99
  • Loading branch information
pamil committed Jul 31, 2017
1 parent 4ba5204 commit ce85ccf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/TestAppKernel.php
Expand Up @@ -13,6 +13,7 @@

require_once __DIR__.'/AppKernel.php';

use ProxyManager\Proxy\VirtualProxyInterface;
use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down Expand Up @@ -60,6 +61,10 @@ protected function cleanupContainer(ContainerInterface $container)

$serviceReflection = new \ReflectionObject($service);

if ($serviceReflection->implementsInterface(VirtualProxyInterface::class)) {
continue;
}

$servicePropertiesReflections = $serviceReflection->getProperties();
$servicePropertiesDefaultValues = $serviceReflection->getDefaultProperties();
foreach ($servicePropertiesReflections as $servicePropertyReflection) {
Expand Down

0 comments on commit ce85ccf

Please sign in to comment.