本文整理匯總了PHP中UnitTester::seeInRepository方法的典型用法代碼示例。如果您正苦於以下問題:PHP UnitTester::seeInRepository方法的具體用法?PHP UnitTester::seeInRepository怎麽用?PHP UnitTester::seeInRepository使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnitTester
的用法示例。
在下文中一共展示了UnitTester::seeInRepository方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testUserNameCanBeChanged
public function testUserNameCanBeChanged()
{
$date_1 = new DateTime('2000-01-01');
$date_2 = new DateTime('2011-01-01');
// create a user from framework, user will be deleted after the test
$user = $this->tester->haveInRepository('unBundle\\Entity\\Users', ['displayname' => 'Miles', 'username' => 'miles', 'email' => 'u.nitsche@gmail.com', 'algorithm' => 1, 'password' => 'Uasdfasdfasdfw23', 'salt' => 'asdfsadf234', 'avatar' => 1, 'verified' => 1, 'created' => $date_1, 'updated' => $date_2, 'roles' => 1]);
// get entity manager by accessing module
$em = $this->getModule('Doctrine2')->em;
// get real user
$user = $em->find('unBundle\\Entity\\Users', $user);
$user->setUsername('bill');
$user->setDisplayName('Haha');
$em->persist($user);
$em->flush();
$this->assertEquals('bill', $user->getUserName());
// verify data was saved using framework methods
$this->tester->seeInRepository('unBundle\\Entity\\Users', ['username' => 'bill']);
$this->tester->dontSeeInRepository('unBundle\\Entity\\Users', ['username' => 'miles']);
}