| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace App\Tests\Application\Enum;
- use App\Tests\Application\OtWebTestCase;
- use Symfony\Component\HttpFoundation\Response;
- class EnumTest extends OtWebTestCase
- {
- public function testEnumResource()
- {
- $this->logger->info("\033[1;34mStarting test... get enum success\033[0m");
- $this->loginAs($this->user);
- $enumName = 'function';
- $this->get("/api/enum/$enumName");
- $this->assertResponseStatusCodeSame(Response::HTTP_OK);
- $this->assertResponseIsSuccessful();
- $this->logger->info("\033[1;32mTest 'get enum success' succeeded\033[0m");
- $this->logger->info("\033[1;34mStarting test... get enum not found\033[0m");
- $this->loginAs($this->user);
- $this->assertResponseIsSuccessful();
- $this->logger->info("\033[1;34mLogged in successfully\033[0m");
- $enumName = 'notfound';
- $this->get("/api/enum/$enumName");
- $this->assertResponseStatusCodeSame(Response::HTTP_NOT_FOUND);
- $this->logger->info("\033[1;32mTest 'get enum not found' succeeded\033[0m");
- $this->logger->info("\033[1;34mStarting test... get category enum\033[0m");
- $this->loginAs($this->user);
- $this->assertResponseIsSuccessful();
- $this->logger->info("\033[1;34mLogged in successfully\033[0m");
- $this->get('/api/enum/organization_category');
- $this->assertResponseStatusCodeSame(Response::HTTP_OK);
- $this->assertResponseIsSuccessful();
- $this->logger->info("\033[1;34mReceived status code 200\033[0m");
- $this->assertJsonContains([
- '@context' => '/api/contexts/Enum',
- '@id' => '/api/enum/organization_category',
- '@type' => 'Enum',
- 'name' => 'organization_category',
- 'items' => [
- 'PROFESSIONAL' => 'PROFESSIONAL',
- 'ARTISTIC_ENSEMBLE' => 'ARTISTIC_ENSEMBLE',
- 'SCHOOL_OF_ARTS' => 'SCHOOL_OF_ARTS',
- 'NETWORK' => 'NETWORK',
- 'ORGANIZER' => 'ORGANIZER',
- 'PERSON' => 'PERSON',
- 'OTHER' => 'OTHER',
- ],
- ]);
- $this->logger->info("\033[1;32mTest 'get category enum' succeeded\033[0m");
- }
- }
|