diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/front/controller/admin/PasswordControllerTest.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/front/controller/admin/PasswordControllerTest.php b/tests/front/controller/admin/PasswordControllerTest.php index 7262243e..9a01089e 100644 --- a/tests/front/controller/admin/PasswordControllerTest.php +++ b/tests/front/controller/admin/PasswordControllerTest.php | |||
@@ -6,6 +6,7 @@ namespace Shaarli\Front\Controller\Admin; | |||
6 | 6 | ||
7 | use PHPUnit\Framework\TestCase; | 7 | use PHPUnit\Framework\TestCase; |
8 | use Shaarli\Config\ConfigManager; | 8 | use Shaarli\Config\ConfigManager; |
9 | use Shaarli\Front\Exception\OpenShaarliPasswordException; | ||
9 | use Shaarli\Front\Exception\WrongTokenException; | 10 | use Shaarli\Front\Exception\WrongTokenException; |
10 | use Shaarli\Security\SessionManager; | 11 | use Shaarli\Security\SessionManager; |
11 | use Slim\Http\Request; | 12 | use Slim\Http\Request; |
@@ -183,4 +184,20 @@ class PasswordControllerTest extends TestCase | |||
183 | static::assertSame('changepassword', (string) $result->getBody()); | 184 | static::assertSame('changepassword', (string) $result->getBody()); |
184 | static::assertSame('Change password - Shaarli', $this->assignedVariables['pagetitle']); | 185 | static::assertSame('Change password - Shaarli', $this->assignedVariables['pagetitle']); |
185 | } | 186 | } |
187 | |||
188 | /** | ||
189 | * Change the password on an open shaarli | ||
190 | */ | ||
191 | public function testPostNewPasswordOnOpenShaarli(): void | ||
192 | { | ||
193 | $this->container->conf = $this->createMock(ConfigManager::class); | ||
194 | $this->container->conf->method('get')->with('security.open_shaarli')->willReturn(true); | ||
195 | |||
196 | $request = $this->createMock(Request::class); | ||
197 | $response = new Response(); | ||
198 | |||
199 | $this->expectException(OpenShaarliPasswordException::class); | ||
200 | |||
201 | $this->controller->change($request, $response); | ||
202 | } | ||
186 | } | 203 | } |