Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
VerifySeniorAuthenticationService
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 sync
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Domain\User\Services;
4
5use App\Events\ServiceProcessed;
6use App\Models\User;
7use Domain\Login\Integrations\AuthenticateSenior;
8use Domain\Shared\Integrations\Senior\Exceptions\IntegrationSoapSeniorException;
9use Domain\Shared\Integrations\Senior\SeniorCredentialResolver;
10use Illuminate\Auth\AuthenticationException;
11use SoapFault;
12
13readonly class VerifySeniorAuthenticationService
14{
15    /**
16     * @param User $user
17     * @throws AuthenticationException
18     * @throws IntegrationSoapSeniorException
19     * @throws SoapFault
20     */
21    public static function sync(User $user): void
22    {
23        ['user' => $userSenior, 'password' => $passwordSenior] = (new SeniorCredentialResolver())
24            ->resolveForUser($user);
25
26        ServiceProcessed::dispatch(self::class, $user);
27        AuthenticateSenior::login($userSenior, $passwordSenior);
28    }
29}