当前位置: 首页>>代码示例>>PHP>>正文


PHP ApiTester::assertTrue方法代码示例

本文整理汇总了PHP中ApiTester::assertTrue方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiTester::assertTrue方法的具体用法?PHP ApiTester::assertTrue怎么用?PHP ApiTester::assertTrue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ApiTester的用法示例。


在下文中一共展示了ApiTester::assertTrue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ApiTester

<?php

use Codeception\Util\Fixtures;
/** @var Faker\Generator $faker */
$faker = Fixtures::get('faker');
$devs = Fixtures::get('devs');
$I = new ApiTester($scenario);
$I->wantTo('get the user price based on the GitHub API');
$I->amGoingTo('Get a non-existent user');
$I->sendGET('dev/' . $faker->lexify('??????????'));
$I->seeResponseCodeIs(404);
$I->amGoingTo('Get an existent user');
$I->sendGET('dev/' . $devs[array_rand($devs)]);
$I->seeResponseCodeIs(200);
$dev = json_decode($I->grabResponse());
$I->assertTrue(is_numeric($dev->rate), 'rate is numeric');
$I->assertTrue(is_string($dev->username) && strlen($dev->username) != 0, 'username is present and is string');
开发者ID:igorsantos07,项目名称:developer-shop,代码行数:17,代码来源:DetailsCept.php

示例2: variantsProbabilityPercent

 public function variantsProbabilityPercent(ApiTester $I)
 {
     $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $data = $I->getTableShortData();
     $data['variants_probability'] = 'percent';
     $data['variants'][0]['probability'] = 10;
     $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' => 40, 'rules' => $I->getVariantRules()];
     $data['variants'][2] = ['title' => 'Variant 3', 'default_title' => 'Variant 3', 'default_description' => 'Description Variant 3', 'default_decision' => 'Decline', 'probability' => 50, 'rules' => $I->getVariantRules()];
     $matched = [];
     $table = $I->createTable($data);
     for ($i = 0; $i < 100; $i++) {
         $res = $I->makeDecision($table->_id, ['numeric' => 340, 'string' => 'Bad', 'bool' => true]);
         $title = $res->table->variant->title;
         if (!array_key_exists($title, $matched)) {
             $matched[$title] = 0;
         }
         $matched[$title]++;
     }
     $I->assertEquals(3, count($matched), 'Some Table.variants for variants_probability=percent not matched');
     $I->assertTrue($matched['Variant 1'] < $matched['Variant 2'], 'Variant 1 checked more than Variant 2');
     $I->assertTrue($matched['Variant 1'] < $matched['Variant 3'], 'Variant 1 checked more than Variant 3');
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:24,代码来源:TablesCest.php

示例3: read

 /**
  * Preberem zapis in preverim vsa polja
  * 
  * @depends create
  * @param ApiTester $I
  */
 public function read(\ApiTester $I)
 {
     $ent = $I->successfullyGet($this->restUrl, $this->obj['id']);
     codecept_debug($ent);
     $I->assertGuid($ent['id']);
     $I->assertEquals($ent['sifra'], '99');
     $I->assertEquals($ent['ime'], 'zz');
     $I->assertEquals($ent['opis'], 'yy');
     $I->assertEquals($ent['imeZenski'], 'yy');
     $I->assertEquals($ent['podrocje'], 'umetnik');
     $I->assertEquals($ent['sort'], 9999);
     $I->assertTrue(isset($ent['funkcije']), "ali so funkcije");
     $I->assertEquals(0, count($ent['funkcije']), "število funkcij");
 }
开发者ID:ifigenija,项目名称:server,代码行数:20,代码来源:TipFunkcijeCest.php

示例4: read

 /**
  * Preberem zapis in preverim vsa polja
  * 
  * @depends create
  * @param ApiTester $I
  */
 public function read(\ApiTester $I)
 {
     $ent = $I->successfullyGet($this->restUrl, $this->obj1['id']);
     codecept_debug($ent);
     $zacetek = '2014-05-01T20:00:00+0200';
     // ker je začetek, bo tudi dogodek kreiral
     $I->assertGuid($ent['id']);
     $I->assertEquals($ent['vrsta'], 'uu');
     $I->assertEquals($ent['drzava'], $this->lookDrzava1);
     $I->assertEquals($ent['title'], "Gostovanje {$zacetek}");
     $I->assertEquals($ent['status'], '200s');
     $I->assertEquals($ent['zacetek'], $zacetek);
     $I->assertEquals($ent['konec'], '2014-05-20T23:00:00+0200');
     $I->assertEquals($ent['sezona'], $this->lookSezona2014['id']);
     $I->assertEquals($ent['barva'], '#123456', "barva");
     $I->assertEquals($ent['kraj'], 'zzCity');
     $I->assertEquals($ent['zamejstvo'], true);
     $I->assertTrue(isset($ent['podrejeniDogodki']));
     $I->assertEquals(4, count($ent['podrejeniDogodki']), "število podrejenih dogodkov (2+2)");
     $I->assertEquals($ent['dogodek']['id'], $this->objDogodek['id']);
     $I->assertEquals(3, count($ent['dogodek']['terminiStoritve']), "število terminov storitve");
 }
开发者ID:ifigenija,项目名称:server,代码行数:28,代码来源:GostovanjeCest.php

示例5: vcOutcomeIdVcEventIdVcSportIdNumericValidIds

 public function vcOutcomeIdVcEventIdVcSportIdNumericValidIds(ApiTester $I)
 {
     $I->sendGET($this->endpoint . SOURCE);
     $tips = $I->grabDataFromResponseByJsonPath('$.tips');
     foreach ($tips[0] as $tip) {
         $I->assertTrue(is_numeric($tip['vc_outcome_id']), 'vc_outcome_id is not numeric');
         $I->assertTrue(is_numeric($tip['vc_event_id']), 'vc_event_id is not numeric');
         $I->assertTrue(is_numeric($tip['vc_sport_id']), 'vc_sport_id is not numeric');
         $I->assertGreaterThan(0, $tip['vc_outcome_id'], 'vc_outcome_id is less than or equal to 0');
         $I->assertGreaterThan(0, $tip['vc_event_id'], 'vc_event_id is less than or equal to 0');
         $I->assertGreaterThan(0, $tip['vc_sport_id'], 'vc_sport_id is less than or equal to 0');
     }
 }
开发者ID:bogdanbuciu,项目名称:tester,代码行数:13,代码来源:probaCest.php

示例6: preberiPostniNaslov

 /**
  * preberem poštni naslov  
  * @depends dodajVecPostnihNaslovov
  * 
  * @param ApiTester $I
  */
 public function preberiPostniNaslov(\ApiTester $I)
 {
     $postni = $I->successfullyGet($this->naslUrl, $this->objpostni['id']);
     $I->assertNotEmpty($postni);
     $I->assertTrue(isset($postni['pokrajina']));
     $I->assertEquals("Štajerska", $postni['pokrajina']);
 }
开发者ID:ifigenija,项目名称:server,代码行数:13,代码来源:OsebaCest.php

示例7: settings

 public function settings(ApiTester $I)
 {
     $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $I->sendPUT('api/v1/projects', ['settings' => []]);
     $I->assertProject();
     $I->assertTrue($I->getResponseFields()->data->settings instanceof \StdClass);
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:8,代码来源:ProjectsCest.php

示例8: ApiTester

<?php

$I = new ApiTester($scenario);
$I->wantTo('poke the server with an existing device and a new IP');
$initial_created_at = \Carbon\Carbon::now()->subHour();
$initial_updated_at = \Carbon\Carbon::now()->subHour();
$I->haveRecord('devices', ['ip' => '192.168.1.123', 'mac' => '00:19:20:A1:B4:FC', 'name' => 'Manuel', 'created_at' => $initial_created_at, 'updated_at' => $initial_updated_at]);
$I->sendPOST('devices/poke', ['ip' => '192.168.1.100', 'mac' => '00:19:20:A1:B4:FC', 'name' => 'Manuel']);
$I->seeResponseCodeIs(200);
$I->seeHttpHeader('Location', 'http://localhost/api/v1/devices/1');
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['data' => ['ip' => '192.168.1.100', 'name' => 'Manuel', 'on_home_page' => 'auto', 'group' => null]]);
$I->seeResponseJsonMatchesXpath('//data//device_added');
$I->seeResponseJsonMatchesXpath('//data//last_contact');
$I->seeRecord('devices', ['ip' => '192.168.1.100', 'mac' => '00:19:20:A1:B4:FC', 'name' => 'Manuel', 'public' => 'auto', 'group' => null]);
$I->seeRecord('pokes', ['ip' => '192.168.1.100', 'mac' => '00:19:20:A1:B4:FC']);
$device = $I->grabRecord('devices', ['mac' => '00:19:20:A1:B4:FC']);
$created_at_after_poke = $I->carbonize($device->created_at);
$updated_at_after_poke = $I->carbonize($device->updated_at);
$I->assertTrue($updated_at_after_poke->gt($initial_updated_at), 'The updated_at timestamp after the poke is greater than the initial updated_at timestamp');
$I->assertTrue($updated_at_after_poke->gt($initial_created_at), 'The updated_at timestamp after the poke is greater than the initial created_at timestamp');
$I->assertTrue($created_at_after_poke->eq($initial_created_at), 'The created_at timestamp after the poke is equal to the initial created_at timestamp');
开发者ID:4mb,项目名称:pi.strebl.ch,代码行数:22,代码来源:PokeWithExistingDeviceWithNewIpCept.php

示例9: read

 /**
  * Preberem zapis in preverim vsa polja
  * 
  * @depends update
  * @param ApiTester $I
  */
 public function read(\ApiTester $I)
 {
     $ent = $I->successfullyGet($this->restUrl, $this->obj1['id']);
     $I->assertGuid($ent['id']);
     $I->assertEquals($ent['zacetek'], '2010-02-01T00:00:00+0100');
     $I->assertEquals($ent['konec'], '2011-01-31T00:00:00+0100');
     $I->assertNotEmpty($ent['sifra'], "šifra");
     $I->assertEquals($ent['ime'], 'uu');
     $I->assertTrue(isset($ent['dogodki']));
     $I->assertEquals(0, count($ent['dogodki']));
 }
开发者ID:ifigenija,项目名称:server,代码行数:17,代码来源:SezonaCest.php

示例10: checkManyVariants

 public function checkManyVariants(ApiTester $I)
 {
     $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $tableData = $I->getTableShortData();
     $variantId1 = $I->getMongoId();
     $variantId2 = $I->getMongoId();
     $tableData['variants'][0]['_id'] = $variantId1;
     $tableData['variants'][] = ['_id' => $variantId2, 'default_decision' => 'Decline', 'rules' => [['than' => 'Approve', 'title' => 'Valid rule title', 'description' => 'Valid rule description', 'conditions' => [['field_key' => 'numeric', 'condition' => '$eq', 'value' => true], ['field_key' => 'string', 'condition' => '$eq', 'value' => 'Variant'], ['field_key' => 'bool', 'condition' => '$eq', 'value' => true]]]]];
     $table = $I->createTable($tableData);
     $checkData = [['numeric' => 500, 'string' => 'Yes', 'bool' => false, 'variant_id' => $variantId1], ['numeric' => 500, 'string' => 'Variant', 'bool' => true, 'variant_id' => $variantId2]];
     foreach ($checkData as $item) {
         $decision = $I->makeDecision($table->_id, $item);
         $I->assertTableDecisionsForConsumer();
         $I->sendGET('api/v1/admin/decisions/' . $decision->_id);
         $I->assertTableDecisionsForAdmin();
         $I->assertResponseDataFields(['final_decision' => 'Approve', 'table' => ['_id' => $table->_id, 'variant' => ['_id' => $item['variant_id']]]]);
     }
     $decision = $I->makeDecision($table->_id, ['numeric' => 500, 'string' => 'Yes', 'bool' => false]);
     $I->assertTableDecisionsForConsumer();
     $I->sendGET('api/v1/admin/decisions/' . $decision->_id);
     $I->assertTableDecisionsForAdmin();
     $I->assertTrue(in_array($I->getResponseFields()->data->table->variant->_id, [$variantId1, $variantId2]));
     foreach ([$variantId1, $variantId2] as $variantId) {
         $I->sendGET('api/v1/admin/decisions?variant_id=' . $variantId);
         $I->seeResponseCodeIs(200);
         foreach ($I->getResponseFields()->data as $decision) {
             $I->assertTrue($decision->table->variant->_id == $variantId, "Decision doesn't filtered by variant_id {$variantId}");
         }
     }
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:31,代码来源:DecisionsCest.php

示例11: ApiTester

<?php

$I = new ApiTester($scenario);
$I->wantTo('update a device');
$user = $I->haveAnAccount();
$I->amHttpAuthenticated($user['email'], $user['password']);
$created_at = \Carbon\Carbon::now()->subHour();
$updated_at = \Carbon\Carbon::now()->subHour();
$I->haveRecord('devices', ['ip' => '192.168.1.101', 'mac' => '11:22:33:44:55:66', 'name' => 'Awesome Pi One', 'created_at' => $created_at, 'updated_at' => $updated_at]);
$I->sendPATCH('devices/1', ['ip' => '192.168.1.102', 'mac' => 'AA:BB:CC:DD:EE:FF', 'name' => 'Updated Awesome Pi One']);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['ip' => '192.168.1.102', 'name' => 'Updated Awesome Pi One', 'on_home_page' => 'auto', 'group' => null]);
$I->seeResponseJsonMatchesXpath('//data//device_added');
$I->seeResponseJsonMatchesXpath('//data//last_contact');
$I->canSeeRecord('devices', ['ip' => '192.168.1.102', 'mac' => 'AA:BB:CC:DD:EE:FF', 'name' => 'Updated Awesome Pi One', 'public' => 'auto', 'group' => null]);
$updatedDevice = $I->grabRecord('devices', ['ip' => '192.168.1.102']);
$I->cantSeeRecord('devices', ['ip' => '192.168.1.101', 'mac' => '11:22:33:44:55:66', 'name' => 'Awesome Pi One']);
$updated_created_at_timestamp = $I->carbonize($updatedDevice->created_at);
$updated_updated_at_timestamp = $I->carbonize($updatedDevice->updated_at);
$I->assertTrue($updated_created_at_timestamp->eq($created_at), 'Updated created_at timestamp is equal to the initial created_at timestamp');
$I->assertTrue($updated_updated_at_timestamp->gt($updated_at), 'Updated updated_at timestamp is greater than the initial updated_at timestamp');
$I->assertTrue($updated_updated_at_timestamp->gt($created_at), 'Updated updated_at timestamp is greater than the initial created_at timestamp');
$I->sendPATCH('devices/100', ['ip' => '192.168.1.102', 'mac' => 'AA:BB:CC:DD:EE:FF', 'name' => 'Updated Awesome Pi One']);
$I->seeResponseCodeIs(404);
$I->seeResponseIsJson();
开发者ID:4mb,项目名称:pi.strebl.ch,代码行数:26,代码来源:UpdateDeviceCept.php

示例12: read

 /**
  * Preberem zapis in preverim vsa polja
  * 
  * @depends create
  * @param ApiTester $I
  */
 public function read(\ApiTester $I)
 {
     $ent = $I->successfullyGet($this->restUrl, $this->obj['id']);
     codecept_debug($ent);
     $I->assertNotEmpty($ent['id']);
     $I->assertEquals($ent['faza'], 'produkcija');
     $I->assertEquals($ent['naslov'], 'zz');
     $I->assertEquals($ent['podnaslov'], 'zz');
     $I->assertEquals($ent['delovniNaslov'], 'zz');
     $I->assertEquals($ent['datumZacStudija'], '2011-02-01T00:00:00+0100');
     $I->assertEquals($ent['datumPremiere'], '2012-02-01T00:00:00+0100');
     $I->assertEquals($ent['maticniOder'], $this->lookProstor['id']);
     $I->assertEquals($ent['stOdmorov'], 1);
     //        $I->assertEquals($ent['avtor'], 'avzz');
     $I->assertEquals($ent['gostujoca'], FALSE);
     $I->assertEquals($ent['trajanje'], 2);
     $I->assertEquals($ent['opis'], 'yy');
     $I->assertEquals($ent['arhIdent'], 'zz');
     $I->assertEquals($ent['arhOpomba'], 'zz');
     $I->assertEquals($ent['datumZakljucka'], '2019-02-01T00:00:00+0100');
     $I->assertEquals($ent['sloAvtor'], FALSE);
     $I->assertEquals($ent['jeKoprodukcija'], FALSE);
     $I->assertEquals($ent['kratkiNaslov'], 'zz');
     $I->assertEquals($ent['besedilo']['id'], $this->lookBesedilo['id'], "Besedilo");
     $I->assertEquals($ent['zvrstUprizoritve'], null);
     $I->assertEquals($ent['zvrstSurs'], $this->lookZvrstSurs['id']);
     $I->assertEquals($ent['internacionalniNaslov'], 'zz');
     //        $I->assertEquals($ent['steviloVaj'], 4,"Število vaj");
     $I->assertEquals($ent['planiranoSteviloVaj'], 5);
     $I->assertEquals($ent['krstna'], true, "krstna");
     $I->assertEquals($ent['prvaSlovenska'], true);
     $I->assertEquals($ent['naslovIzvirnika'], 'zz');
     $I->assertEquals($ent['podnaslovIzvirnika'], 'zz');
     $I->assertFalse(isset($ent['producent']), "producent");
     $I->assertTrue(isset($ent['funkcije']));
     $I->assertTrue(isset($ent['arhivi']));
     $I->assertTrue(isset($ent['rekviziterstva']));
     $I->assertTrue(isset($ent['vaje']));
     $I->assertTrue(isset($ent['predstave']));
     //        $I->assertTrue(isset($ent['gostujoce']));
     $I->assertEquals(0, count($ent['funkcije']));
     $I->assertEquals(0, count($ent['arhivi']));
     $I->assertEquals(0, count($ent['rekviziterstva']));
     $I->assertEquals(0, count($ent['vaje']));
     $I->assertEquals(0, count($ent['predstave']));
     //        $I->assertEquals(0, count($ent['gostujoce']));
 }
开发者ID:ifigenija,项目名称:server,代码行数:53,代码来源:UprizoritevCest.php

示例13: ApiTester

$faker = Fixtures::get('faker');
$orgs = Fixtures::get('orgs');
$sm_orgs = Fixtures::get('small_orgs');
$I = new ApiTester($scenario);
$I->wantTo('list of developers of an organization');
$I->amGoingTo('Get a non-existent organization');
$I->sendGET('dev/organization/' . $faker->lexify('??????????'));
$I->seeResponseCodeIs(404);
$I->amGoingTo('Get an existent organization on different information levels');
$get_org = function ($level, $orgs) use($I) {
    $I->amGoingTo("Request Org {$level} information");
    $query = $level ? '?level=' . $level : '';
    $I->sendGET('dev/organization/' . $orgs[array_rand($orgs)] . $query);
    $I->seeResponseCodeIs(200);
    $org = json_decode($I->grabResponse(), true);
    $I->assertTrue(is_numeric($org['size']), 'has total of members');
    $I->assertTrue(is_array($org['members']), 'has list of members');
    $I->assertGreaterThanOrEqual(1, $org['size'], 'organization has at least one member');
    $I->assertEquals(sizeof($org['members']), $org['size'], 'total is correctly calculated');
    $I->assertTrue(is_string($org['members'][0]['username']), 'first member has "username"');
    return $org;
};
$org = $get_org('basic', $orgs);
$I->assertEmpty($org['members'][0]['name']);
$I->assertEmpty($org['members'][0]['repos']);
$I->assertEmpty($org['members'][0]['rate']);
$org = $get_org(null, $orgs);
$I->assertTrue(is_string($org['members'][0]['name']));
$I->assertTrue(is_numeric($org['members'][0]['repos']));
$I->assertEmpty($org['members'][0]['rate']);
$org = $get_org('user', $orgs);
开发者ID:igorsantos07,项目名称:developer-shop,代码行数:31,代码来源:OrganizationCept.php

示例14: read

 /**
  * Preberem zapis in preverim vsa polja
  * 
  * @depends create
  * @param ApiTester $I
  */
 public function read(\ApiTester $I)
 {
     $ent = $I->successfullyGet($this->restUrl, $this->obj1['id']);
     codecept_debug($ent);
     $I->assertGuid($ent['id']);
     $I->assertEquals($ent['podrocje'], $this->lookTipFunkcije1Um['podrocje'], "področje iz tipa funkcije");
     $I->assertEquals($ent['vodjaEkipe'], FALSE);
     $I->assertEquals($ent['naziv'], 'zz');
     $I->assertEquals($ent['komentar'], 'zz');
     $I->assertEquals($ent['velikost'], 'mala', "velikost funkcije");
     $I->assertEquals($ent['pomembna'], true);
     $I->assertEquals($ent['sort'], 8);
     $I->assertEquals($ent['uprizoritev'], $this->lookUprizoritev1['id']);
     $I->assertEquals($ent['privzeti'], $this->objAlternacija['id'], "privzeti");
     $I->assertEquals($ent['tipFunkcije'], $this->lookTipFunkcije1Um['id'], "tip funkcije");
     $I->assertEquals($ent['maxPrekrivanj'], 3, "maks prekrivanj");
     $I->assertTrue(isset($ent['alternacije']));
     $I->assertEquals(0, count($ent['alternacije']));
 }
开发者ID:ifigenija,项目名称:server,代码行数:25,代码来源:FunkcijaCest.php

示例15: read

 /**
  * Preberem zapis in preverim vsa polja
  * 
  * @depends update
  * @param ApiTester $I
  */
 public function read(\ApiTester $I)
 {
     $this->obj1 = $ent = $I->successfullyGet($this->restUrl, $this->obj1['id']);
     codecept_debug($ent);
     $I->assertGuid($ent['id']);
     $zacetek = '2014-05-07T10:00:00+0200';
     $I->assertEquals($ent['title'], "uu");
     $I->assertEquals($ent['status'], '200s');
     $I->assertEquals($ent['zacetek'], $this->zacetek1);
     $I->assertEquals($ent['konec'], $this->konec1);
     $I->assertEquals($ent['prostor']['id'], $this->lookProstor1['id']);
     //        $I->assertEquals($ent['sezona'], $this->lookSezona2014['id']); // ker dinamično kreiramo datum
     $I->assertEquals($ent['razred'], '200s');
     //        $I->assertEquals($ent['termin'], 'uu');
     $I->assertEquals($ent['vaja'], $this->objVaja1['id']);
     $I->assertEquals($ent['predstava'], null);
     $I->assertEquals($ent['gostovanje'], null);
     $I->assertEquals($ent['splosni'], null);
     $I->assertTrue(isset($ent['terminiStoritve']));
     $I->assertEquals(0, count($ent['terminiStoritve']));
     $I->assertEquals($ent['barva'], '#123456', 'barva');
 }
开发者ID:ifigenija,项目名称:server,代码行数:28,代码来源:DogodekCest.php


注:本文中的ApiTester::assertTrue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。