Skip to content

Commit d0006e9

Browse files
committed
test: add tests for Exception
1 parent 79e2cef commit d0006e9

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/Unit/EmailActivatorTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Unit;
6+
7+
use CodeIgniter\Shield\Authentication\Actions\EmailActivator;
8+
use CodeIgniter\Shield\Exceptions\RuntimeException;
9+
use Config\Services;
10+
use Tests\Support\TestCase;
11+
12+
/**
13+
* @internal
14+
*/
15+
final class EmailActivatorTest extends TestCase
16+
{
17+
public function testShowCannotGetPendingLoginUser(): void
18+
{
19+
$this->expectException(RuntimeException::class);
20+
$this->expectExceptionMessage('Cannot get the pending login User');
21+
22+
$activator = new EmailActivator();
23+
24+
$activator->show();
25+
}
26+
27+
public function testVerifyCannotGetPendingLoginUser(): void
28+
{
29+
$this->expectException(RuntimeException::class);
30+
$this->expectExceptionMessage('Cannot get the pending login User');
31+
32+
$activator = new EmailActivator();
33+
$request = Services::incomingrequest(null, false);
34+
35+
$activator->verify($request);
36+
}
37+
}

0 commit comments

Comments
 (0)