diff --git a/README.md b/README.md index ede4d6d..c8e6737 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,10 @@ Then you should initialize your database by running: # Test -To run the test suite just use: +For unit tests (using Atoum) use: ./console tests:unit + +For functional tests you'll need phpunit: + + phpunit diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..9660ec8 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,18 @@ + + + + + ./tests/functionals/ + + + diff --git a/tests/functionals/ApiTest.php b/tests/functionals/ApiTest.php new file mode 100644 index 0000000..8d17c73 --- /dev/null +++ b/tests/functionals/ApiTest.php @@ -0,0 +1,35 @@ +createClient(); + $crawler = $client->request('GET', '/api/entries'); + + $this->assertTrue($client->getResponse()->isOk()); + + + // Assert that the "Content-Type" header is "application/json" + $this->assertTrue( + $client->getResponse()->headers->contains( + 'Content-Type', + 'application/json' + ) + ); + + $this->assertTrue($client->getResponse()->getContent() == '[]'); + } +}