Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FrameworkBundle] Separating Client- and Kernel-Testhelper from PHPUnit #14736

Closed
SenseException opened this issue May 24, 2015 · 4 comments
Closed

Comments

@SenseException
Copy link
Contributor

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 of PHPUnit_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.

@SenseException
Copy link
Contributor Author

SenseException commented Dec 3, 2017

@fabpot This is a pretty old issue but still needs to be evaluated. Does The current Symfony versions cover what I described here?

@carsonbot
Copy link

Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?

@carsonbot
Copy link

Could I get a reply or should I close this?

@carsonbot
Copy link

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants