mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-08-17 18:51:19 +00:00
release 1.0.0
This commit is contained in:
+1
-1
@@ -47,7 +47,7 @@ use RuntimeException;
|
||||
*/
|
||||
class Api
|
||||
{
|
||||
public const string LIBRARY_VERSION = '0.9.0';
|
||||
public const string LIBRARY_VERSION = '1.0.0';
|
||||
|
||||
public const string API_VERSION = '0.0.6';
|
||||
|
||||
|
||||
@@ -171,7 +171,6 @@ class MaxBotServiceProvider extends ServiceProvider
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array<int, string>
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ return [
|
||||
|
|
||||
*/
|
||||
'base_url' => env('MAXBOT_BASE_URL', 'https://botapi.max.ru'),
|
||||
'api_version' => env('MAXBOT_API_VERSION', '0.0.6'),
|
||||
'api_version' => env('MAXBOT_API_VERSION'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -30,6 +30,7 @@ use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\Attributes\UsesClass;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
use ReflectionClass;
|
||||
|
||||
#[CoversClass(MaxBotServiceProvider::class)]
|
||||
#[UsesClass(Api::class)]
|
||||
@@ -104,7 +105,6 @@ final class MaxBotServiceProviderTest extends TestCase
|
||||
$this->app->make(ClientApiInterface::class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array<string, array{0: string, 1: class-string}>
|
||||
*/
|
||||
@@ -166,7 +166,7 @@ final class MaxBotServiceProviderTest extends TestCase
|
||||
$client = $this->app->make(ClientApiInterface::class);
|
||||
$this->assertInstanceOf(Client::class, $client);
|
||||
|
||||
$reflection = new \ReflectionClass($client);
|
||||
$reflection = new ReflectionClass($client);
|
||||
|
||||
$accessTokenProp = $reflection->getProperty('accessToken');
|
||||
$baseUrlProp = $reflection->getProperty('baseUrl');
|
||||
@@ -188,7 +188,7 @@ final class MaxBotServiceProviderTest extends TestCase
|
||||
/** @var Client $client */
|
||||
$client = $this->app->make(ClientApiInterface::class);
|
||||
|
||||
$reflection = new \ReflectionClass($client);
|
||||
$reflection = new ReflectionClass($client);
|
||||
$loggerProp = $reflection->getProperty('logger');
|
||||
$actualLogger = $loggerProp->getValue($client);
|
||||
|
||||
@@ -203,7 +203,7 @@ final class MaxBotServiceProviderTest extends TestCase
|
||||
/** @var Client $client */
|
||||
$client = $this->app->make(ClientApiInterface::class);
|
||||
|
||||
$reflection = new \ReflectionClass($client);
|
||||
$reflection = new ReflectionClass($client);
|
||||
$loggerProp = $reflection->getProperty('logger');
|
||||
$actualLogger = $loggerProp->getValue($client);
|
||||
|
||||
@@ -217,7 +217,7 @@ final class MaxBotServiceProviderTest extends TestCase
|
||||
$handler = $this->app->make(WebhookHandler::class);
|
||||
$this->assertInstanceOf(WebhookHandler::class, $handler);
|
||||
|
||||
$reflection = new \ReflectionClass($handler);
|
||||
$reflection = new ReflectionClass($handler);
|
||||
$secretProp = $reflection->getProperty('secret');
|
||||
|
||||
$this->assertSame('test-secret', $secretProp->getValue($handler));
|
||||
@@ -229,7 +229,7 @@ final class MaxBotServiceProviderTest extends TestCase
|
||||
/** @var Api $api */
|
||||
$api = $this->app->make(Api::class);
|
||||
|
||||
$reflection = new \ReflectionClass($api);
|
||||
$reflection = new ReflectionClass($api);
|
||||
|
||||
$clientProp = $reflection->getProperty('client');
|
||||
$factoryProp = $reflection->getProperty('modelFactory');
|
||||
@@ -263,4 +263,27 @@ final class MaxBotServiceProviderTest extends TestCase
|
||||
$this->assertArrayHasKey($signature, $commands);
|
||||
$this->assertInstanceOf($class, $commands[$signature]);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function providesMethod(): void
|
||||
{
|
||||
$provides = [
|
||||
Api::class,
|
||||
ClientApiInterface::class,
|
||||
ModelFactory::class,
|
||||
UpdateDispatcher::class,
|
||||
WebhookHandler::class,
|
||||
LongPollingHandler::class,
|
||||
MaxBotManager::class,
|
||||
'maxbot',
|
||||
'maxbot.api',
|
||||
'maxbot.client',
|
||||
'maxbot.dispatcher',
|
||||
'maxbot.webhook',
|
||||
'maxbot.polling',
|
||||
'maxbot.manager',
|
||||
];
|
||||
|
||||
$this->assertSame($this->app->getProvider(MaxBotServiceProvider::class)->provides(), $provides);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user