Skip to content

Instantly share code, notes, and snippets.

@luisartola
Forked from igorw/gist:3369858
Created August 28, 2012 12:56
Show Gist options
  • Save luisartola/3497781 to your computer and use it in GitHub Desktop.
Save luisartola/3497781 to your computer and use it in GitHub Desktop.
Silex Rest Api Test
<?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