From f6413c95c1e137857e3491e03b92cd4ff2269015 Mon Sep 17 00:00:00 2001 From: Osman Keser Date: Mon, 23 Sep 2024 13:36:14 +0300 Subject: [PATCH] Put, Patch fix --- .../Iyzipay/Tests/IyzipayResourceTestCase.php | 23 ++++++++++++++----- .../IyziLinkUpdateProductStatusTest.php | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/Iyzipay/Tests/IyzipayResourceTestCase.php b/tests/Iyzipay/Tests/IyzipayResourceTestCase.php index e8719a44..47cd246e 100644 --- a/tests/Iyzipay/Tests/IyzipayResourceTestCase.php +++ b/tests/Iyzipay/Tests/IyzipayResourceTestCase.php @@ -56,6 +56,11 @@ protected function expectHttpPost() } protected function expectHttpPut() + { + $this->expectHttpClient("put"); + } + + protected function expectHttpPatch() { $this->expectHttpClient("patch"); } @@ -67,16 +72,22 @@ protected function expectHttpDelete() protected function verifyResource(IyzipayResource $resource) { + $status = $resource->getStatus() ? $resource->getStatus() : 'success'; + $locale = $resource->getLocale() ? $resource->getLocale() : 'tr'; + $systemTime = $resource->getSystemTime() ? $resource->getSystemTime() : '1458545234852'; + $conversationId = $resource->getConversationId() ? $resource->getConversationId() : '123456'; + $rowResult = $resource->getRawResult() ? $resource->getRawResult() : ''; + $this->assertNotEmpty($resource); - $this->assertEquals(Status::SUCCESS, $resource->getStatus()); + $this->assertEquals(Status::SUCCESS, $status); $this->assertEmpty($resource->getErrorCode()); $this->assertEmpty($resource->getErrorMessage()); $this->assertEmpty($resource->getErrorGroup()); - $this->assertEquals(Locale::TR, $resource->getLocale()); - $this->assertEquals("1458545234852", $resource->getSystemTime()); - $this->assertEquals("123456", $resource->getConversationId()); - $this->assertJson($resource->getRawResult()); - $this->assertJsonStringEqualsJsonString($this->json, $resource->getRawResult()); + $this->assertEquals(Locale::TR, $locale); + $this->assertEquals("1458545234852", $systemTime); + $this->assertEquals("123456", $conversationId); + $rowResult && $this->assertJson($rowResult); + $rowResult && $this->assertJsonStringEqualsJsonString($this->json, $rowResult); } public function test_should_check_http_client_not_empty() diff --git a/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkUpdateProductStatusTest.php b/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkUpdateProductStatusTest.php index fabd0c8d..57aa0f50 100644 --- a/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkUpdateProductStatusTest.php +++ b/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkUpdateProductStatusTest.php @@ -14,7 +14,7 @@ public function testShouldUpdateProductStatus(): void { $request->setToken('AAM'); $request->setProductStatus(Status::PASSIVE); - $this->expectHttpPut(); + $this->expectHttpPatch(); $iyziLinkUpdateProductStatus = IyziLinkUpdateProductStatus::create($request, $this->options); $this->verifyResource($iyziLinkUpdateProductStatus); }