本文整理汇总了PHP中UnitTester::dontSeeInDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP UnitTester::dontSeeInDatabase方法的具体用法?PHP UnitTester::dontSeeInDatabase怎么用?PHP UnitTester::dontSeeInDatabase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitTester
的用法示例。
在下文中一共展示了UnitTester::dontSeeInDatabase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLiking
public function testLiking()
{
$idUser1 = 1;
$idUser2 = 2;
$idUser3 = 3;
$idUser4 = 4;
$photoidUser1 = 1;
$photoidUser2 = 4;
$photoidUser3 = 8;
$photoidUser4 = 11;
// User should be able to like photos they don't own
list($result_code, $result) = User::likePhoto($idUser1, $photoidUser2);
$this->assertEquals(200, $result_code);
$this->assertTrue($result['success'] == true);
$this->assertTrue($result['likes'] == true);
$this->tester->seeInDatabase('UserPhotoLikes', ['userid' => $idUser1, 'photoid' => $photoidUser2]);
// User should be able to unlike photos they don't own
list($result_code, $result) = User::likePhoto($idUser1, $photoidUser2);
$this->assertEquals(200, $result_code);
$this->assertTrue($result['success'] == true);
$this->assertTrue($result['likes'] == false);
$this->tester->dontSeeInDatabase('UserPhotoLikes', ['userid' => $idUser1, 'photoid' => $photoidUser2]);
// User should not be be able to like photos they own
list($result_code, $result) = User::likePhoto($idUser1, $photoidUser1);
$this->assertEquals(403, $result_code);
$this->assertTrue($result['success'] == false);
$this->tester->dontSeeInDatabase('UserPhotoLikes', ['userid' => $idUser1, 'photoid' => $photoidUser1]);
// User should not be be able to like photos that don't exist
list($result_code, $result) = User::likePhoto($idUser1, 0);
$this->assertEquals(404, $result_code);
$this->assertTrue($result['success'] == false);
$this->tester->dontSeeInDatabase('UserPhotoLikes', ['userid' => $idUser1, 'photoid' => 0]);
}
示例2: testDeleteUser
public function testDeleteUser()
{
$this->userRegister();
$return = $this->ucenter->uc_user_delete(1);
$this->assertEquals(4, $return);
$this->tester->dontSeeInDatabase('uc_members', ['username' => $this->username, 'email' => $this->email]);
}
示例3: testTokenCreateDisableDelete
/**
* tests token CRUD operations
* @throws CDbException
*/
public function testTokenCreateDisableDelete()
{
$model = new VkAuthToken();
// no attributes
$this->assertFalse($model->save());
// ticket not found
$model->attributes = ['auth_ticket' => -1, 'ip' => '127.0.0.1', 'access_token' => sha1(rand()), 'expires_in' => time() + 3600, 'user_id' => 1];
$this->assertFalse($model->save());
// create
$ticket = new VkAuthTicket();
$ticket->save();
$ticket->saveAttributes(['ip' => '127.0.0.1']);
$model->attributes = ['auth_ticket' => $ticket->ticket, 'ip' => '127.0.0.1', 'access_token' => sha1(rand()), 'expires_in' => time() + 3600, 'user_id' => 1];
$this->assertTrue($model->save());
$this->tester->seeInDatabase('vk_auth_token', ['ticket_id' => $model->ticket_id, 'access_token' => $model->access_token]);
// ticket relation
$this->assertTrue($model->ticket instanceof VkAuthTicket);
// disable
$this->assertTrue($model->disable());
$this->tester->seeInDatabase('vk_auth_token', ['ticket_id' => $model->ticket_id, 'access_token' => $model->access_token, 'status' => VkAuthToken::STATUS_DISABLED]);
// delete soft
$this->assertTrue($model->delete());
$this->tester->seeInDatabase('vk_auth_token', ['ticket_id' => $model->ticket_id, 'access_token' => $model->access_token, 'status' => VkAuthToken::STATUS_DELETED]);
// delete hard
$this->assertTrue($model->delete(true));
$ticket->delete(true);
$this->tester->dontSeeInDatabase('vk_auth_token', ['id' => $model->id]);
}