Skip to content

Instantly share code, notes, and snippets.

@RajithaKumara
Created November 15, 2018 08:48
Show Gist options
  • Select an option

  • Save RajithaKumara/7d0aedba083d1e2cea9e1e893b22c0fc to your computer and use it in GitHub Desktop.

Select an option

Save RajithaKumara/7d0aedba083d1e2cea9e1e893b22c0fc to your computer and use it in GitHub Desktop.
Here this $client comes from symfony/browser-kit. (https://symfony.com/doc/current/testing.html#functional-tests)
<?php
namespace API\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Response;
class APIWebTestCase extends WebTestCase
{
public function testEndpoint()
{
$client = static::createClient();
$client->request('GET', '/api/endpoint');
$this->assertSame(Response::HTTP_OK, $client->getResponse()->getStatusCode());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment