本文整理汇总了PHP中UnitTester::haveRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP UnitTester::haveRecord方法的具体用法?PHP UnitTester::haveRecord怎么用?PHP UnitTester::haveRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitTester
的用法示例。
在下文中一共展示了UnitTester::haveRecord方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRoleCanBeDeleted
public function testRoleCanBeDeleted()
{
$id = $this->tester->haveRecord('roles', ['role_name' => 'user']);
$role = \ChopBox\Role::find($id);
$role->delete();
$this->tester->dontSeeRecord('roles', ['role_name' => 'user']);
}
示例2: createPlantWithColorForTest
/**
* @return mixed
*/
public function createPlantWithColorForTest()
{
$plantID = $this->tester->haveRecord('plants', ['name' => 'test plant']);
$colorArray = array("red" => "red", "yellow" => "yellow", "blue" => NULL, "green" => NULL, "brown" => NULL, "black" => NULL, "white" => NULL, "purple" => NULL, "orange" => NULL);
$this->UUT->set($plantID, $colorArray);
return $plantID;
}
示例3: testGetDocuments
public function testGetDocuments()
{
Document::deleteAll();
$this->specify("Attachment must be exist", function () {
$numberId = $this->tester->haveRecord(Number::className(), ['number' => '9999999999']);
$model = $this->tester->grabRecord(Number::className(), ['_id' => $numberId]);
$model->attachDocument(\Yii::getAlias('@data') . '/file1.jpg');
$model->attachDocument(\Yii::getAlias('@data') . '/file2.pdf');
expect(count($model->documents))->equals(2);
foreach ($model->documents as $document) {
expect($document instanceof Document)->true();
expect($document->ownerId)->equals($model->getPrimaryKey());
}
});
}
示例4: createUser
private function createUser()
{
$user_id = $this->tester->haveRecord('users', ['username' => 'johndoe', 'password' => 'password', 'email' => 'johndoe@johndoe.com', 'profile_state' => 0]);
return $user_id;
}
示例5: createRole
private function createRole()
{
$id = $this->tester->haveRecord('roles', ['role_name' => 'user']);
return $id;
}
示例6: testCreationNewPermission
public function testCreationNewPermission()
{
$this->tester->haveRecord('permissions', ['name' => 'do-smth', 'default' => false]);
}