napTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace v1;
  3. include_once('./BaseTests.php');
  4. class napTest extends BaseTests
  5. {
  6. public function testErrorIdNotInteger()
  7. {
  8. $client = $this->createClient();
  9. $client->followRedirects(true);
  10. $crawler = $client->request('GET', '/api/v1/nap', ['id' => 'a']);
  11. if ($this->debugTest) {
  12. var_dump($crawler->filter('body')->text());
  13. }
  14. $this->assertEquals(500, $client->getResponse()->getStatusCode());
  15. }
  16. public function testErrorIdNotFound()
  17. {
  18. $client = $this->createClient();
  19. $client->followRedirects(true);
  20. $crawler = $client->request('GET', '/api/v1/nap', []);
  21. if ($this->debugTest) {
  22. var_dump($crawler->filter('body')->text());
  23. }
  24. $this->assertEquals(500, $client->getResponse()->getStatusCode());
  25. }
  26. public function testOk()
  27. {
  28. $client = $this->createClient();
  29. $client->followRedirects(true);
  30. $crawler = $client->request('GET', '/api/v1/nap', ['id' => '1']);
  31. if ($this->debugTest) {
  32. var_dump($crawler->filter('body')->text());
  33. }
  34. $this->assertEquals(200, $client->getResponse()->getStatusCode());
  35. }
  36. }