當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DAOFactory::getDao方法代碼示例

本文整理匯總了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);
 }
開發者ID:ngugijames,項目名稱:ThinkUp,代碼行數:11,代碼來源:WebTestOfLogin.php

示例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);
 }
開發者ID:dgw,項目名稱:ThinkUp,代碼行數:17,代碼來源:WebTestOfLogin.php

示例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\\./");
 }
開發者ID:ngugijames,項目名稱:ThinkUp,代碼行數:42,代碼來源:WebTestOfDeleteInstance.php

示例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);
 }
開發者ID:ngugijames,項目名稱:ThinkUp,代碼行數:22,代碼來源:WebTestOfLogout.php


注:本文中的DAOFactory::getDao方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。