-
-
Save luisartola/3497781 to your computer and use it in GitHub Desktop.
Silex Rest Api Test
This file contains 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 | |
use Silex\WebTestCase; | |
class RestApiTest extends WebTestCase | |
{ | |
public function createApplication() | |
{ | |
... | |
} | |
public function testRestApiLikeABoss() | |
{ | |
$client = $this->createClient(); | |
$client->request('GET', '/'); | |
$response = $client->getResponse(); | |
$this->assertTrue($response->isOk()); | |
$data = json_decode($response->getContent(), true); | |
$expectedUsers = [['id' => 1, 'name' => 'igorw']]; | |
$this->assertSame($expectedUsers, $data['users']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment