本文整理汇总了PHP中DAOFactory::getDao方法的典型用法代码示例。如果您正苦于以下问题:PHP DAOFactory::getDao方法的具体用法?PHP DAOFactory::getDao怎么用?PHP DAOFactory::getDao使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DAOFactory
的用法示例。
在下文中一共展示了DAOFactory::getDao方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLoginByCookie
public function testLoginByCookie()
{
$email = 'me@example.com';
$cookie_dao = DAOFactory::getDao('CookieDAO');
$cookie = $cookie_dao->generateForEmail($email);
$this->get($this->url . '/index.php');
$this->assertNoText($email);
$this->getBrowser()->setCookie(Session::COOKIE_NAME, $cookie);
$this->get($this->url . '/index.php');
$this->assertText($email);
}
示例2: testLoginSuccessAndPrivateDashboard
public function testLoginSuccessAndPrivateDashboard()
{
$email = 'me@example.com';
$cookie_dao = DAOFactory::getDao('CookieDAO');
$deleted = $cookie_dao->deleteByEmail($email);
$this->assertFalse($deleted);
$this->get($this->url . '/session/login.php');
$this->setField('email', $email);
$this->setField('pwd', 'secretpassword');
$this->click("Log In");
$this->get($this->url . '/dashboard.php');
$this->assertTitle("thinkupapp's Dashboard | " . Config::getInstance()->getValue('app_title_prefix') . "ThinkUp");
$this->assertText('Logged in as admin: ' . $email);
$cookie = $this->getBrowser()->getCurrentCookieValue(Session::COOKIE_NAME);
$deleted = $cookie_dao->deleteByEmail($email);
$this->assertTrue($deleted);
}
示例3: testDeleteInstance
public function testDeleteInstance()
{
$email = 'me@example.com';
$cookie_dao = DAOFactory::getDao('CookieDAO');
$cookie = $cookie_dao->generateForEmail($email);
$this->get($this->url . '/index.php');
$this->assertNoText($email);
$this->getBrowser()->setCookie(Session::COOKIE_NAME, $cookie);
$this->get($this->url . '/index.php');
$this->assertText($email);
$this->click("Settings");
$this->get($this->url . '/account/index.php?p=twitter#manage_plugin');
$this->assertLink('@ev');
$this->assertLink('@thinkupapp');
$this->assertLink('@linkbaiter');
$this->assertLink('@shutterbug');
$this->assertPattern('/Remove an account/');
//delete existing instance
$this->post($this->url . '/account/index.php?p=twitter', array('action' => 'Delete', 'instance_id' => '3', 'csrf_token' => self::TEST_CSRF_TOKEN));
$this->assertPattern("/Account deleted\\./");
$this->assertLink('@thinkupapp');
$this->assertLink('@linkbaiter');
$this->assertNoLink('@shutterbug');
$this->assertPattern('/Remove an account/');
//delete non-existent instance
$this->post($this->url . '/account/index.php?p=twitter', array('action' => 'Delete', 'instance_id' => '231', 'csrf_token' => self::TEST_CSRF_TOKEN));
$this->assertPattern("/Could not find that account\\./");
$this->assertLink('@thinkupapp');
$this->assertLink('@linkbaiter');
$this->assertPattern('/Remove an account/');
$this->click('Log out');
// $this->assertText('You have successfully logged out');
// $this->showSource();
$this->assertText("Log in");
$this->get($this->url . '/session/login.php');
$this->setField('email', 'me2@example.com');
$this->setField('pwd', 'secretpassword');
$this->click("Log In");
//delete instance with no privileges
$this->post($this->url . '/account/index.php?p=twitter', array('action' => 'Delete', 'instance_id' => '2', 'csrf_token' => self::TEST_CSRF_TOKEN));
$this->assertPattern("/Insufficient privileges\\./");
}
示例4: testLogout
public function testLogout()
{
$email = 'me@example.com';
$cookie_dao = DAOFactory::getDao('CookieDAO');
$deleted = $cookie_dao->deleteByEmail($email);
$this->assertFalse($deleted);
$this->get($this->url . '/session/login.php');
$this->setField('email', $email);
$this->setField('pwd', 'secretpassword');
$this->click("Log In");
$this->get($this->url . '/index.php');
$this->assertTitle(Config::getInstance()->getValue('app_title_prefix') . "ThinkUp");
$this->assertText($email);
$cookie = $this->getBrowser()->getCurrentCookieValue(Session::COOKIE_NAME);
$this->get($this->url . '/session/logout.php');
$cookie = $this->getBrowser()->getCurrentCookieValue(Session::COOKIE_NAME);
$this->assertEqual('deleted', $cookie);
$this->get($this->url . '/index.php');
$this->assertNoText($email);
$deleted = $cookie_dao->deleteByEmail($email);
$this->assertFalse($deleted);
}