本文整理汇总了PHP中ApiTester::seeResponseContains方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiTester::seeResponseContains方法的具体用法?PHP ApiTester::seeResponseContains怎么用?PHP ApiTester::seeResponseContains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiTester
的用法示例。
在下文中一共展示了ApiTester::seeResponseContains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* @depends update
*/
public function delete(ApiTester $I)
{
$I->wantTo('Delete a new Contact in com_contacts using DELETE');
$I->amHttpAuthenticated('admin', 'admin');
$I->sendDELETE('index.php' . '?option=contact' . '&api=Hal' . '&webserviceClient=administrator' . '&webserviceVersion=1.0.0' . "&id={$this->id}");
$I->seeResponseCodeIs(200);
$I->sendGET('index.php' . '?option=contact' . '&api=Hal' . '&webserviceClient=administrator' . '&webserviceVersion=1.0.0' . "&id={$this->id}");
$I->seeResponseCodeIs(404);
$I->seeResponseIsJson();
$I->seeResponseContains('"message":"Item not found with given key.","code":404,"type":"Exception"');
}
示例2: successfullMemberLogin
public function successfullMemberLogin(ApiTester $I)
{
$I->am('an active member');
$I->wantTo('post to the main door endpoint and get an OK back');
$user = $I->getActiveKeyholderMember();
$keyFob = $I->getMemberKeyFob($user->id);
//Post the keyfob to the endpoint
$I->sendPOST('/access-control/main-door', ['data' => $keyFob->key_id]);
//The endpoint always returns 200
$I->seeResponseCodeIs(200);
//Make sure a good response is returned
$I->seeResponseIsJson();
//Response contains their name
$I->seeResponseContains($user->given_name);
//Make sure the request was allowed
$I->seeResponseContainsJson(['valid' => '1']);
$I->dontSeeHttpHeader('Set-Cookie');
$I->dontSeeHttpHeader('Built-By');
//Confirm an access log record was created
$I->seeInDatabase('access_log', ['user_id' => $user->id, 'key_fob_id' => $keyFob->id, 'response' => 200, 'service' => 'main-door']);
}
示例3: variantsProbabilityInvalid
public function variantsProbabilityInvalid(ApiTester $I)
{
$I->createAndLoginUser();
$I->createProjectAndSetHeader();
# invalid variants_probability
$data = $I->getTableShortData();
$data['variants_probability'] = 'invalid';
$I->sendPOST('api/v1/admin/tables', $data);
$I->seeResponseCodeIs(422);
$I->seeResponseContains('variants_probability');
# more than 100
$data['variants_probability'] = 'percent';
$data['variants'][0]['probability'] = 30;
$data['variants'][0]['title'] = 'Variant 1';
$data['variants'][1] = ['title' => 'Variant 2', 'default_title' => 'Variant 2', 'default_description' => 'Description Variant 2', 'default_decision' => 'Decline', 'probability' => 71, 'rules' => $I->getVariantRules()];
$I->sendPOST('api/v1/admin/tables', $data);
$I->seeResponseCodeIs(422);
$I->seeResponseContains('variants_probability');
# less than 100
$data['variants'][0]['probability'] = 28;
$I->sendPOST('api/v1/admin/tables', $data);
$I->seeResponseCodeIs(422);
$I->seeResponseContains('variants_probability');
}
示例4: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('get new pid for a user');
$I->haveHttpHeader("HTTP_Content-Type", "application/json");
$I->haveHttpHeader("Content-Type", "application/json");
$I->sendPOST('http://localhost/api/v1/action/GetPid.php', json_encode(array('action' => 'GetPid')));
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains("pid");
示例5: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('Get list of hotels');
$I->sendPOST('/hotels-api/detail/1', []);
$I->seeResponseContains('{"id":"2","title":"Vip","price":"180","image":"http:\\/\\/andriuss.ktu.ongr.rocks\\/src\\/Frontend\\/Files\\/rooms\\/images\\/source\\/vip_ton.jpg","count":"2","available_rooms":"2"},{"id":"3","title":"Standart","price":"100","image":"http:\\/\\/andriuss.ktu.ongr.rocks\\/src\\/Frontend\\/Files\\/rooms\\/images\\/source\\/standart_ton.jpg","count":"6","available_rooms":"6"},{"id":"4","title":"Family","price":"200","image":"http:\\/\\/andriuss.ktu.ongr.rocks\\/src\\/Frontend\\/Files\\/rooms\\/images\\/source\\/family_ton.jpg","count":"4","available_rooms":"4"}');
示例6: consumers
public function consumers(ApiTester $I)
{
$faker = $I->getFaker();
$I->createAndLoginUser();
$I->createProjectAndSetHeader();
$I->createConsumer();
$I->sendPOST('api/v1/projects/consumers', ['description' => $faker->text('20'), 'scope' => ['decisions_view', 'decisions_make']]);
$consumer = json_decode($I->grabResponse())->data[0];
$I->assertConsumers('$.data[*]', 201);
$text = $faker->text('20');
$I->sendPUT('api/v1/projects/consumers', ['description' => $text, 'scope' => ['decisions_view', 'decisions_make'], 'client_id' => $consumer->client_id]);
$I->seeResponseContains($text);
$I->assertConsumers();
$I->sendDELETE('api/v1/projects/consumers', ['client_id' => $consumer->client_id]);
$I->cantSeeResponseContains($consumer->client_id);
$I->assertConsumers();
}
示例7: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('check teams resource');
$I->sendGET('/players/33?expand=teams');
$I->seeResponseCodeIs(401);
$token = $I->login('q@q.q', 'q');
// show list of user's teams
$I->haveHttpHeader('Authorization', "Bearer {$token}");
$I->sendGET('/players/33?expand=teams');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains('teams');
$I->seeResponseContains('"sport":"football"');
$I->seeResponseContains('"name":"FridayPlay"');
$I->seeResponseContains('"is_capitan":"1"');
$teams = $I->grabDataFromResponseByJsonPath('$.teams')[0];
\PHPUnit_Framework_Assert::assertEquals(1, count($teams));
\PHPUnit_Framework_Assert::assertEquals(2, count($teams[0]['players']));
// new team creation
$I->sendPOST('/teams', ['name' => "QA", 'sport' => "voleyball"]);
$I->seeResponseCodeIs(201);
$I->seeResponseIsJson();
$I->seeResponseContains('"sport":"voleyball"');
$I->seeResponseContains('"name":"QA"');
$I->seeResponseContains('"is_capitan":"1"');
$players = $I->grabDataFromResponseByJsonPath('$.players')[0];
\PHPUnit_Framework_Assert::assertEquals(1, count($players));
$teamId = $I->grabDataFromResponseByJsonPath('$.id')[0];
$I->sendGET('/players/33?expand=teams');
$I->seeResponseCodeIs(200);
示例8: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('check games resource');
$I->sendGET('/teams/26?expand=games');
$I->seeResponseCodeIs(401);
$token = $I->login('q@q.q', 'q');
// show list of games for team
$I->haveHttpHeader('Authorization', "Bearer {$token}");
$I->sendGET('/teams/26?expand=games');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains('games');
$games = $I->grabDataFromResponseByJsonPath('$.games')[0];
\PHPUnit_Framework_Assert::assertEquals(2, count($games));
$I->seeResponseContains('training');
$I->seeResponseContains('evening game');
// check for empty list for team with no games
$I->sendGET('/teams/27?expand=games');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains('games');
$games = $I->grabDataFromResponseByJsonPath('$.games')[0];
\PHPUnit_Framework_Assert::assertEquals(0, count($games));
// create game
$I->sendPOST('/games', ['team_id' => 26, 'datetime' => date("Y-m-d H:i:s"), 'location' => "home", 'title' => "important game"]);
$I->seeResponseCodeIs(201);
$I->seeResponseIsJson();
$I->seeResponseContains('important game');
$I->seeResponseContains('home');
$gameId = $I->grabDataFromResponseByJsonPath('$.id')[0];
示例9: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('check player login');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST('/auth/login', ['email' => 'q@q.q', 'password' => 'q']);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains('token');
$I->sendPOST('/auth/login', ['email' => 'q@q.q', 'password' => 'wrong_password']);
$I->seeResponseCodeIs(401);
$I->seeResponseIsJson();
$I->seeResponseContains('Incorrect username or password.');
示例10: ApiTester
<?php
$user_data = ['name' => 'Player 1', 'email' => 'test@mail.com', 'password' => 'test', 'password_repeat' => 'test'];
$I = new ApiTester($scenario);
$I->wantTo('check players resource');
// creating new player
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST('/players', $user_data);
$I->seeResponseCodeIs(201);
$I->seeResponseIsJson();
$I->seeResponseContains('token');
// already existing player
$user_data['email'] = 'q@q.q';
$I->sendPOST('/players', $user_data);
$I->seeResponseCodeIs(422);
$I->seeResponseIsJson();
$I->seeResponseContains('Email \\"q@q.q\\" has already been taken.');
// check that all other routes are disabled
// index
$I->sendGET('/players');
$I->seeResponseCodeIs(404);
$I->seeResponseContains('Page not found.');
// update
$I->sendPUT('/players/33', ['name' => 'updated_name']);
$I->seeResponseCodeIs(404);
$I->seeResponseContains('Page not found.');
// update
$I->sendDELETE('/players/33');
$I->seeResponseCodeIs(404);
$I->seeResponseContains('Page not found.');
示例11: ApiTester
<?php
$I = new ApiTester($scenario);
$I->am('Saman IT employee!');
$I->wantTo('test GetProductInfo method on this webservice');
$I->haveHttpHeader('Content-Type', 'text/xml');
$I->sendPOST('/webservice.php', '<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<GetProductInfo xmlns="http://example.com/nikapps/samanussd/soap/samansoapserver">
<productCode>123213</productCode>
<languageCode>Fa</languageCode>
</GetProductInfo>
</Body>
</Envelope>');
$I->seeResponseIsXml();
$I->seeResponseContains('<Result>1;1000;Ok!</Result>');
示例12: ApiTester
<?php
$I = new ApiTester($scenario);
$I->am('Saman IT employee!');
$I->wantTo('test CallSaleProvider method on this webservice');
$I->haveHttpHeader('Content-Type', 'text/xml');
$I->sendPOST('/webservice.php', '<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<CallSaleProvider xmlns="http://example.com/nikapps/samanussd/soap/samansoapserver">
<productCode>12345*4444*123</productCode>
<Amount>4444</Amount>
<CellNumber>09123456789</CellNumber>
<SEPId>4324642342342</SEPId>
<languageCode>Fa</languageCode>
</CallSaleProvider>
</Body>
</Envelope>');
$I->seeResponseIsXml();
$I->seeResponseContains('<Result>1;p-123-123</Result>');
示例13: ApiTester
<?php
$I = new ApiTester($scenario);
$I->am('Saman IT employee!');
$I->wantTo('test CheckStatus method on this webservice');
$I->haveHttpHeader('Content-Type', 'text/xml');
$I->sendPOST('/webservice.php', '<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<CheckStatus xmlns="http://example.com/nikapps/samanussd/soap/samansoapserver">
<ProviderID>p-123-123</ProviderID>
</CheckStatus>
</Body>
</Envelope>');
$I->seeResponseIsXml();
$I->seeResponseContains('<Result>1;1</Result>');
示例14: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('get new pid for a user');
$I->haveHttpHeader("Content-Type", "application/json");
$I->sendGET('http://localhost/api/v1/action/GetPid.php');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains("action");
示例15: accessForCheck
public function accessForCheck(ApiTester $I)
{
$first_user = $I->createUser(true, '', false);
$second_user = $I->createUser(true);
$I->loginUser($first_user);
$I->createProjectAndSetHeader();
$consumer = $I->createConsumer();
$table = $I->createTable();
$table_id = $table->_id;
$data = ['borrowers_phone_verification' => 'Positive', 'contact_person_phone_verification' => 'Positive', 'internal_credit_history' => 'Positive', 'employment' => true, 'property' => true, 'matching_rules_type' => 'decision'];
$I->sendPOST("api/v1/tables/{$table_id}/decisions", $data);
$I->canSeeResponseCodeIs(403);
$I->seeResponseContains("Project owner is not activated, try again later");
$I->sendPOST('api/v1/projects/users', ['user_id' => $second_user->_id, 'role' => 'manager', 'scope' => ['tables_view', 'decisions_make']]);
$I->loginUser($second_user);
$I->sendPOST("api/v1/tables/{$table_id}/decisions", $data);
$I->canSeeResponseCodeIs(403);
$I->seeResponseContains("Project owner is not activated, try again later");
$I->loginConsumer($consumer);
$I->sendPOST("api/v1/tables/{$table_id}/decisions", $data);
$I->canSeeResponseCodeIs(403);
$I->seeResponseContains("Project owner is not activated, try again later");
$I->logout();
$I->loginClient($I->getCurrentClient());
$I->sendPOST('api/v1/users/verify/email', ['token' => $first_user->sandbox->token_email->token]);
$I->seeResponseCodeIs(200);
$I->loginUser($first_user);
$I->makeDecision($table_id);
$I->loginConsumer($consumer);
$I->makeDecision($table_id);
$I->loginUser($second_user);
$I->makeDecision($table_id);
}