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