aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/front/controller
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-05-27 14:18:07 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commit465033230da0398426010aa7bd3694735b71c899 (patch)
tree0350b254a1ea360eb93cf1b0e0ca9cba025c2f30 /tests/front/controller
parentfdedbfd4a7fb547da0e0ce65c6180f74aad90691 (diff)
downloadShaarli-465033230da0398426010aa7bd3694735b71c899.tar.gz
Shaarli-465033230da0398426010aa7bd3694735b71c899.tar.zst
Shaarli-465033230da0398426010aa7bd3694735b71c899.zip
Password change: UT use case with open shaarli
Diffstat (limited to 'tests/front/controller')
-rw-r--r--tests/front/controller/admin/PasswordControllerTest.php17
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
7use PHPUnit\Framework\TestCase; 7use PHPUnit\Framework\TestCase;
8use Shaarli\Config\ConfigManager; 8use Shaarli\Config\ConfigManager;
9use Shaarli\Front\Exception\OpenShaarliPasswordException;
9use Shaarli\Front\Exception\WrongTokenException; 10use Shaarli\Front\Exception\WrongTokenException;
10use Shaarli\Security\SessionManager; 11use Shaarli\Security\SessionManager;
11use Slim\Http\Request; 12use 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}