Пример #1
0
<?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();
Пример #2
0
<?php

/* @var \Codeception\Scenario $scenario */
$I = new TestGuy($scenario);
$I->wantTo('perform some POST requests');
$I->sendPOST('/post', ['id' => 400]);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['message' => 'home', 'id' => 400]);
$I->sendPOST('/hello/peter', ['say' => 'nice to meet you!']);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['message' => 'nice to meet you!']);
Пример #3
0
<?php

/* @var \Codeception\Scenario $scenario */
$I = new TestGuy($scenario);
$I->wantTo('perform some DELETE requests');
$I->sendDELETE('/delete', ['id' => 400]);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['message' => 'home', 'id' => 400]);
$I->sendDELETE('/hello/peter', ['say' => 'nice to meet you!']);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['message' => 'nice to meet you!']);
$I->sendDELETE('/cars/id-412/now');
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['message' => 'removed card with id `412`']);