partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

UNIT-TESTS.md (839B)


      1 # Functional / Unit Testing
      2 
      3 
      4 ## Prerequisites
      5 
      6 In order to run functional / unit tests, you first need to define the following environment variable to specify
      7 which test database you are using:
      8 
      9 `export SYMFONY__TESTDB=<databasetype>`
     10 
     11 The following databases are pre-configured in `config_test.yml`:
     12 
     13 - `mysql`
     14 - `pgsql`
     15 - `sqlite`
     16 
     17 Note that the database connections are configured for travis testing; you might need to change the database name,
     18 user and password properties.
     19 
     20 ## Running the tests
     21  
     22 The unit tests are ran by `phpunit -c app/`. This also generates a coverage report in the directory
     23 `reports/coverage`.
     24 
     25 If you need to run individual tests, you can do so by using the following command:
     26 
     27 `phpunit -c app/ <yourtestcase>`
     28 
     29 Full example:
     30 
     31 `phpunit -c app/ src/PartKeepr/AuthBundle/Tests/Controller/DefaultControllerTest`