Skip to content

Instantly share code, notes, and snippets.

@cassianotartari
Created August 17, 2017 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cassianotartari/eaeba2e7ead588771170c79715abef1f to your computer and use it in GitHub Desktop.
Save cassianotartari/eaeba2e7ead588771170c79715abef1f to your computer and use it in GitHub Desktop.
<?php
namespace AppBundle\Tests\Controller;
use Lakion\ApiTestCase\JsonApiTestCase;
use Symfony\Component\HttpFoundation\Response;
class ProductApiTest extends JsonApiTestCase
{
function testCreatePostResponse()
{
$data =
<<<EOT
{
"name": "Star Wars T-Shirt",
"sku": "SWTS",
"price": 50
}
EOT;
$this->client->request('POST', '/products/', [], [], [
'CONTENT_TYPE' => 'application/json',
], $data);
$response = $this->client->getResponse();
$this->assertResponse($response, 'products/create_response' , Response::HTTP_CREATED);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment