napsTest.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. namespace v1;
  3. class napsTest extends BaseTests
  4. {
  5. public function testErrorIdNotInteger()
  6. {
  7. $client = $this->createClient();
  8. $client->followRedirects(true);
  9. $crawler = $client->request('GET', '/api/v1/naps', ['filters[id]' => 'a']);
  10. if ($this->debugTest) {
  11. var_dump($crawler->filter('body')->text());
  12. }
  13. $this->assertEquals(500, $client->getResponse()->getStatusCode());
  14. }
  15. public function testErrorParentNotInteger()
  16. {
  17. $client = $this->createClient();
  18. $client->followRedirects(true);
  19. $crawler = $client->request('GET', '/api/v1/naps', ['filters[parent]' => 'a']);
  20. if ($this->debugTest) {
  21. var_dump($crawler->filter('body')->text());
  22. }
  23. $this->assertEquals(500, $client->getResponse()->getStatusCode());
  24. }
  25. public function testErrorOltNotInteger()
  26. {
  27. $client = $this->createClient();
  28. $client->followRedirects(true);
  29. $crawler = $client->request('GET', '/api/v1/naps', ['filters[olt]' => 'a']);
  30. if ($this->debugTest) {
  31. var_dump($crawler->filter('body')->text());
  32. }
  33. $this->assertEquals(500, $client->getResponse()->getStatusCode());
  34. }
  35. public function testErrorTenancyIdNotInteger()
  36. {
  37. $client = $this->createClient();
  38. $client->followRedirects(true);
  39. $crawler = $client->request('GET', '/api/v1/naps', ['filters[tenancyId]' => 'a']);
  40. if ($this->debugTest) {
  41. var_dump($crawler->filter('body')->text());
  42. }
  43. $this->assertEquals(500, $client->getResponse()->getStatusCode());
  44. }
  45. public function testErrorCriteriaNotInteger()
  46. {
  47. $client = $this->createClient();
  48. $client->followRedirects(true);
  49. $crawler = $client->request('GET', '/api/v1/naps', ['filters[qb-criteria]' => 'a']);
  50. if ($this->debugTest) {
  51. var_dump($crawler->filter('body')->text());
  52. }
  53. $this->assertEquals(500, $client->getResponse()->getStatusCode());
  54. }
  55. public function testOkId()
  56. {
  57. $client = $this->createClient();
  58. $client->followRedirects(true);
  59. $crawler = $client->request('GET', '/api/v1/naps', ['filters[id]' => 1]);
  60. if ($this->debugTest) {
  61. var_dump($crawler->filter('body')->text());
  62. }
  63. $this->assertEquals(200, $client->getResponse()->getStatusCode());
  64. }
  65. public function testOkParent()
  66. {
  67. $client = $this->createClient();
  68. $client->followRedirects(true);
  69. $crawler = $client->request('GET', '/api/v1/naps', ['filters[parent]' => 1]);
  70. if ($this->debugTest) {
  71. var_dump($crawler->filter('body')->text());
  72. }
  73. $this->assertEquals(200, $client->getResponse()->getStatusCode());
  74. }
  75. public function testOkOlt()
  76. {
  77. $client = $this->createClient();
  78. $client->followRedirects(true);
  79. $crawler = $client->request('GET', '/api/v1/naps', ['filters[olt]' => 1]);
  80. if ($this->debugTest) {
  81. var_dump($crawler->filter('body')->text());
  82. }
  83. $this->assertEquals(200, $client->getResponse()->getStatusCode());
  84. }
  85. public function testOkTenancyId()
  86. {
  87. $client = $this->createClient();
  88. $client->followRedirects(true);
  89. $crawler = $client->request('GET', '/api/v1/naps', ['filters[tenancyId]' => 1]);
  90. if ($this->debugTest) {
  91. var_dump($crawler->filter('body')->text());
  92. }
  93. $this->assertEquals(200, $client->getResponse()->getStatusCode());
  94. }
  95. }