| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace App\Tests\Application\Profile;
- use App\Tests\Application\OtWebTestCase;
- class AccessProfileTest extends OtWebTestCase
- {
- public function testAccessProfile(): void
- {
- $this->logger->info("\033[1;34mStarting test... Admin get his profile\033[0m");
- $this->loginAs($this->user);
- $this->get('/api/my_profile/'.$this->user->getId());
- $this->assertResponseIsSuccessful();
- $this->assertResponseStatusCodeSame(200);
- $this->logger->info("\033[1;32mTest 'admin acceed to his profile' succeeded\033[0m");
- $this->logger->info("\033[1;34mStarting test... Student get his profile\033[0m");
- $this->loginAsStudent($this->user);
- $this->get('/api/my_profile/'.$this->user->getId());
- $this->assertResponseStatusCodeSame(200);
- $this->assertResponseIsSuccessful();
- $this->logger->info("\033[1;32mTest 'student acceed to his profile' succeeded\033[0m");
- $this->logger->info("\033[1;34mStarting test... Student get admin's profile\033[0m");
- $this->loginAsStudent($this->user);
- $this->get('/api/my_profile/1');
- $this->assertResponseStatusCodeSame(200);
- $this->logger->info("\033[1;32mTest 'student acceed to his profile' succeeded\033[0m");
- $this->logger->info("\033[1;34mStarting test... Admin get student's profile\033[0m");
- $this->loginAsStudent($this->user);
- $this->get('/api/my_profile/2');
- $this->assertResponseStatusCodeSame(200);
- $this->logger->info("\033[1;32mTest 'student acceed to his profile' succeeded\033[0m");
- }
- }
|