Prechádzať zdrojové kódy

Merge pull request #2816 from EmmanuelVella/fix-tests

Fix compiler pass tests
Thomas 10 rokov pred
rodič
commit
7d649910b5
1 zmenil súbory, kde vykonal 6 pridanie a 1 odobranie
  1. 6 1
      Tests/SonataAdminBundleTest.php

+ 6 - 1
Tests/SonataAdminBundleTest.php

@@ -17,6 +17,7 @@ use Symfony\Component\DependencyInjection\Compiler\PassConfig;
 use Sonata\AdminBundle\DependencyInjection\Compiler\AddDependencyCallsCompilerPass;
 use Sonata\AdminBundle\DependencyInjection\Compiler\AddFilterTypeCompilerPass;
 use Sonata\AdminBundle\DependencyInjection\Compiler\ExtensionCompilerPass;
+use Sonata\AdminBundle\DependencyInjection\Compiler\GlobalVariablesCompilerPass;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 
 /**
@@ -30,7 +31,7 @@ class SonataAdminBundleTest extends \PHPUnit_Framework_TestCase
     {
         $containerBuilder = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder', array('addCompilerPass'));
 
-        $containerBuilder->expects($this->exactly(3))
+        $containerBuilder->expects($this->exactly(4))
             ->method('addCompilerPass')
             ->will($this->returnCallback(function (CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION) {
                 if ($pass instanceof AddDependencyCallsCompilerPass) {
@@ -45,6 +46,10 @@ class SonataAdminBundleTest extends \PHPUnit_Framework_TestCase
                     return;
                 }
 
+                if ($pass instanceof GlobalVariablesCompilerPass) {
+                    return;
+                }
+
                 $this->fail(sprintf('Compiler pass is not one of the expected types. Expects "Sonata\AdminBundle\DependencyInjection\Compiler\AddDependencyCallsCompilerPass", "Sonata\AdminBundle\DependencyInjection\Compiler\AddFilterTypeCompilerPass" or "Sonata\AdminBundle\DependencyInjection\Compiler\ExtensionCompilerPass", but got "%s".', get_class($pass)));
             }));