當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ApiTester::am方法代碼示例

本文整理匯總了PHP中ApiTester::am方法的典型用法代碼示例。如果您正苦於以下問題:PHP ApiTester::am方法的具體用法?PHP ApiTester::am怎麽用?PHP ApiTester::am使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ApiTester的用法示例。


在下文中一共展示了ApiTester::am方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: invalidTime

 public function invalidTime(ApiTester $I)
 {
     $I->am('an invalid device');
     $I->wantTo('verify the endpoint returns validation failures - invalid time');
     //Send a bad code to the endpoint
     $I->haveHttpHeader('Content-Type', 'application/json');
     $I->haveHttpHeader('Accept', 'application/json');
     $I->sendPOST('/acs', ['device' => 'main-door', 'tag' => 'ABCDEF123456', 'message' => 'boot', 'service' => 'entry', 'time' => 'abcdefgh']);
     $I->canSeeResponseCodeIs(422);
 }
開發者ID:adamstrawson,項目名稱:BBMembershipSystem,代碼行數:10,代碼來源:ACSCest.php

示例2: successfullEnd

 public function successfullEnd(ApiTester $I)
 {
     $I->am('a valid user');
     $I->wantTo('verify the endpoint returns a success response and creates the proper records');
     $user = $I->getActiveKeyholderMember();
     $keyFob = $I->getMemberKeyFob($user->id);
     //Send a bad code to the endpoint
     $I->sendPOST('/access-control/device', ['data' => $keyFob->key_id . '|welder|start']);
     //The device endpoint always returns 200
     $I->canSeeResponseCodeIs(200);
     //Make sure a success is returned and a session started
     $I->canSeeResponseContainsJson(['valid' => '1']);
     $I->seeInDatabase('equipment_log', ['user_id' => $user->id, 'device' => 'welder', 'active' => 1]);
     $I->sendPOST('/access-control/device', ['data' => $keyFob->key_id . '|welder|end']);
     $I->canSeeResponseCodeIs(200);
     $I->dontSeeHttpHeader('Set-Cookie');
     $I->dontSeeHttpHeader('Built-By');
     $I->canSeeResponseContainsJson(['valid' => '1']);
     //Make sure our database record is not active
     $I->seeInDatabase('equipment_log', ['user_id' => $user->id, 'device' => 'welder', 'active' => 0]);
     //And make sure there is no other active record
     $I->cantSeeInDatabase('equipment_log', ['user_id' => $user->id, 'device' => 'welder', 'active' => 1]);
 }
開發者ID:adamstrawson,項目名稱:BBMembershipSystem,代碼行數:23,代碼來源:DeviceAccessControlCest.php

示例3: unknownDeviceSystemMessage

 public function unknownDeviceSystemMessage(ApiTester $I)
 {
     $I->am('sending a valid system message');
     $I->wantTo('confirm it is received and handled correctly');
     //Post the keyfob to the endpoint
     $I->sendPOST('/access-control/main-door', ['data' => ':unknown|unknown']);
     //The endpoint always returns 200
     $I->seeResponseCodeIs(200);
     //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']);
 }
開發者ID:adamstrawson,項目名稱:BBMembershipSystem,代碼行數:11,代碼來源:AccessControlCest.php

示例4: 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>');
開發者ID:iamtartan,項目名稱:saman-ussd,代碼行數:16,代碼來源:GetProductInfoCept.php

示例5: ApiTester

<?php

$I = new ApiTester($scenario);
$I->am('gocardless');
$I->wantTo('confirm a gocardless webhook is received');
$payloadData = '{
  "payload": {
    "bills": [
      {
        "id": "0QG9YGF008",
        "status": "pending",
        "uri": "https://sandbox.gocardless.com/api/v1/bills/0QG9YGF008",
        "amount": "20.0",
        "amount_minus_fees": "19.8",
        "source_type": "subscription",
        "source_id": "0Q0XG97SBN"
      }
    ],
    "resource_type": "bill",
    "action": "created",
    "signature": "8c50eac00ebd59465f6d634925b7c1291d56a55cb125a5076af7d9e8ac28a5cf"
  }
}';
//$I->haveHttpHeader('Content-Type','application/json');
//$I->haveHttpHeader('Accept', 'application/json');
//$I->sendPOST('https://bbms.buildbrighton.dev/gocardless/webhook', $payloadData);
//$I->seeResponseCodeIs(200);
開發者ID:adamstrawson,項目名稱:BBMembershipSystem,代碼行數:27,代碼來源:GoCardlessBillPaymentReceivedCorrectlyCept.php


注:本文中的ApiTester::am方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。