<?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") ->withSourceId(5)->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) ->withSourceId(5)->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) ->withSourceId(5)->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") ->withSourceId(5)->build() ); $this->assertEquals(400, $client->getResponse()->getStatusCode()); } /** @test */ public function should_returns_400_when_source_id_is_not_present() { $client = static::createClient(); $client->request( 'GET', $this->queryString ->withCountry("us") ->withVertical(1) ->withBrand("someBrand")->build() ); $this->assertEquals(200, $client->getResponse()->getStatusCode()); } function queryString(): QueryStringBuilder { return new QueryStringBuilder(); } }