Last active
March 26, 2021 10:38
-
-
Save ismail1432/3f3228617179423e117ba69269a98901 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BookmarkTest extends TestCase | |
{ | |
public function testPut() | |
{ | |
$payload = [ | |
'title' => 'bookmark_1 edited' | |
'author' => 'Adah edited', | |
'url' => 'www.such-url-1-edited.com', | |
'height' => 25, | |
'width' => 49, | |
'duration' => 180 | |
]; | |
$client = new Client(); | |
$response = $client->request('PUT', '/bookmarks/a179e430-6356-4fb5-91b2-ead2e166fa77', [ | |
'body' => $payload | |
]); | |
$this->assertEquals(200, $response->getStatusCode()); | |
$data = json_decode($response->getBody(), true); | |
$this->assertEquals($payload, $data); | |
// OR | |
$this->assertArrayHasKey($payload['title'], $data); | |
$this->assertArrayHasKey($payload['author'], $data); | |
$this->assertEquals($payload['url'], $data['url']); | |
$this->assertEquals($payload['height'], $data['height']); | |
$this->assertEquals($payload['width'], $data['width']); | |
$this->assertEquals($payload['duration'], $data['duration']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment