From 8ff2838bb89a8567d785a12079a35dbe55c898c8 Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 18 Jun 2012 10:08:52 +0200 Subject: [PATCH 1/4] [Form] Fix component 'standalone' testsuite --- src/Symfony/Component/Form/Tests/FormBuilderTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/src/Symfony/Component/Form/Tests/FormBuilderTest.php index 89ca355e08..3101541b79 100644 --- a/src/Symfony/Component/Form/Tests/FormBuilderTest.php +++ b/src/Symfony/Component/Form/Tests/FormBuilderTest.php @@ -23,6 +23,10 @@ class FormBuilderTest extends \PHPUnit_Framework_TestCase protected function setUp() { + if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) { + $this->markTestSkipped('The "EventDispatcher" component is not available'); + } + $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface'); $this->builder = new FormBuilder('name', null, $this->dispatcher, $this->factory); From 0b0fe74e9396312f5e87fd4d305d2f2aba5ec726 Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 18 Jun 2012 10:10:57 +0200 Subject: [PATCH 2/4] [HttpKernel] Fix component 'standalone' testsuite - Missing dependency in one file - Move helper class out of KernelTest because it implemented an interface that depends on another component (thus would crash the testsuite if invoked) --- .../HttpKernel/Tests/Bundle/BundleTest.php | 4 ++++ .../HttpKernel/Tests/Fixtures/TestBundle.php | 19 +++++++++++++++++++ .../Component/HttpKernel/Tests/KernelTest.php | 8 +------- 3 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 src/Symfony/Component/HttpKernel/Tests/Fixtures/TestBundle.php diff --git a/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php b/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php index 2b8cc79d36..eaff42a1bc 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php @@ -25,6 +25,10 @@ class BundleTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('The "Console" component is not available'); } + if (!class_exists('Symfony\Component\DependencyInjection\ContainerAwareInterface')) { + $this->markTestSkipped('The "DependencyInjection" component is not available'); + } + if (!class_exists('Symfony\Component\Finder\Finder')) { $this->markTestSkipped('The "Finder" component is not available'); } diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestBundle.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestBundle.php new file mode 100644 index 0000000000..53aa55f816 --- /dev/null +++ b/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestBundle.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\Fixtures; + +use Symfony\Component\HttpKernel\Bundle\BundleInterface; + +abstract class TestBundle implements BundleInterface +{ + // We can not extend Symfony\Component\HttpKernel\Bundle\Bundle as we want to mock getName() which is final +} diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index a26d9d7fc1..578240b9fb 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\Tests; use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; @@ -724,7 +723,7 @@ EOF; protected function getBundle($dir = null, $parent = null, $className = null, $bundleName = null) { $bundle = $this - ->getMockBuilder('Symfony\Component\HttpKernel\Tests\BundleForTest') + ->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\TestBundle') ->setMethods(array('getPath', 'getParent', 'getName')) ->disableOriginalConstructor() ; @@ -775,8 +774,3 @@ EOF; ; } } - -abstract class BundleForTest implements BundleInterface -{ - // We can not extend Symfony\Component\HttpKernel\Bundle\Bundle as we want to mock getName() which is final -} From e49b714c1e74e2eca9193331ad1efe37f63de0e0 Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 18 Jun 2012 10:12:36 +0200 Subject: [PATCH 3/4] [Routing] Fix component 'standalone' testsuite --- .../Component/Routing/Tests/Generator/UrlGeneratorTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php index f6a094e562..b9a116f454 100644 --- a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php +++ b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php @@ -175,6 +175,10 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase public function testGenerateForRouteWithInvalidOptionalParameterNonStrictWithLogger() { + if (!class_exists('Symfony\Component\HttpKernel\Log\LoggerInterface')) { + $this->markTestSkipped('The "HttpKernel" component is not available'); + } + $routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+'))); $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $logger->expects($this->once()) From 441c0983f6132f8abeab4bef53c66aec4dcb875d Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 18 Jun 2012 10:36:28 +0200 Subject: [PATCH 4/4] [HttpKernel] Remove unneeded test class (suggestion by @stof) --- .../HttpKernel/Tests/Fixtures/TestBundle.php | 19 ------------------- .../Component/HttpKernel/Tests/KernelTest.php | 2 +- 2 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 src/Symfony/Component/HttpKernel/Tests/Fixtures/TestBundle.php diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestBundle.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestBundle.php deleted file mode 100644 index 53aa55f816..0000000000 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestBundle.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures; - -use Symfony\Component\HttpKernel\Bundle\BundleInterface; - -abstract class TestBundle implements BundleInterface -{ - // We can not extend Symfony\Component\HttpKernel\Bundle\Bundle as we want to mock getName() which is final -} diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 578240b9fb..8fc46cc8f1 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -723,7 +723,7 @@ EOF; protected function getBundle($dir = null, $parent = null, $className = null, $bundleName = null) { $bundle = $this - ->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\TestBundle') + ->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface') ->setMethods(array('getPath', 'getParent', 'getName')) ->disableOriginalConstructor() ;