From d2c012e2b22106bdccf100d8ff5b4187fb2352a1 Mon Sep 17 00:00:00 2001 From: egrigorev Date: Fri, 26 Apr 2024 16:48:44 +0300 Subject: [PATCH] add test and upgrade library version --- src/AmoCRM/Client/AmoCRMApiClient.php | 2 +- src/AmoCRM/Client/AmoCRMApiRequest.php | 2 +- tests/Cases/AmoCRM/Client/AmoCRMApiClientTest.php | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/AmoCRM/Client/AmoCRMApiClient.php b/src/AmoCRM/Client/AmoCRMApiClient.php index a678e39..b32483a 100644 --- a/src/AmoCRM/Client/AmoCRMApiClient.php +++ b/src/AmoCRM/Client/AmoCRMApiClient.php @@ -192,7 +192,7 @@ public function onAccessTokenRefresh(callable $callback): self * @param callable $callable * @return $this */ - public function onRefreshAccessTokenCallback(callable $callable): self + public function setRefreshAccessTokenCallback(callable $callable): self { $this->refreshAccessTokenCallback = $callable; diff --git a/src/AmoCRM/Client/AmoCRMApiRequest.php b/src/AmoCRM/Client/AmoCRMApiRequest.php index 6507a16..cf9a9be 100644 --- a/src/AmoCRM/Client/AmoCRMApiRequest.php +++ b/src/AmoCRM/Client/AmoCRMApiRequest.php @@ -36,7 +36,7 @@ class AmoCRMApiRequest public const CONNECT_TIMEOUT = 5; public const REQUEST_TIMEOUT = 20; //TODO Do not forget to change this on each release - public const LIBRARY_VERSION = '1.7.2'; + public const LIBRARY_VERSION = '1.7.3'; public const USER_AGENT = 'amoCRM-API-Library/' . self::LIBRARY_VERSION; public const SUCCESS_STATUSES = [ diff --git a/tests/Cases/AmoCRM/Client/AmoCRMApiClientTest.php b/tests/Cases/AmoCRM/Client/AmoCRMApiClientTest.php index e67ef73..1d9fe4a 100644 --- a/tests/Cases/AmoCRM/Client/AmoCRMApiClientTest.php +++ b/tests/Cases/AmoCRM/Client/AmoCRMApiClientTest.php @@ -144,6 +144,17 @@ public function testOnAccessTokenRefresh() $this->assertIsCallable($callback); } + public function testSetOnRefreshAccessTokenCallback() + { + $this->assertInstanceOf( + AmoCRMApiClient::class, + $this->apiClient->setRefreshAccessTokenCallback(function () { + }) + ); + $callback = $this->_getInnerPropertyValueByReflection('refreshAccessTokenCallback'); + $this->assertIsCallable($callback); + } + public function testSetAccountBaseDomain() { $this->assertInstanceOf(