3030use PHPUnit \Framework \Attributes \UsesClass ;
3131use Psr \Log \LoggerInterface ;
3232use Psr \Log \NullLogger ;
33+ use ReflectionClass ;
3334
3435#[CoversClass(MaxBotServiceProvider::class)]
3536#[UsesClass(Api::class)]
@@ -104,7 +105,6 @@ public function itThrowsExceptionWhenGuzzleIsMissing(): void
104105 $ this ->app ->make (ClientApiInterface::class);
105106 }
106107
107-
108108 /**
109109 * @return array<string, array{0: string, 1: class-string}>
110110 */
@@ -166,7 +166,7 @@ public function clientIsConfiguredCorrectlyFromConfig(): void
166166 $ client = $ this ->app ->make (ClientApiInterface::class);
167167 $ this ->assertInstanceOf (Client::class, $ client );
168168
169- $ reflection = new \ ReflectionClass ($ client );
169+ $ reflection = new ReflectionClass ($ client );
170170
171171 $ accessTokenProp = $ reflection ->getProperty ('accessToken ' );
172172 $ baseUrlProp = $ reflection ->getProperty ('baseUrl ' );
@@ -188,7 +188,7 @@ public function clientIsConfiguredWithApplicationLoggerWhenLoggingIsEnabled(): v
188188 /** @var Client $client */
189189 $ client = $ this ->app ->make (ClientApiInterface::class);
190190
191- $ reflection = new \ ReflectionClass ($ client );
191+ $ reflection = new ReflectionClass ($ client );
192192 $ loggerProp = $ reflection ->getProperty ('logger ' );
193193 $ actualLogger = $ loggerProp ->getValue ($ client );
194194
@@ -203,7 +203,7 @@ public function clientIsConfiguredWithNullLoggerWhenLoggingIsDisabled(): void
203203 /** @var Client $client */
204204 $ client = $ this ->app ->make (ClientApiInterface::class);
205205
206- $ reflection = new \ ReflectionClass ($ client );
206+ $ reflection = new ReflectionClass ($ client );
207207 $ loggerProp = $ reflection ->getProperty ('logger ' );
208208 $ actualLogger = $ loggerProp ->getValue ($ client );
209209
@@ -217,7 +217,7 @@ public function webhookHandlerIsConfiguredWithSecretFromConfig(): void
217217 $ handler = $ this ->app ->make (WebhookHandler::class);
218218 $ this ->assertInstanceOf (WebhookHandler::class, $ handler );
219219
220- $ reflection = new \ ReflectionClass ($ handler );
220+ $ reflection = new ReflectionClass ($ handler );
221221 $ secretProp = $ reflection ->getProperty ('secret ' );
222222
223223 $ this ->assertSame ('test-secret ' , $ secretProp ->getValue ($ handler ));
@@ -229,7 +229,7 @@ public function apiIsCreatedWithAllDependenciesFromContainer(): void
229229 /** @var Api $api */
230230 $ api = $ this ->app ->make (Api::class);
231231
232- $ reflection = new \ ReflectionClass ($ api );
232+ $ reflection = new ReflectionClass ($ api );
233233
234234 $ clientProp = $ reflection ->getProperty ('client ' );
235235 $ factoryProp = $ reflection ->getProperty ('modelFactory ' );
@@ -263,4 +263,27 @@ public function bootMethodRegistersCommandsInConsole(string $class, string $sign
263263 $ this ->assertArrayHasKey ($ signature , $ commands );
264264 $ this ->assertInstanceOf ($ class , $ commands [$ signature ]);
265265 }
266+
267+ #[Test]
268+ public function providesMethod (): void
269+ {
270+ $ provides = [
271+ Api::class,
272+ ClientApiInterface::class,
273+ ModelFactory::class,
274+ UpdateDispatcher::class,
275+ WebhookHandler::class,
276+ LongPollingHandler::class,
277+ MaxBotManager::class,
278+ 'maxbot ' ,
279+ 'maxbot.api ' ,
280+ 'maxbot.client ' ,
281+ 'maxbot.dispatcher ' ,
282+ 'maxbot.webhook ' ,
283+ 'maxbot.polling ' ,
284+ 'maxbot.manager ' ,
285+ ];
286+
287+ $ this ->assertSame ($ this ->app ->getProvider (MaxBotServiceProvider::class)->provides (), $ provides );
288+ }
266289}
0 commit comments