X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Ffront%2Fcontroller%2Fadmin%2FPasswordControllerTest.php;h=58f47b4929ad5748fc77be66e2dfc82ad2728201;hb=543b16b4f4bbde4e9857490e2175e44b4d941eb3;hp=7262243eaf3d34b49196e4f42eecd60d756b44a7;hpb=ef00f9d2033f6de11e71bf3a909399cae6f73a9f;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/front/controller/admin/PasswordControllerTest.php b/tests/front/controller/admin/PasswordControllerTest.php index 7262243e..58f47b49 100644 --- a/tests/front/controller/admin/PasswordControllerTest.php +++ b/tests/front/controller/admin/PasswordControllerTest.php @@ -4,10 +4,11 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; +use Shaarli\Front\Exception\OpenShaarliPasswordException; use Shaarli\Front\Exception\WrongTokenException; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; @@ -183,4 +184,20 @@ class PasswordControllerTest extends TestCase static::assertSame('changepassword', (string) $result->getBody()); static::assertSame('Change password - Shaarli', $this->assignedVariables['pagetitle']); } + + /** + * Change the password on an open shaarli + */ + public function testPostNewPasswordOnOpenShaarli(): void + { + $this->container->conf = $this->createMock(ConfigManager::class); + $this->container->conf->method('get')->with('security.open_shaarli')->willReturn(true); + + $request = $this->createMock(Request::class); + $response = new Response(); + + $this->expectException(OpenShaarliPasswordException::class); + + $this->controller->change($request, $response); + } }