Skip to content

Commit

Permalink
Put, Patch fix
Browse files Browse the repository at this point in the history
  • Loading branch information
osman-keser committed Sep 23, 2024
1 parent e6d4d0d commit f6413c9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
23 changes: 17 additions & 6 deletions tests/Iyzipay/Tests/IyzipayResourceTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ protected function expectHttpPost()
}

protected function expectHttpPut()
{
$this->expectHttpClient("put");
}

protected function expectHttpPatch()
{
$this->expectHttpClient("patch");
}
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit f6413c9

Please sign in to comment.