diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-05-27 14:18:07 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-07-23 21:19:21 +0200 |
commit | 465033230da0398426010aa7bd3694735b71c899 (patch) | |
tree | 0350b254a1ea360eb93cf1b0e0ca9cba025c2f30 /tests | |
parent | fdedbfd4a7fb547da0e0ce65c6180f74aad90691 (diff) | |
download | Shaarli-465033230da0398426010aa7bd3694735b71c899.tar.gz Shaarli-465033230da0398426010aa7bd3694735b71c899.tar.zst Shaarli-465033230da0398426010aa7bd3694735b71c899.zip |
Password change: UT use case with open shaarli
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 | } |