dmaicher / doctrine-test-bundle

Symfony bundle to isolate your app's doctrine database tests and improve the test performance
MIT License
1.08k stars 60 forks source link

Added Behat integration #128

Closed wouterj closed 3 years ago

wouterj commented 4 years ago

This PR adds the necessary classes to integrate with Behat, similar to the existing PHPunit integration. I hope this is something you want to add, it would be of great help for our test suite :)

If you want this, do you want me to add a Behat test set-up to functionally test the integration?

wouterj commented 3 years ago

Having this covered by a functional test would be nice. Will this require a lot of code?

I'll have a look, I think it'll have the same or less code as the PHPunit functional test.

Thanks for your review, I'll try to find some time this week to work on this PR.

wouterj commented 3 years ago

Updated the PR, I've added functional behat tests (similar to those existing in PHPunit). I couldn't understand what PhpunitTest::testRollBackChangesWithReOpenedConnection was testing, so I haven't copied this one to the Behat tests. I also didn't move the testPreviousChangesAreRolledBack tests to Behat, it's a bit non-behat-ish to do so. As all scenarios start with Given there are 0 rows, we already test it enough imho.

Please note that I also moved files around, so the diff is a big ugly. The directory structure now is:


tests/
  DAMA/
    ...
  Functional/
    app/                         # symfony application files
      AppKernel.php
      config.yml
      parameters.yml
      parmeters.yml.dist
    features/                    # behat features
      bootstrap/
        FeatureContext.php
      behat_integration.feature
    FunctionalTestTrait.php      # shared functional test methods
    PhpunitTest.php              # phpunit tests
  behat.yml
  bootstrap.php
  phpunit.xml
  phpunit7.xml
dmaicher commented 3 years ago

@mnapoli @dkarlovi what do you think about this? Any chance you could review the behat part? Since you commented here I guess you are using this bundle with behat? :blush:

dmaicher commented 3 years ago

@wouterj I added some changes on master (php8 support for example). Could you solve the conflicts please? I would like to merge this as well for release 6.4.0

wouterj commented 3 years ago

Thank you for your time reviewing & merging this PR @dmaicher!