Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundle Setup within Codeception

I tried to setup codeception for my Symfony2 project which already has 4 working bundles and their PHPUnit testcases. Now I wanted to add codeception Testcases, especially for acceptance tests, but when I "bootstrapped" codeception I found all the generated code within my main structure. Since my application is already organized in bundles I wanted to keep the concept as well for my testcases. Especially since I already have my PHPUnit testcases within my bundles. The official s2 codeception does not really cover this. So for me some questions arise:

  1. How to setup codeception that it works within my bundles
  2. How can I ran with one command all my existing PHPUnit testcases AND my codeception testcases?
like image 880
m0c Avatar asked Oct 02 '22 17:10

m0c


2 Answers

I just set that up in a similar way.

codeception has a -c switch that will do what you need, i.e.:

vendor/bin/codecept bootstrap src/Acme/ExampleBundle

and then:

vendor/bin/codecept run -c src/Acme/ExampleBundle

I don't know about your 2nd question. At least for Unit tests, converting them to Codeception tests was trivial, especially since my tests all inhert from an abstract class, so it took maybe 10 lines of change there, mostly setup stuff.

like image 84
Tom Avatar answered Oct 22 '22 09:10

Tom


@Tom That doesen't work because the Symfony2-Module is looking for the bootstrap.php.cache-file which is still in the root-folder of your symfony2-app! My solution for this is to create a link in your bundle to your app/ folder! than it gonna work!

In {your-root}/src/{your-app}/{your-bundle}:

ln -s ../../../app .
like image 24
Dennis Ruske Avatar answered Oct 22 '22 09:10

Dennis Ruske