'8', 'chars' => '1', 'special_chars' => '0', 'lowerupper' => '1', 'numbers' => '1']; public function testGetPasswordPolicy(): void { foreach (['get/passwordpolicy', 'get/passwordpolicy/all'] as $route) { $result = $this->get($route, ['script' => [self::answer('password_complexity', ['get'], self::POLICY)]]); $this->assertSame([['get']], $result->callsTo('password_complexity'), $route); $this->assertSame(self::POLICY, $result->json(), $route); } } public function testGetPasswordPolicyAsHtml(): void { $html = '
- Minimum password length is 8
'; $result = $this->get('get/passwordpolicy/html', ['script' => [self::answer('password_complexity', ['html'], $html)]]); $this->assertSame([['html']], $result->callsTo('password_complexity')); $this->assertSame($html, $result->json()); } public function testGetPasswordPolicyFailure(): void { $this->assertSame('{}', $this->get('get/passwordpolicy', ['script' => [self::answer('password_complexity', ['get'], false)]])->body); $this->assertSame('{}', $this->get('get/passwordpolicy/html', ['script' => [self::answer('password_complexity', ['html'], false)]])->body); } public function testEditPasswordPolicyIgnoresItems(): void { $result = $this->post('edit/passwordpolicy', ['items' => ['x'], 'attr' => ['length' => 12, 'numbers' => 1]]); $this->assertSame([['edit', ['length' => 12, 'numbers' => 1]]], $result->callsTo('password_complexity')); } public function testEditPasswordResetNotification(): void { $attr = ['from' => 'noreply@example.org', 'subject' => 'Reset your password', 'text_tmpl' => '{{link}}', 'html_tmpl' => '']; $result = $this->post('edit/reset-password-notification', ['attr' => $attr]); $this->assertSame([['edit_notification', $attr]], $result->callsTo('reset_password')); } /** @return array