AccessProfileTest.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Tests\Application\Profile;
  3. use App\Tests\Application\OtWebTestCase;
  4. class AccessProfileTest extends OtWebTestCase
  5. {
  6. public function testAccessProfile(): void
  7. {
  8. $this->logger->info("\033[1;34mStarting test... Admin get his profile\033[0m");
  9. $this->loginAs($this->user);
  10. $this->get('/api/my_profile/'.$this->user->getId());
  11. $this->assertResponseIsSuccessful();
  12. $this->assertResponseStatusCodeSame(200);
  13. $this->logger->info("\033[1;32mTest 'admin acceed to his profile' succeeded\033[0m");
  14. $this->logger->info("\033[1;34mStarting test... Student get his profile\033[0m");
  15. $this->loginAsStudent($this->user);
  16. $this->get('/api/my_profile/'.$this->user->getId());
  17. $this->assertResponseStatusCodeSame(200);
  18. $this->assertResponseIsSuccessful();
  19. $this->logger->info("\033[1;32mTest 'student acceed to his profile' succeeded\033[0m");
  20. $this->logger->info("\033[1;34mStarting test... Student get admin's profile\033[0m");
  21. $this->loginAsStudent($this->user);
  22. $this->get('/api/my_profile/1');
  23. $this->assertResponseStatusCodeSame(200);
  24. $this->logger->info("\033[1;32mTest 'student acceed to his profile' succeeded\033[0m");
  25. $this->logger->info("\033[1;34mStarting test... Admin get student's profile\033[0m");
  26. $this->loginAsStudent($this->user);
  27. $this->get('/api/my_profile/2');
  28. $this->assertResponseStatusCodeSame(200);
  29. $this->logger->info("\033[1;32mTest 'student acceed to his profile' succeeded\033[0m");
  30. }
  31. }