Skip to content

Instantly share code, notes, and snippets.

@pjedrzejewski
Created December 30, 2015 12:29
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 pjedrzejewski/fff27d957276a9aa4583 to your computer and use it in GitHub Desktop.
Save pjedrzejewski/fff27d957276a9aa4583 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
{
/**
* @test
*/
public function shouldCreateAProduct()
{
$data =
<<<EOT
{
"price": 50,
"sku": "SWTS",
"name": "Star Wars T-Shirt"
}
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