diff --git a/CHANGELOG.md b/CHANGELOG.md index 538644ae..caceb389 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ ### Fixed - Fixed error in arguments in service for method `placement.bind`, [see details](https://github.com/bitrix24/b24phpsdk/issues/151) - +- Fixed errors in `task.elapseditem.*` call in ApiClient [see details](https://github.com/bitrix24/b24phpsdk/issues/180) ### Changed - ❗**️️BC** Changed contract `Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity\Bitrix24AccountInterface`, this change needs to process corner cases diff --git a/src/Core/ApiClient.php b/src/Core/ApiClient.php index 398af6e6..f6a7873e 100644 --- a/src/Core/ApiClient.php +++ b/src/Core/ApiClient.php @@ -210,7 +210,15 @@ public function getResponse(string $apiMethod, array $parameters = []): Response 'task.commentitem.update', 'task.commentitem.getlist', 'task.commentitem.delete', - 'task.commentitem.isactionallowed' + 'task.commentitem.isactionallowed', + 'task.elapseditem.add', + 'task.elapseditem.update', + 'task.elapseditem.get', + 'task.elapseditem.getlist', + 'task.elapseditem.delete', + 'task.elapseditem.isactionallowed', + 'task.elapseditem.getmanifest', + 'tasks.task.add', ]; if (!in_array($apiMethod, $strictApiMethods, true)) { $url .= '?' . $this->requestIdGenerator->getQueryStringParameterName() . '=' . $requestId; diff --git a/tests/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterfaceTest.php b/tests/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterfaceTest.php index b83b280d..162913aa 100644 --- a/tests/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterfaceTest.php +++ b/tests/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterfaceTest.php @@ -484,7 +484,7 @@ final public function testApplicationUninstalled( * @throws InvalidArgumentException */ #[Test] - #[DataProvider('bitrix24AccountWithStatusNewDataProvider')] + #[DataProvider('bitrix24AccountWithWalidTokenDataProvider')] #[TestDox('test isApplicationTokenValid method')] final public function testIsApplicationTokenValid( Uuid $uuid, @@ -531,6 +531,9 @@ final public function testGetUpdatedAt( int $applicationVersion, Scope $applicationScope, string $applicationToken, + int $newApplicationVersion, + Scope $newApplicationScope, + ?Throwable $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -681,6 +684,22 @@ final public function testMarkAsActive( $this->assertEquals($comment, $bitrix24Account->getComment()); } + public static function bitrix24AccountWithWalidTokenDataProvider(): Generator + { + yield 'valid-update' => [ + Uuid::v7(), + 12345, + true, + true, + 'member123', + 'https://example.com', + new AuthToken('access_token', 'refresh_token', 1609459200), + 1, + new Scope(['crm', 'task']), + 'application_token' + ]; + } + /** * @throws UnknownScopeCodeException */ @@ -889,4 +908,4 @@ public static function bitrix24AccountDataProvider(): Generator new Scope(['crm', 'task']) ]; } -} \ No newline at end of file +} diff --git a/tests/Application/Contracts/Bitrix24Accounts/Repository/Bitrix24AccountRepositoryInterfaceTest.php b/tests/Application/Contracts/Bitrix24Accounts/Repository/Bitrix24AccountRepositoryInterfaceTest.php index b7805768..75628a6a 100644 --- a/tests/Application/Contracts/Bitrix24Accounts/Repository/Bitrix24AccountRepositoryInterfaceTest.php +++ b/tests/Application/Contracts/Bitrix24Accounts/Repository/Bitrix24AccountRepositoryInterfaceTest.php @@ -65,7 +65,9 @@ final public function testSave( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -113,7 +115,9 @@ final public function testDeleteHappyPath( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -164,7 +168,9 @@ final public function testDeleteNotInDeletedState( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -228,7 +234,9 @@ final public function testFindOneAdminByMemberIdWithHappyPath( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -266,7 +274,9 @@ final public function testFindOneAdminByMemberIdWithSimpleUser( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -304,7 +314,9 @@ final public function testFindByMemberIdWithHappyPath( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -365,7 +377,9 @@ final public function testFindByMemberIdWithBlockedAccountHappyPath( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -409,7 +423,9 @@ final public function testFindByMemberIdWithAccountStatusAccountNotFound( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -451,7 +467,9 @@ final public function testFindByMemberIdWithIsAdminHappyPath( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -492,7 +510,9 @@ final public function testFindByMemberIdWithIsAdminNotFound( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -529,12 +549,13 @@ final public function testFindByMemberIdWithB24UserIdNotFound( int $bitrix24UserId, bool $isBitrix24UserAdmin, bool $isMasterAccount, - string $memberId, string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -571,12 +592,13 @@ final public function testFindByMemberIdWithAllArgs( int $bitrix24UserId, bool $isBitrix24UserAdmin, bool $isMasterAccount, - string $memberId, string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -622,7 +644,9 @@ final public function testFindByDomainWithHappyPath( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -683,7 +707,9 @@ final public function testFindByDomainWithBlockedAccountHappyPath( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -727,7 +753,9 @@ final public function testFindByDomainWithAccountStatusAccountNotFound( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -769,7 +797,9 @@ final public function testFindByDomainWithIsAdminHappyPath( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -810,7 +840,9 @@ final public function testFindByDomainWithIsAdminNotFound( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -851,7 +883,9 @@ final public function testFindByDomainWithAllArgs( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -889,7 +923,9 @@ final public function testFindByApplicationToken( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -940,7 +976,9 @@ final public function testFindByApplicationTokenWithUnknownToken( string $domainUrl, AuthToken $authToken, int $applicationVersion, - Scope $applicationScope + Scope $applicationScope, + string $applicationToken, + ?object $throwable ): void { $bitrix24Account = $this->createBitrix24AccountImplementation( $uuid, @@ -985,4 +1023,4 @@ public static function bitrix24AccountForInstallDataProvider(): Generator null ]; } -} \ No newline at end of file +} diff --git a/tests/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterfaceTest.php b/tests/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterfaceTest.php index 140f9eb9..e9ba46ac 100644 --- a/tests/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterfaceTest.php +++ b/tests/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterfaceTest.php @@ -62,7 +62,8 @@ final public function testGetId( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -83,7 +84,8 @@ final public function testGetCreatedAt( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -107,7 +109,8 @@ final public function testGetUpdatedAt( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -129,7 +132,8 @@ final public function testSetExternalId( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -156,7 +160,8 @@ final public function testSetExternalIdWithNull( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -178,7 +183,8 @@ final public function testSetExternalIdWithEmptyString( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -200,7 +206,8 @@ final public function testGetStatus( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -224,7 +231,8 @@ final public function testMarkAsActive( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -256,7 +264,8 @@ final public function testMarkAsBlocked( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -284,7 +293,8 @@ final public function testMarkAsDeleted( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -312,7 +322,8 @@ final public function testGetTitle( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -333,7 +344,8 @@ final public function testSetTitle( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -361,7 +373,8 @@ final public function testGetSite( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -385,7 +398,8 @@ final public function testSetSite( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -415,7 +429,8 @@ final public function testGetPhone( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -436,7 +451,8 @@ final public function testSetPhone( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -462,7 +478,8 @@ final public function testGetEmail( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -483,7 +500,8 @@ final public function testSetEmail( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -514,7 +532,8 @@ final public function testSetEmailWithInvalidEmail( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -538,7 +557,8 @@ final public function testGetBitrix24PartnerId( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -559,7 +579,8 @@ final public function testSetBitrix24PartnerId( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -589,7 +610,8 @@ final public function testGetOpenLineId( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -610,7 +632,8 @@ final public function testSetOpenLineId( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $bitrix24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -647,4 +670,4 @@ public static function bitrix24PartnerDataProvider(): Generator 'comment', // comment, optional ]; } -} \ No newline at end of file +} diff --git a/tests/Application/Contracts/Bitrix24Partners/Repository/Bitrix24PartnerRepositoryInterfaceTest.php b/tests/Application/Contracts/Bitrix24Partners/Repository/Bitrix24PartnerRepositoryInterfaceTest.php index 58f3b93e..d7bc259d 100644 --- a/tests/Application/Contracts/Bitrix24Partners/Repository/Bitrix24PartnerRepositoryInterfaceTest.php +++ b/tests/Application/Contracts/Bitrix24Partners/Repository/Bitrix24PartnerRepositoryInterfaceTest.php @@ -66,7 +66,8 @@ final public function testSave( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $b24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -96,7 +97,8 @@ final public function testSaveWithTwoBitrix24PartnerId( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $b24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -130,7 +132,8 @@ final public function testDelete( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $b24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -162,7 +165,8 @@ final public function testGetById( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $b24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -194,7 +198,8 @@ final public function testFindByBitrix24PartnerId( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $b24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -223,7 +228,8 @@ final public function testFindByTitle( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $b24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -251,7 +257,8 @@ final public function testFindByExternalId( ?PhoneNumber $phoneNumber, ?string $email, ?string $openLineId, - ?string $externalId + ?string $externalId, + string $comment ): void { $b24Partner = $this->createBitrix24PartnerImplementation($uuid, $createdAt, $updatedAt, $bitrix24PartnerStatus, $title, $bitrix24PartnerId, $site, $phoneNumber, $email, $openLineId, $externalId); @@ -286,4 +293,4 @@ public static function bitrix24PartnerDataProvider(): Generator 'comment', // comment, optional ]; } -} \ No newline at end of file +} diff --git a/tests/Integration/Core/ApiClientDefaultImplementationTest.php b/tests/Integration/Core/ApiClientDefaultImplementationTest.php new file mode 100644 index 00000000..79a8a0a4 --- /dev/null +++ b/tests/Integration/Core/ApiClientDefaultImplementationTest.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Tests\Integration\Core; + +use Bitrix24\SDK\Core\Contracts\ApiClientInterface; +use Bitrix24\SDK\Tests\Integration\Fabric; +use PHPUnit\Framework\TestCase; +class ApiClientDefaultImplementationTest extends TestCase +{ + protected ApiClientInterface $apiClient; + + public function testFixProblemMethodsInApiClient(): void + { + // prepare data + $taskId = (int)$this->apiClient->getResponse('tasks.task.add', [ + 'fields' => [ + 'TITLE' => sprintf('test task %s', time()), + 'RESPONSIBLE_ID' => (int)$this->apiClient->getResponse('user.current')->toArray(false)['result']['ID'] + ] + ])->toArray(false)['result']['task']['id']; + $this->apiClient->getResponse('task.elapseditem.add', [ + 'TASKID' => $taskId, + 'ARFIELDS' => [ + 'SECONDS' => 60 + ] + ])->toArray(false); + + // call a problem method + // without fix in apiclient or api v2 we have an + // Symfony\Component\HttpClient\Exception\ClientException: HTTP/2 400 exception + $result = $this->apiClient->getResponse('task.elapseditem.getlist', [ + 'TASKID' => $taskId, + ])->toArray(); + $this->assertIsArray($result); + } + + public function setUp(): void + { + $this->apiClient = Fabric::getCore()->getApiClient(); + } +} \ No newline at end of file