本文整理汇总了PHP中ApiTester::amHttpAuthenticated方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiTester::amHttpAuthenticated方法的具体用法?PHP ApiTester::amHttpAuthenticated怎么用?PHP ApiTester::amHttpAuthenticated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiTester
的用法示例。
在下文中一共展示了ApiTester::amHttpAuthenticated方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete(ApiTester $I)
{
$I->wantTo('delete 1 contact in Joomla using SOAP');
$I->amHttpAuthenticated('admin', 'admin');
$I->sendSoapRequest('delete', ['id' => $this->id]);
$I->seeSoapResponseIncludes("<result>true</result>");
$I->sendSoapRequest('readItem', ['id' => $this->id]);
$I->dontSeeSoapResponseIncludes("<name>{$this->name}</name>");
}
示例2: deleteUser
public function deleteUser(ApiTester $I, \Codeception\Scenario $scenario)
{
//$scenario->skip('ownCloud master is broken');
$I->wantTo('delete the user');
$I->amHttpAuthenticated('admin', 'admin');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendDELETE($this->apiUrl . '/users/' . $this->userId);
$I->seeResponseCodeIs(200);
$I->seeResponseIsXml();
$I->seeXmlResponseIncludes(XmlUtils::toXml(['status' => 'ok']));
}
示例3: 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"');
}
示例4: testTestUsersCreation
public function testTestUsersCreation(ApiTester $I)
{
$I->wantTo('make sure my test users have been created');
$I->amHttpAuthenticated('admin', 'admin');
$I->sendGET($this->baseUrl . '/users/' . $this->userId);
$I->seeResponseCodeIs(200);
$I->seeResponseIsXml();
$I->seeXmlResponseIncludes(XmlUtils::toXml(['status' => 'ok']));
$I->sendGET($this->baseUrl . '/users/' . $this->sharerUserId);
$I->seeResponseCodeIs(200);
$I->seeResponseIsXml();
$I->seeXmlResponseIncludes(XmlUtils::toXml(['status' => 'ok']));
}
示例5: readZReadZReadZaEntitetoLasnika
/**
* Preberem zapis in preverim vsa polja
*
* @depends createZWriteZWriteZaEntitetoLasnika
* @param ApiTester $I
*/
public function readZReadZReadZaEntitetoLasnika(\ApiTester $I)
{
$I->amHttpAuthenticated(\IfiTest\AuthPage::$rikard, \IfiTest\AuthPage::$rikardPass);
$ent = $I->successfullyGet($this->restUrl, $this->obj1['id']);
$I->assertGuid($ent['id']);
$resp = $I->successfullyGetList($this->restUrl . "?lastnik=" . $this->lookUprizoritev5['id'], []);
$list = $resp['data'];
$I->assertNotEmpty($list);
}
示例6: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('adicionar um novo pedido');
$I->amHttpAuthenticated('phptesting', '123');
$I->sendPOST('/pedido', ['produtoid' => 1, 'produtonome' => 'Firefox', 'produtoestoque' => 10, 'produtovalor' => 49.9]);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['status' => 'sucesso', 'message' => 'Sucesso']);
示例7: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('create a new device');
$user = $I->haveAnAccount();
$I->amHttpAuthenticated($user['email'], $user['password']);
$I->sendPOST('devices', ['mac' => '00:19:20:A1:B4:FC', 'name' => 'Manuel']);
$I->seeResponseCodeIs(422);
$I->seeResponseIsJson();
$I->sendPOST('devices', ['ip' => '192.168.1.123', 'mac' => '00:19:20:A1:B4:FC', 'name' => 'Manuel']);
$I->seeResponseCodeIs(201);
$I->seeHttpHeader('Location', 'http://localhost/api/v1/devices/1');
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['data' => ['ip' => '192.168.1.123', '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.123', 'mac' => '00:19:20:A1:B4:FC', 'name' => 'Manuel', 'public' => 'auto', 'group' => null]);
示例8: 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['status'], 'A');
$I->assertEquals($ent['zacetek'], '2010-02-01T00:00:00+0100');
$I->assertEquals($ent['konec'], '2010-02-01T00:00:00+0100');
$I->assertEquals($ent['delovnaObveza'], 2);
$I->assertEquals($ent['izmenskoDelo'], true);
$I->assertEquals("XXX", $ent['delovnoMesto']);
$I->assertEquals($ent['individualnaPogodba'], true);
$I->assertEquals($ent['jeZaposlenVdrugemJz'], TRUE);
$I->assertEquals($ent['jeNastopajoci'], TRUE);
$I->assertEquals($ent['oseba']['id'], $this->lookOseba1['id']);
$I->assertEquals($ent['organizacijskaEnota'], $this->objOrgEnota1['id']);
/**
* še preverjanja avtorizacij, posebnih dovoljenj
*/
$entOs = $this->obj4;
$I->assertNotNull($entOs['oseba']);
/*
* uporabnik brez OsebniPodatki-read dovoljenja
*/
$I->amHttpAuthenticated(\IfiTest\AuthPage::$rudi, \IfiTest\AuthPage::$rudiPass);
$resp = $I->failToGet($this->restUrl, $entOs['id']);
codecept_debug($resp);
$I->assertEquals(100099, $resp[0][0]['code']);
/*
* uporabnik z OsebniPodatki-read dovoljenjem
*/
$I->amHttpAuthenticated(\IfiTest\AuthPage::$cene, \IfiTest\AuthPage::$cenePass);
$ent = $I->successfullyGet($this->restUrl, $entOs['id']);
}
示例9: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('get a list of all cards');
$I->amHttpAuthenticated('test_api', '123456');
$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendGET('/cards');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$[0].result');
示例10: read
/**
* Preberem pogodbo in preverim vsa polja
*
* @depends create
* @param ApiTester $I
*/
public function read(\ApiTester $I)
{
$ent = $I->successfullyGet($this->restUrl, $this->obj1['id']);
$I->assertNotEmpty($ent['id']);
$I->assertEquals($ent['sifra'], 'ZZ123');
$I->assertEquals($ent['vrednostVaj'], 33.33);
$I->assertEquals($ent['vrednostVaje'], 22.22);
$I->assertEquals($ent['vrednostPredstave'], 44.44);
$I->assertEquals($ent['vrednostVaje'], 22.22);
$I->assertEquals($ent['placiloNaVajo'], false);
$I->assertEquals($ent['planiranoSteviloVaj'], 10);
$I->assertEquals($ent['jeAvtorskePravice'], false, "jeAvtorskePravice");
$I->assertEquals($ent['opis'], 'xx');
$I->assertEquals($ent['oseba']['id'], $this->lookOseba1['id']);
$I->assertEquals($ent['popa']['id'], $this->lookPopa1['id']);
$I->assertEquals($ent['trr'], $this->objTrr['id']);
$I->assertEquals($ent['zacetek'], '2012-02-01T00:00:00+0100');
$I->assertEquals($ent['konec'], '2014-02-01T00:00:00+0100');
$I->assertEquals($ent['zaposlenVDrJz'], true, "zaposlen v drugem JZ");
$I->assertEquals($ent['samozaposlen'], FALSE, "samozaposlen");
$I->assertEquals($ent['igralec'], true, "igralec");
$I->assertEquals($ent['procentOdInkasa'], 5.1);
$I->assertEquals($ent['jeProcentOdInkasa'], true);
/**
* $$ še alternacije
*/
/**
* še preverjanja avtorizacij, posebnih dovoljenj
*/
$entOs = $this->obj4;
$I->assertNotNull($entOs['oseba']);
$I->assertNull($entOs['popa']);
$entPoOs = $this->obj8;
$I->assertNotNull($entPoOs['oseba']);
$I->assertNotNull($entPoOs['popa']);
/*
* uporabnik brez Pogodba-read dovoljenja
*/
$I->amHttpAuthenticated(\IfiTest\AuthPage::$breznik, \IfiTest\AuthPage::$breznikPass);
$resp = $I->failToGet($this->restUrl, $entOs['id']);
codecept_debug($resp);
$I->assertEquals(100099, $resp[0][0]['code']);
/*
* uporabnik brez OsebniPodatki-read dovoljenja
*/
$I->amHttpAuthenticated(\IfiTest\AuthPage::$rudi, \IfiTest\AuthPage::$rudiPass);
$resp = $I->failToGet($this->restUrl, $entOs['id']);
codecept_debug($resp);
$I->assertEquals(100099, $resp[0][0]['code']);
/*
* čim je od popa ni več osebni podatek
*/
$ent = $I->successfullyGet($this->restUrl, $entPoOs['id']);
/*
* uporabnik z OsebniPodatki-read dovoljenjem
*/
$I->amHttpAuthenticated(\IfiTest\AuthPage::$cene, \IfiTest\AuthPage::$cenePass);
$ent = $I->successfullyGet($this->restUrl, $entOs['id']);
}
示例11: dodajMapaAsserti
/**
* test Mapa-append assertov
*
* @depends kreirajPodMape
* @param ApiTester $I
*/
public function dodajMapaAsserti(\ApiTester $I)
{
/**
* assert po lastniku
*/
$I->amHttpAuthenticated(\IfiTest\AuthPage::$vihra, \IfiTest\AuthPage::$vihraPass);
$data = ['ime' => "assert lastnik vihra", 'javniDostop' => '', 'parent' => $this->pod5['id']];
$resp = $I->failToCreate($this->mapaUrl, $data);
codecept_debug($resp);
$I->assertEquals(1007008, $resp[0]['code']);
$data['parent'] = $this->pod6['id'];
//lastnik vihra
$m = $I->successfullyCreate($this->mapaUrl, $data);
/**
* assert po javnem dostopu
*/
$data = ['ime' => "assert javni dostop vihra", 'javniDostop' => '', 'parent' => $this->pod4['id']];
$resp = $I->failToCreate($this->mapaUrl, $data);
codecept_debug($resp);
$I->assertEquals(1007008, $resp[0]['code']);
/**
* spremenimo javni dostop bodoče parent mape
*/
$I->amHttpAuthenticated(\IfiTest\AuthPage::$admin, \IfiTest\AuthPage::$adminPass);
$mapa = $I->successfullyGet($this->mapaUrl, $this->pod4['id']);
$mapa['javniDostop'] = 'RWA';
$this->pod4 = $I->successfullyUpdate($this->mapaUrl, $mapa['id'], $mapa);
/**
* ponovimo isti dostop, da vidimo, če spremenjen dostop javni sedaj pomaga
*/
$I->amHttpAuthenticated(\IfiTest\AuthPage::$vihra, \IfiTest\AuthPage::$vihraPass);
$resp = $I->successfullyCreate($this->mapaUrl, $data);
/**
* assert po ACL-ju dostop po acl-ju
*/
$I->amHttpAuthenticated(\IfiTest\AuthPage::$vlado, \IfiTest\AuthPage::$vladoPass);
$data = ['ime' => "assert acl vlado", 'javniDostop' => '', 'parent' => $this->pod5['id']];
$resp = $I->failToCreate($this->mapaUrl, $data);
codecept_debug($resp);
$I->assertEquals(1007008, $resp[0]['code']);
/**
* dodamo acl za dovoljenje, ki ga ima tudi uporabnik
*/
$I->amHttpAuthenticated(\IfiTest\AuthPage::$admin, \IfiTest\AuthPage::$adminPass);
$dataAcl = ['mapa' => $this->pod5['id'], 'perm' => $this->lookPermission2['id'], 'dostop' => 'RAW'];
$mapaAcl = $I->successfullyCreate($this->aclUrl, $dataAcl);
/**
* ponovimo poskus kreiranja, sedaj ko ima parent mapa dodan acl
*/
$m = $I->successfullyCreate($this->mapaUrl, $data);
}