|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Tests\Unit; |
| 4 | + |
| 5 | +use Tests\Support\TestCase; |
| 6 | + |
| 7 | +/** |
| 8 | + * @internal |
| 9 | + */ |
| 10 | +final class AuthRoutesTest extends TestCase |
| 11 | +{ |
| 12 | + public function testRoutes() |
| 13 | + { |
| 14 | + $collection = single_service('routes'); |
| 15 | + $auth = service('auth'); |
| 16 | + |
| 17 | + $auth->routes($collection); |
| 18 | + |
| 19 | + $routes = $collection->getRoutes('get'); |
| 20 | + |
| 21 | + $this->assertArrayHasKey('register', $routes); |
| 22 | + $this->assertArrayHasKey('login', $routes); |
| 23 | + $this->assertArrayHasKey('login/magic-link', $routes); |
| 24 | + $this->assertArrayHasKey('logout', $routes); |
| 25 | + $this->assertArrayHasKey('auth/a/show', $routes); |
| 26 | + } |
| 27 | + |
| 28 | + public function testRoutesExcept() |
| 29 | + { |
| 30 | + $collection = single_service('routes'); |
| 31 | + $auth = service('auth'); |
| 32 | + |
| 33 | + $auth->routes($collection, ['except' => ['login']]); |
| 34 | + |
| 35 | + $routes = $collection->getRoutes('get'); |
| 36 | + |
| 37 | + $this->assertArrayNotHasKey('login', $routes); |
| 38 | + $this->assertArrayHasKey('register', $routes); |
| 39 | + $this->assertArrayHasKey('login/magic-link', $routes); |
| 40 | + $this->assertArrayHasKey('logout', $routes); |
| 41 | + $this->assertArrayHasKey('auth/a/show', $routes); |
| 42 | + } |
| 43 | +} |
0 commit comments