Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Last active May 24, 2019 23:39
<?php
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
/** @test */
public function should_returns_200_when_all_mandatory_parameters_are_present()
{
$client = static::createClient();
$client->request(
'GET',
$this->queryString
->withCountry("us")
->withVertical(1)
->withBrand("someBrand")->build()
);
$this->assertEquals(200, $client->getResponse()->getStatusCode());
}
/** @test */
public function should_returns_400_when_brand_is_not_present()
{
$client = static::createClient();
$client->request(
'GET',
$this->queryString
->withCountry("us")
->withVertical(1)->build()
);
$this->assertEquals(400, $client->getResponse()->getStatusCode());
}
/** @test */
public function should_returns_400_when_country_is_not_present()
{
$client = static::createClient();
$client->request(
'GET', $this->queryString
->withBrand("someBrand")
->withVertical(2)->build()
);
$this->assertEquals(400, $client->getResponse()->getStatusCode());
}
/** @test */
public function should_returns_400_when_vertical_is_not_present()
{
$client = static::createClient();
$client->request(
'GET',
$this->queryString
->withCountry("es")
->withBrand("someBrand")->build()
);
$this->assertEquals(400, $client->getResponse()->getStatusCode());
}
function queryString(): QueryStringBuilder
{
return new QueryStringBuilder();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment