EnumTest.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App\Tests\Application\Enum;
  3. use App\Tests\Application\OtWebTestCase;
  4. use Symfony\Component\HttpFoundation\Response;
  5. class EnumTest extends OtWebTestCase
  6. {
  7. public function testGetEnumSuccess()
  8. {
  9. $this->loginAs($this->user);
  10. $this->assertResponseIsSuccessful();
  11. $enumName = 'function';
  12. $this->get("/api/enum/$enumName");
  13. $this->assertResponseStatusCodeSame(Response::HTTP_OK);
  14. $this->assertResponseIsSuccessful();
  15. }
  16. public function testGetEnumNotFound()
  17. {
  18. $this->loginAs($this->user);
  19. $this->assertResponseIsSuccessful();
  20. $enumName = 'notfound';
  21. $this->get("/api/enum/$enumName");
  22. $this->assertResponseStatusCodeSame(Response::HTTP_NOT_FOUND);
  23. }
  24. public function testGetCategoryEnum()
  25. {
  26. $this->loginAs($this->user);
  27. $this->assertResponseIsSuccessful();
  28. $this->get('/api/enum/organization_category');
  29. $this->assertResponseStatusCodeSame(Response::HTTP_OK);
  30. $this->assertResponseIsSuccessful();
  31. $this->assertJsonContains([
  32. '@context' => '/api/contexts/Enum',
  33. '@id' => '/api/enum/organization_category',
  34. '@type' => 'Enum',
  35. 'name' => 'organization_category',
  36. 'items' => [
  37. "PROFESSIONAL" => "PROFESSIONAL",
  38. "ARTISTIC_ENSEMBLE" => "ARTISTIC_ENSEMBLE",
  39. "SCHOOL_OF_ARTS" => "SCHOOL_OF_ARTS",
  40. "NETWORK" => "NETWORK",
  41. "ORGANIZER" => "ORGANIZER",
  42. "PERSON" => "PERSON",
  43. "OTHER" => "OTHER"
  44. ]
  45. ]);
  46. }
  47. }