Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

46 lines
1.2KB

  1. <?php
  2. namespace Tests\Unit\Repositories;
  3. use App\Codes\UserRole;
  4. use App\Repositories\LoginUserRepository;
  5. use Tests\TestCase;
  6. /**
  7. * @group Repository
  8. */
  9. class LoginUserRepositoryTest extends TestCase
  10. {
  11. public function test_get_all(): void
  12. {
  13. $repository = new LoginUserRepository();
  14. $repository->get([]);
  15. $this->assertTrue(true);
  16. }
  17. public function test_email_condition(): void
  18. {
  19. $repository = new LoginUserRepository();
  20. $data = $repository->get([
  21. LoginUserRepository::CONDITION_EMAIL => "aa.com"
  22. ]);
  23. $this->assertCount(1, $data);
  24. $data = $repository->get([
  25. LoginUserRepository::CONDITION_EMAIL => "satellite"
  26. ]);
  27. $this->assertCount(0, $data);
  28. }
  29. public function test_role_condition(): void
  30. {
  31. $repository = new LoginUserRepository();
  32. $data = $repository->get([
  33. LoginUserRepository::CONDITION_ROLE => UserRole::ADMIN
  34. ]);
  35. $this->assertCount(1, $data);
  36. $data = $repository->get([
  37. LoginUserRepository::CONDITION_ROLE => UserRole::SHOP
  38. ]);
  39. $this->assertCount(0, $data);
  40. }
  41. }