Description
I'd like to create a PR and introduce some changes to the FrameworkBundle for classes in the Test
namespace.
Right now, the testcase-classes are coupled to PHPUnit, which has some disadvantages:
- They extend
PHPUnit_Framework_TestCase
so for other Testing Frameworks the user is forced to reimplement these helper functionality - Even when PHPUnit is used, in case of an extension like dbunit there is the problem, that these tests have to extend
PHPUnit_Extensions_Database_TestCase
instead ofPHPUnit_Framework_TestCase
In these cases, the functionality of KernelTestCase
and WebTestCase
has to be reimplemented by the developer.
Separating functionality
I want to introduce the separation of the functionality of KernelTestCase
, WebTestCase
and the PHPUnit-Config functionality into separated classes, which can be used in Symfony tests. Also my goal is not to introduce BC breaks if possible by that, so I want to keep KernelTestCase
and WebTestCase
, but these two classes will just use the separated classes and its methods and get a deprecation docBlock comment.
/**
* Clean up Kernel usage in this test.
*/
protected function tearDown()
{
static::ensureKernelShutdown();
}
}
TearDown functionality will be moved into a PHPUnit Listener, that can be added into PHPUnit configuration. This means that the Symfony project skeleton (symfony/symfony-standard) need changes too.
Goal - Composition over inheritance
I want to let the developer use any testing framework while being able to use Symfony supported helper functions, that right now only can be used by extending PHPUnit coupled classes (KernelTestCase
, WebTestCase
). Also the usage of PHPUnit extentions, like dbunit, should be able to use these functionalities too. Therefore, these new classes doesn't extend/implement any third party classes or interfaces (PHPUnit_Framework_TestCase
).
Questions
But I have some questions about my PR plan:
- Is the separation and usage for other testing frameworks a wanted feature by Symfony or is my PR plan a not needed feature?
- Which Symfony version should get my planed PR? 2.7, 2.8 or maybe 3?
- Or is there already a Symfony project/repository that need help doing that?
I would like to hear your thoughts about that.