fix tests issues
Tests / PHPUnit (push) Failing after 43s

This commit is contained in:
root
2026-07-12 20:36:40 -04:00
parent 62492a5644
commit f83ebe66b9
17 changed files with 219 additions and 107 deletions
@@ -42,11 +42,18 @@ namespace Tests\App\Controllers\View {
$response = $this->controller->index();
$this->assertIsString($response);
if (is_array($response)) {
$this->assertSame('user/register', $response['view']);
} else {
$this->assertIsString($response);
}
$captcha = session()->get('captcha_answer');
$this->assertNotEmpty($captcha);
$this->assertGreaterThanOrEqual(4, strlen($captcha));
$this->assertLessThanOrEqual(8, strlen($captcha));
if (is_array($response)) {
$this->assertSame($captcha, $response['data']['captchaQuestion']);
}
}
public function testIndexReusesExistingCaptcha()
@@ -55,8 +62,15 @@ namespace Tests\App\Controllers\View {
$response = $this->controller->index();
$this->assertIsString($response);
if (is_array($response)) {
$this->assertSame('user/register', $response['view']);
} else {
$this->assertIsString($response);
}
$this->assertSame('EXISTING', session()->get('captcha_answer'));
if (is_array($response)) {
$this->assertSame('EXISTING', $response['data']['captchaQuestion']);
}
}
public function testSuccessRedirectsWhenEmailMissing()
@@ -75,7 +89,12 @@ namespace Tests\App\Controllers\View {
$response = $this->controller->success();
$this->assertIsString($response);
if (is_array($response)) {
$this->assertSame('success', $response['view']);
$this->assertSame('parent@example.com', $response['data']['email']);
} else {
$this->assertIsString($response);
}
$this->assertSame('parent@example.com', session()->get('user_email'));
}
}