| @@ 89-108 (lines=20) @@ | ||
| 86 | static::assertSame($eventResponse, $response); |
|
| 87 | } |
|
| 88 | ||
| 89 | public function testExecuteWithNoAuth(): void |
|
| 90 | { |
|
| 91 | $this->sessionManager->isAuthenticated() |
|
| 92 | ->willReturn(true) |
|
| 93 | ; |
|
| 94 | ||
| 95 | $this->router->generate('core23_lastfm_success', [], UrlGeneratorInterface::ABSOLUTE_PATH) |
|
| 96 | ->willReturn('/success') |
|
| 97 | ->shouldBeCalled() |
|
| 98 | ; |
|
| 99 | ||
| 100 | $action = new AuthErrorAction( |
|
| 101 | $this->twig->reveal(), |
|
| 102 | $this->router->reveal(), |
|
| 103 | $this->sessionManager->reveal(), |
|
| 104 | $this->eventDispatcher |
|
| 105 | ); |
|
| 106 | ||
| 107 | static::assertInstanceOf(RedirectResponse::class, $action()); |
|
| 108 | } |
|
| 109 | } |
|
| 110 | ||
| @@ 102-121 (lines=20) @@ | ||
| 99 | static::assertSame($eventResponse, $response); |
|
| 100 | } |
|
| 101 | ||
| 102 | public function testExecuteNoAuth(): void |
|
| 103 | { |
|
| 104 | $this->sessionManager->isAuthenticated() |
|
| 105 | ->willReturn(false) |
|
| 106 | ; |
|
| 107 | ||
| 108 | $this->router->generate('core23_lastfm_error', [], UrlGeneratorInterface::ABSOLUTE_PATH) |
|
| 109 | ->willReturn('/success') |
|
| 110 | ->shouldBeCalled() |
|
| 111 | ; |
|
| 112 | ||
| 113 | $action = new AuthSuccessAction( |
|
| 114 | $this->twig->reveal(), |
|
| 115 | $this->router->reveal(), |
|
| 116 | $this->sessionManager->reveal(), |
|
| 117 | $this->eventDispatcher |
|
| 118 | ); |
|
| 119 | ||
| 120 | static::assertInstanceOf(RedirectResponse::class, $action()); |
|
| 121 | } |
|
| 122 | ||
| 123 | public function testExecuteNoSession(): void |
|
| 124 | { |
|
| @@ 123-145 (lines=23) @@ | ||
| 120 | static::assertInstanceOf(RedirectResponse::class, $action()); |
|
| 121 | } |
|
| 122 | ||
| 123 | public function testExecuteNoSession(): void |
|
| 124 | { |
|
| 125 | $this->sessionManager->isAuthenticated() |
|
| 126 | ->willReturn(true) |
|
| 127 | ; |
|
| 128 | $this->sessionManager->getSession() |
|
| 129 | ->willReturn(null) |
|
| 130 | ; |
|
| 131 | ||
| 132 | $this->router->generate('core23_lastfm_error', [], UrlGeneratorInterface::ABSOLUTE_PATH) |
|
| 133 | ->willReturn('/success') |
|
| 134 | ->shouldBeCalled() |
|
| 135 | ; |
|
| 136 | ||
| 137 | $action = new AuthSuccessAction( |
|
| 138 | $this->twig->reveal(), |
|
| 139 | $this->router->reveal(), |
|
| 140 | $this->sessionManager->reveal(), |
|
| 141 | $this->eventDispatcher |
|
| 142 | ); |
|
| 143 | ||
| 144 | static::assertInstanceOf(RedirectResponse::class, $action()); |
|
| 145 | } |
|
| 146 | } |
|
| 147 | ||