_3xseq
Last Updated: February 25, 2016
·
1.393K
· mattdharmon

To initiate php unit tests with LiipFunctionalTestBundle on the command line.

After going through the usual install and write a few tests, it took me a bit to figure out how to run the phpunit command without running into some type of fixture errors. This is when I figured out that you should upload the schema for a sqlite db to run properly.

  • Fist install the LiipFunctionalTestBundle:
    Link

  • Write some tests using said bundle.

  • Run the doctrine command to generate the schema in the test database:

$ app/console doctrine:schema:create --env=test
  • Once the schema is done being generated, run the tests.
$ phpunit -c app/

Note: the tests that load the data fixtures in the setUp() override method will load those fixtures into the test database automatically.