<?php /* @var \Codeception\Scenario $scenario */ $I = new TestGuy($scenario); $I->wantTo('perform not founding request'); $I->sendGET('/wdwadwadwayccy'); $I->seeResponseCodeIs(404); $I->seeResponseEquals('1');
<?php /* @var \Codeception\Scenario $scenario */ $I = new TestGuy($scenario); $I->wantTo('perform some GET requests'); $I->sendGET('/text'); $I->seeHttpHeader('Content-Type', 'text/plain'); $I->seeResponseEquals('yep');
<?php /* @var \Codeception\Scenario $scenario */ $I = new TestGuy($scenario); $I->wantTo('check events'); $I->sendGET('/event'); $I->seeResponseEquals('/event');
<?php /* @var \Codeception\Scenario $scenario */ $I = new TestGuy($scenario); $I->wantTo('perform some named routes'); $I->sendGET('/route1'); $I->seeResponseEquals('hello world'); $I->sendGET('/route2'); $I->seeResponseEquals('hello world'); $I->sendGET('/route3'); $I->seeResponseEquals('hello world');
<?php /* @var \Codeception\Scenario $scenario */ $I = new TestGuy($scenario); $I->wantTo('check callback parameters'); $I->sendGET('/parameters'); $I->seeResponseEquals('yup'); $I->sendGET('/parameters/app'); $I->seeResponseEquals('Hahns\\Hahns'); $I->sendGET('/parameters/invalid'); $I->seeResponseCodeIs(500);
<?php /* @var \Codeception\Scenario $scenario */ $I = new TestGuy($scenario); $I->wantTo('check redirections'); $I->sendGET('/redirect'); $I->seeResponseCodeIs(404); $I->amOnPage('/redirected');
<?php /* @var \Codeception\Scenario $scenario */ $I = new TestGuy($scenario); $I->wantTo('perform some GET requests'); $I->sendGET('/'); $I->seeResponseIsJson(); $I->seeResponseContainsJson(['message' => 'home']); $I->sendGET('/hallo'); $I->seeResponseIsJson(); $I->seeResponseContainsJson(['message' => 'hallo welt!']); $I->sendGET('/hello'); $I->seeResponseIsJson(); $I->seeResponseContainsJson(['message' => 'hello world!']); $I->sendGET('/hallo/peter'); $I->seeResponseIsJson(); $I->seeResponseContainsJson(['message' => 'hallo peter']); $I->sendGET('/hello/peter'); $I->seeResponseIsJson(); $I->seeResponseContainsJson(['message' => 'hello peter']); $I->sendGET('/hello/peter/1337'); $I->seeResponseIsJson(); $I->seeResponseContainsJson(['message' => 'hello peter-1337']); $I->sendGET('/hallo/peter/1337'); $I->seeResponseIsJson(); $I->seeResponseContainsJson(['message' => 'hallo peter-1337']); $I->sendGET('/hello/peter/pan'); $I->seeResponseIsJson(); $I->seeResponseContainsJson(['message' => 'hello peter pan']); $I->sendGET('/hallo/peter/pan'); $I->seeResponseIsJson();
<?php /* @var \Codeception\Scenario $scenario */ $I = new TestGuy($scenario); $I->wantTo('check events'); $I->sendDELETE('/any'); $I->seeResponseEquals('any'); $I->sendGET('/any'); $I->seeResponseEquals('any'); $I->sendPATCH('/any'); $I->seeResponseEquals('any'); $I->sendPOST('/any'); $I->seeResponseEquals('any'); $I->sendPUT('/any'); $I->seeResponseEquals('any');
<?php /* @var \Codeception\Scenario $scenario */ $I = new TestGuy($scenario); $I->wantTo('check response headers'); $I->sendGET('/header/using/header/bli/blub'); $I->seeHttpHeader('bli', 'blub'); $I->sendGET('/header/code/created'); $I->canSeeResponseCodeIs(201); $I->sendGET('/header/code/created/by/send'); $I->canSeeResponseCodeIs(201); $I->haveHttpHeader('bla', 'roflcopter'); $I->sendGET('/header/return/bla'); $I->seeResponseEquals('roflcopter'); $I->haveHttpHeader('X-Bla', 'doge'); $I->sendGET('/header/return/xbla'); $I->seeResponseEquals('doge');
<?php /* @var \Codeception\Scenario $scenario */ $I = new TestGuy($scenario); $I->wantTo('check NotFoundException'); $I->sendGET('/not-found'); $I->seeResponseCodeIs(404); $I->canSeeHttpHeader('test0r', 'yep');
<?php /* @var \Codeception\Scenario $scenario */ $I = new TestGuy($scenario); $I->wantTo('perform some GET requests'); $I->sendGET('/html'); $I->seeHttpHeader('Content-Type', 'text/html'); $I->seeResponseEquals('<h1>yep</h1>');