merged branch asm89/fix-component-testsuites (PR #4602)
Commits -------441c098
[HttpKernel] Remove unneeded test class (suggestion by @stof)e49b714
[Routing] Fix component 'standalone' testsuite0b0fe74
[HttpKernel] Fix component 'standalone' testsuite8ff2838
[Form] Fix component 'standalone' testsuite Discussion ---------- Fix component testsuites Bug fix: yes Feature addition: no Backwards compatibility break: no Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/asm89/symfony.png?branch=fix-component-testsuites)](http://travis-ci.org/asm89/symfony) License of the code: MIT The testsuites of some components would crash when running them seperately (from their own directory for example). This PR fixes that by skipping some additional tests if dependencies for the test aren't met. In the case of `HttpKernel` there was also a helper class in `KernelTest` that is now moved to it's own file. This was needed because the class implemented the `BundleInterface`, which depends on the `DependencyInjection` component. The autoloader would then crash the complete test suite. I sent this PR to the `master` branch since the tests have been moved and splitted some while ago, before it wasn't really possible to have this situation. If for maintainability reasons it should still be send to the 2.0 branch, let me know! --------------------------------------------------------------------------- by travisbot at 2012-06-18T08:25:58Z This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1645386) (merged f9b8ea82 into0b8b76bf
). --------------------------------------------------------------------------- by travisbot at 2012-06-18T08:46:33Z This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1645448) (merged441c0983
into0b8b76bf
).
This commit is contained in:
commit
dab9dea633
@ -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);
|
||||
|
@ -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');
|
||||
}
|
||||
|
@ -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\Bundle\BundleInterface')
|
||||
->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
|
||||
}
|
||||
|
@ -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())
|
||||
|
Reference in New Issue
Block a user