|
11 | 11 | use League\OAuth2\Client\Provider\Instagram; |
12 | 12 | use League\OAuth2\Client\Provider\LinkedIn; |
13 | 13 | use League\OAuth2\Client\Provider\ResourceOwnerInterface; |
| 14 | +use PHPUnit\Framework\Attributes\Before; |
14 | 15 | use PHPUnit\Framework\Attributes\Test; |
15 | 16 | use PHPUnit\Framework\TestCase; |
16 | 17 | use Tempest\Auth\OAuth\Config\AppleOAuthConfig; |
|
23 | 24 | use Tempest\Auth\OAuth\Config\LinkedInOAuthConfig; |
24 | 25 | use Tempest\Auth\OAuth\OAuthClientInitializer; |
25 | 26 | use Tempest\Auth\OAuth\OAuthUser; |
| 27 | +use Tempest\Container\Container; |
26 | 28 | use Tempest\Container\GenericContainer; |
| 29 | +use Tempest\Mapper\Context; |
27 | 30 | use Tempest\Mapper\MapperConfig; |
28 | 31 | use Tempest\Mapper\Mappers\ArrayToObjectMapper; |
29 | 32 | use Tempest\Mapper\ObjectFactory; |
30 | 33 |
|
31 | 34 | final class OAuthTest extends TestCase |
32 | 35 | { |
33 | 36 | private GenericContainer $container { |
34 | | - get => $this->container ??= new GenericContainer()->addInitializer(OAuthClientInitializer::class); |
| 37 | + get => $this->container ??= new GenericContainer(); |
35 | 38 | } |
36 | 39 |
|
37 | 40 | private ObjectFactory $factory { |
38 | | - get => $this->factory ??= new ObjectFactory(new MapperConfig([ArrayToObjectMapper::class]), $this->container); |
| 41 | + get => $this->factory ??= new ObjectFactory(new MapperConfig([Context::DEFAULT => [ArrayToObjectMapper::class]]), $this->container); |
| 42 | + } |
| 43 | + |
| 44 | + #[Before] |
| 45 | + public function before(): void |
| 46 | + { |
| 47 | + $this->container->singleton(Container::class, $this->container); |
| 48 | + $this->container->addInitializer(OAuthClientInitializer::class); |
39 | 49 | } |
40 | 50 |
|
41 | 51 | #[Test] |
|
0 commit comments