Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
13 / 13 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| FakeLogin | |
100.00% |
13 / 13 |
|
100.00% |
1 / 1 |
4 | |
100.00% |
1 / 1 |
| verifyAuthentication | |
100.00% |
13 / 13 |
|
100.00% |
1 / 1 |
4 | |||
| 1 | <?php |
| 2 | namespace Apie\Fixtures\Actions; |
| 3 | |
| 4 | use Apie\Core\Attributes\Requires; |
| 5 | use Apie\Core\Attributes\RuntimeCheck; |
| 6 | use Apie\Core\ValueObjects\DatabaseText; |
| 7 | use Apie\Fixtures\Entities\UserWithAddress; |
| 8 | use Apie\Fixtures\Identifiers\UserWithAddressIdentifier; |
| 9 | use Apie\Fixtures\ValueObjects\AddressWithZipcodeCheck; |
| 10 | |
| 11 | class FakeLogin |
| 12 | { |
| 13 | #[RuntimeCheck(new Requires('ftp'))] |
| 14 | public static function verifyAuthentication(string $username, string $password): UserWithAddress|null |
| 15 | { |
| 16 | if ($username === 'user' && $password === 'pass') { |
| 17 | return new UserWithAddress( |
| 18 | new AddressWithZipcodeCheck( |
| 19 | new DatabaseText('Evergreen Terrace'), |
| 20 | new DatabaseText('742'), |
| 21 | new DatabaseText('11111'), |
| 22 | new DatabaseText('Springfield'), |
| 23 | ), |
| 24 | new UserWithAddressIdentifier('00000000-0000-0000-0000-000000000000') |
| 25 | ); |
| 26 | } |
| 27 | |
| 28 | if ($username === 'error') { |
| 29 | throw new \RuntimeException('Simulated error during login'); |
| 30 | } |
| 31 | |
| 32 | return null; |
| 33 | } |
| 34 | } |