-
-
Save trikitrok/b008383dd9d23485bcf974353551ab48 to your computer and use it in GitHub Desktop.
POST Refactor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Trovit\B2B\Redirect\Tests\integration\Controller; | |
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | |
class DefaultControllerTest extends WebTestCase | |
{ | |
private $client; | |
protected function setUp() | |
{ | |
$this->client = static::createClient(); | |
parent::setUp(); | |
} | |
/** @test */ | |
public function should_succeed_when_all_mandatory_parameters_are_present() | |
{ | |
$this->client->request('GET', queryString()->build()); | |
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_brand_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutBrand()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_country_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutCountry()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_vertical_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutVertical()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_page_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutPage()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_source_id_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutSourceId()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_page_view_id_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutPageViewId()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_what_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutWhat()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_user_ip_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutUserIp()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_user_agent_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutUserAgent()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_is_human_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutIsHuman()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_is_dirified_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutIsDirified()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_origin_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutOrigin()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_browser_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutBrowser()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
/** @test */ | |
public function should_fail_when_section_is_not_present() | |
{ | |
$this->client->request('GET', queryString()->withoutSection()->build()); | |
$this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | |
} | |
} | |
function queryString(): QueryStringBuilder | |
{ | |
return QueryStringBuilder::requestParameters(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment