public static function signIn($userName, $password, $rememberMe = false, $md5 = true) { $retVal = false; // set ZendX_Doctrine_Auth_Adapter $auth = Zend_Auth::getInstance(); $authAdapter = new ZendX_Doctrine_Auth_Adapter(Doctrine::getConnectionByTableName('Model_Entity_User')); $password = $md5 ? md5($password) : $password; $authAdapter->setTableName('Model_Entity_User u')->setIdentityColumn('userName')->setCredentialColumn('password')->setCredentialTreatment('? AND active = 1')->setIdentity($userName)->setCredential($password); // set Zend_Auth $result = $auth->authenticate($authAdapter); // Check Auth Validation if ($result->isValid()) { // Remove some fields which are secure! $omitColumns = array('password', 'activationKey', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by'); $identity = $authAdapter->getResultRowObject(null, $omitColumns); $identity->roles = Kebab_Model_User::getUserRoles($identity->id); $identity->acl = new Kebab_Access_Acl(); $identity->stories = Kebab_Model_Story::getUserStoriesName($identity->roles); $auth->getStorage()->write($identity); if ($rememberMe) { Zend_Session::rememberMe(604800); } $retVal = true; } return $retVal; }
public function postSave($evt = null) { Doctrine::getConnectionByTableName($this->getTable()->getTableName())->setAttribute(Doctrine_Core::ATTR_HYDRATE_OVERWRITE, false); // we do not want to refresh our records $this->updateLuceneIndex(); Doctrine::getConnectionByTableName($this->getTable()->getTableName())->setAttribute(Doctrine_Core::ATTR_HYDRATE_OVERWRITE, true); }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { sfContext::createInstance($this->configuration); $displayName = $this->ask("Enter a minyan display name (Darchei Noam Glenbrook)"); $identifier = $this->ask("Enter minyan identifier (dng)"); $email = $this->ask("Enter username for minyan admin"); $user = Doctrine::getTable('SfGuardUser')->findOneByUsername(trim(strtolower($email))); if (!$user) { throw new Exception("User with email {$email} does not exist"); } try { $con = Doctrine::getConnectionByTableName("SfGuardUser"); $con->beginTransaction(); $minyan = new Minyan(); $minyan->setName($displayName); $minyan->setIdentifier(Utils::formatPermalink($identifier)); $minyan->save(); $minyanUser = new MinyanUser(); $minyanUser->setIsAdmin(true); $minyanUser->setUserId($user->getId()); $minyanUser->setMinyanId($minyan->getId()); $minyanUser->save(); $this->logSection('mam', "Minyan {$identifier} created successfully!"); $con->commit(); } catch (Exception $e) { $con->rollback(); throw $e; } }
public function preSave($evt = null) { Doctrine::getConnectionByTableName($this->getTable()->getTableName())->setAttribute(Doctrine_Core::ATTR_HYDRATE_OVERWRITE, false); // we do not want to refresh our records $this->updateSlug(); Doctrine::getConnectionByTableName($this->getTable()->getTableName())->setAttribute(Doctrine_Core::ATTR_HYDRATE_OVERWRITE, true); return parent::preSave($evt); }
public function executeAddNewSubscriber(sfWebRequest $request) { $this->minyan = Utils::extractDomainObjectFromRequest($request, 'Minyan', 'minyanId', true); $this->form = new SignupForm(); unset($this->form['password']); if ($request->isMethod('post')) { $this->form->bind($request->getParameter('signup')); if ($this->form->isValid()) { $fields = $this->form->getValues(); $con = Doctrine::getConnectionByTableName('SfGuardUser'); try { $con->beginTransaction(); $this->logMessage("Executing signup for new user for minyan {$this->minyan->getName()}: {$fields['email']}", 'notice'); $sgu = new SfGuardUser(); $sgu->setFirstName($fields['first_name']); $sgu->setLastName($fields['last_name']); $sgu->setUsername($fields['email']); $sgu->setEmailAddress($fields['email']); $sgu->setPhone($fields['phone']); $sgu->setPassword(sfConfig::get('app_temp_password')); $sgu->setIsActive(true); $sgu->save(); $contactMethods = $request->getParameter('contact_method'); foreach ($contactMethods as $name => $method) { $contactMethods[$name] = Utils::toBoolean($method); } $minyanUser = new MinyanUser(); $minyanUser->setMinyanId($this->minyan->getId()); $minyanUser->setUserId($sgu->getId()); $minyanUser->setUsePhone($contactMethods['phone']); $minyanUser->setUseSms($contactMethods['text']); $minyanUser->setUseEmail($contactMethods['email']); $minyanUser->save(); $con->commit(); } catch (Exception $e) { $con->rollback(); $this->logMessage("Problem when signing up user {$fields['email']}: {$e->getMessage()}", 'notice'); throw $e; } MAMUtils::sendInternalEmail("New Make a Minyan User Alert for minyan {$this->minyan->getName()}! - {$sgu->getFullName()}", ""); //send email $options = array(); $options['template'] = 'welcomeToMinyan'; $options['subject'] = 'Welcome!'; $options['minyan'] = $this->minyan; $options['user'] = $sgu; $options['minyanUser'] = $minyanUser; $options['first_name'] = $sgu->getFirstName(); $options['to'] = $sgu->getUsername(); EmailUtils::send($options); $this->logMessage('Welcome email sent to ' . $sgu->getUsername(), 'notice'); $this->getUser()->setFlash('subscribersSuccess', 'Added ' . $sgu->getUsername() . ' successfully!'); echo Utils::ajaxResponse(true, $this->minyan->getId()); return sfView::NONE; } } }
private static function getScheduleBirthMember(array $months, $day = null, $is_setKeydate = true) { $memberId = self::getMyId(); if (is_null(self::$birth_prof_id)) { $profile = Doctrine::getTable('Profile')->createQuery()->select('id')->where('name = ?', 'op_preset_birthday')->fetchOne(array(), Doctrine::HYDRATE_NONE); if (!$profile) { return array(); } self::$birth_prof_id = $profile[0]; } if (is_null(self::$friendIds)) { self::$friendIds = Doctrine::getTable('MemberRelationship')->getFriendMemberIds($memberId); self::$friendIds[] = $memberId; } $q = Doctrine::getTable('MemberProfile')->createQuery()->select('member_id, value_datetime, public_flag')->where('profile_id = ?', self::$birth_prof_id)->andWhereIn('member_id', self::$friendIds); $driverName = Doctrine::getConnectionByTableName('MemberProfile')->getDriverName(); foreach ($months as $month) { $targetDate = $day ? sprintf('%02d-%02d', (int) $month, (int) $day) : sprintf('%02d', (int) $month); if ($driverName === 'Sqlite') { $targetValue = array($day ? '%m-%d' : '%m', $targetDate); $q->andWhere('strftime(?, value_datetime) = ?', $targetValue); } else { if ($driverName === 'Pgsql') { $targetValue = array($day ? 'MM-DD' : 'MM', $targetDate); $q->andWhere('to_char(value_datetime, ?) = ?', $targetValue); } else { $targetValue = array($day ? '%m-%d' : '%m', $targetDate); $q->andWhere('DATE_FORMAT(value_datetime, ?) = ?', $targetValue); } } } $birthResults = $q->execute(array(), Doctrine::HYDRATE_NONE); if (!count($birthResults)) { return array(); } $results = array(); foreach ($birthResults as $birthResult) { if ($memberId != $birthResult[0] && ProfileTable::PUBLIC_FLAG_PRIVATE == $birthResult[2]) { continue; } $member = Doctrine::getTable('Member')->find($birthResult[0]); if ($is_setKeydate) { $results[substr($birthResult[1], 5, 5)][] = $member; } else { $results[] = $member; } } return $results; }
public static function setLogin($username = '', $pasword = '') { $authAdapter = new Zend_Auth_Adapter_Doctrine_Table(Doctrine::getConnectionByTableName('Members')); $authAdapter->setTableName('Members')->setIdentityColumn('username')->setCredentialColumn('password')->setCredentialTreatment('md5(?)')->setIdentity($username)->setCredential($pasword); $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($authAdapter); if ($result->isValid()) { $data = $authAdapter->getResultRowObject('username', 'password'); $auth->getStorage()->write($data); $Member = Members::getByUsername($auth->getIdentity()->username); $Member->log('Signed in', 'Members'); return $Member; } else { return false; } }
/** * Create a user for a Facebook account * * Based on and borrowed heavily from * sfFacebookGuardAdapter::createSfGuardUserWithFacebookUidAndCon in * sfFacebookConnectPlugin by Fabrice Bernhard * * @param int $facebookUid * @param string $accessToken * @param int $accessTokenExpiry * @param array $facebookUserInfo * @return sfGuardUser */ public static function createUser($facebookUid, $accessToken, $accessTokenExpiry, array $facebookUserInfo) { $sfGuardUser = new sfGuardUser(); $sfGuardUser->setUsername(self::generateFacebookUsername($facebookUid)); $connection = Doctrine::getConnectionByTableName('sfGuardUser'); try { $connection->beginTransaction(); $sfGuardUser->save(); $sfGuardUser->getProfile()->setFacebookOnlyAccount(true)->_connectToFacebook($facebookUid, $accessToken, $accessTokenExpiry, $facebookUserInfo, $sfGuardUser); $connection->commit(); } catch (Exception $e) { $connection->rollback(); throw $e; } return $sfGuardUser; }
/** * Executes index action * * @param sfRequest $request A request object */ public function executeIndex(sfWebRequest $request) { $this->form = new SignupForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter('signup')); if ($this->form->isValid()) { $fields = $this->form->getValues(); $con = Doctrine::getConnectionByTableName('SfGuardUser'); try { $con->beginTransaction(); $this->logMessage("Executing signup for new user: {$fields['email']}", 'notice'); $sgu = new SfGuardUser(); $sgu->setFirstName($fields['first_name']); $sgu->setLastName($fields['last_name']); $sgu->setUsername($fields['email']); $sgu->setEmailAddress($fields['email']); $sgu->setPhone($fields['phone']); $sgu->setPassword($fields['password']); $sgu->setIsActive(true); $sgu->save(); $con->commit(); } catch (Exception $e) { $con->rollback(); $this->logMessage("Problem when signing up user {$fields['email']}: {$e->getMessage()}", 'notice'); throw $e; } MAMUtils::sendInternalEmail("New Make a Minyan User Alert! - {$sgu->getFullName()}, Plan: {$this->plan['name']}", ""); //send email $options = array(); $options['template'] = 'welcome'; $options['subject'] = 'Welcome!'; $options['first_name'] = $sgu->getFirstName(); $options['to'] = $sgu->getUsername(); EmailUtils::send($options); $this->logMessage('Welcome email sent to ' . $sgu->getUsername(), 'notice'); $this->redirect('signup/thanks'); } } }
<?php $app = 'frontend'; include dirname(__FILE__) . '/../../../../test/bootstrap/functional.php'; include $configuration->getSymfonyLibDir() . '/vendor/lime/lime.php'; $databaseManager = new sfDatabaseManager($configuration); $con = Doctrine::getConnectionByTableName('sfAsset'); $con->beginTransaction(); try { // prepare test environment sfAssetFolderTable::getInstance()->createQuery()->delete()->execute(); sfAssetTable::getInstance()->createQuery()->delete()->execute(); sfConfig::set('app_sfAssetsLibrary_upload_dir', 'mediaTEST'); $root = new sfAssetFolder(); $root->setName(sfConfig::get('app_sfAssetsLibrary_upload_dir')); $tree = sfAssetFolderTable::getInstance()->getTree(); $tree->createRoot($root); $root->save(); // run the tests $t = new lime_test(23, array('options' => new lime_output_color(), 'error_reporting' => true)); $t->diag('sfAsset'); $sfAsset = new sfAsset(); $sfAsset->setFolder($root); $t->isa_ok($sfAsset->getFolder(), 'sfAssetFolder', 'sfAsset can have root as folder'); $sfAsset->setFilename('filename.jpg'); $t->diag('sfAsset::getRelativePath()'); $t->is($sfAsset->getRelativePath(), sfConfig::get('app_sfAssetsLibrary_upload_dir') . DIRECTORY_SEPARATOR . 'filename.jpg', 'getRelativePath() returns the path relative to the media directory'); $t->diag('sfAsset::getFullPath()'); $t->is($sfAsset->getFullPath(), sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . sfConfig::get('app_sfAssetsLibrary_upload_dir') . DIRECTORY_SEPARATOR . 'filename.jpg', 'getFullPath() returns the complete asset path on the disk'); $t->is($sfAsset->getFullPath('small'), sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . sfConfig::get('app_sfAssetsLibrary_upload_dir') . DIRECTORY_SEPARATOR . 'thumbnail' . DIRECTORY_SEPARATOR . 'small_filename.jpg', 'getFullPath(\'small\') returns the complete small thumbnail path on the disk'); $t->is($sfAsset->getFullPath('large'), sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . sfConfig::get('app_sfAssetsLibrary_upload_dir') . DIRECTORY_SEPARATOR . 'thumbnail' . DIRECTORY_SEPARATOR . 'large_filename.jpg', 'getFullPath(\'large\') returns the complete large thumbnail path on the disk');
<?php $app = 'frontend'; include dirname(__FILE__) . '/../bootstrap/functional.php'; new sfDatabaseManager($configuration); $task = new sfDoctrineBuildTask($configuration->getEventDispatcher(), new sfFormatter()); $task->run(array(), array('sql', 'db', 'and-load', 'no-confirmation', 'application' => $app)); $conn = Doctrine::getConnectionByTableName('Author'); $conn->beginTransaction(); $browser = new sfTestFunctional(new sfBrowser()); $browser->test()->info('Updating first author'); $firstAuthor = Doctrine::getTable('Author')->findOneBySlug('niko'); $browser->get('/author/' . $firstAuthor->slug . '/view')->with('response')->begin()->checkElement('h1', '/niko/')->checkElement('ul#comments li', 1)->end()->with('view_cache')->begin()->isCached(true, false)->end(); $browser->getContext(true)->switchTo('backend'); $firstAuthor->name = 'n1k0'; $firstAuthor->save($conn); $browser->get('/author/' . $firstAuthor->slug . '/view')->with('response')->begin()->checkElement('h1', '/n1k0/')->checkElement('ul#comments li', 1)->end()->with('view_cache')->begin()->isCached(true, false)->end(); $conn->rollback();
<?php $app = 'frontend'; include dirname(__FILE__) . '/../bootstrap/functional.php'; new sfDatabaseManager($configuration); $task = new sfDoctrineBuildTask($configuration->getEventDispatcher(), new sfFormatter()); $task->run(array(), array('sql', 'db', 'and-load', 'no-confirmation', 'application' => $app)); $conn = Doctrine::getConnectionByTableName('Article'); $conn->beginTransaction(); $browser = new sfTestFunctional(new sfBrowser()); $browser->get('/en/articles')->with('request')->begin()->isParameter('module', 'content')->isParameter('action', 'index')->isParameter('sf_culture', 'en')->end()->with('response')->begin()->checkElement('h1', '/Articles/')->checkElement('ul li', 2)->checkElement('ul li', '/My first article/')->checkElement('ul li', '/My second article/', array('position' => 1))->end()->with('view_cache')->begin()->isCached(true, false)->end()->click('My first article')->with('response')->begin()->checkElement('h1', '/My first article/')->checkElement('ul#comments li', 2)->end()->with('view_cache')->begin()->isCached(true, false)->end(); $browser->test()->info('Updating first article with php code - cache invalidation is disabled on frontend'); $firstArticle = Doctrine::getTable('Article')->doSelectForSlug(array('slug' => 'my-first-article')); $firstArticle->title = 'My first article, cache invalidation is disabled'; $firstArticle->save($conn); $browser->get('/en/articles')->with('response')->begin()->checkElement('h1', '/Articles/')->checkElement('ul li', 2)->checkElement('ul li', '/My first article/')->checkElement('ul li:contains("cache invalidation is disabled")', false)->end()->with('view_cache')->begin()->isCached(true, false)->end(); $browser->test()->info('Updating first article with php code - switch to backend'); sfContext::switchTo('backend'); $firstArticle = Doctrine::getTable('Article')->doSelectForSlug(array('slug' => 'my-first-article')); $firstArticle->title = 'My first article, modified'; $firstArticle->save($conn); sfContext::switchTo('frontend'); $browser->get('/en/articles')->with('response')->begin()->checkElement('h1', '/Articles/')->checkElement('ul li', 2)->checkElement('ul li', '/My first article, modified/')->checkElement('ul li', '/My second article/', array('position' => 1))->end()->with('view_cache')->begin()->isCached(true, false)->end()->click('My first article, modified')->with('response')->begin()->checkElement('h1', '/My first article, modified/')->checkElement('ul#comments li', 2)->end()->with('view_cache')->begin()->isCached(true, false)->end(); $browser->test()->info('Updating first article from another app (with caching system disabled) - switch to backend'); sfContext::switchTo('backend'); $configuration->loadHelpers('Partial'); $backendBrowser = new sfTestFunctional(new sfBrowser()); $backendBrowser->get('/article/1/edit')->with('request')->begin()->isParameter('module', 'article')->isParameter('action', 'edit')->end()->setField('article[en][title]', 'My first article, edited')->click('Save')->followRedirect()->with('response')->begin()->checkElement('div.notice', 1)->end(); $browser->get('/en/article/' . $firstArticle->slug . '/view')->with('response')->begin()->checkElement('h1', '/My first article, edited/')->checkElement('ul#comments li', 2)->end()->with('view_cache')->begin()->isCached(true, false)->end(); $conn->rollback();
/** * Function for doing get Authentication of given user's values. */ protected function _getAuthAdapter($values) { $authAdapter = new ZendX_Doctrine_Auth_Adapter(Doctrine::getConnectionByTableName('Model_Users')); $encryptedPassword = MD5($values['password']); $authAdapter->setTableName('Model_Users u')->setIdentityColumn('u.email')->setCredentialColumn('u.password')->setIdentity($values['email'])->setCredential($encryptedPassword); return $authAdapter; }
<?php /** * @author * @package sfGurardLoginAttempt * @subpackage unit test * @version $Id$ */ include dirname(__FILE__) . '/../bootstrap/bootstrap.php'; $databaseManager = new sfDatabaseManager($configuration); $conn = Doctrine::getConnectionByTableName('sfGuardLoginAttempt'); $t = new lime_test(); // display some current settings: $t->info("login_attempts: " . sfConfig::get('app_sf_guard_extra_plugin_login_attempts')); $t->info("lock_for: " . sfConfig::get('app_sf_guard_extra_plugin_lock_for') . " seconds"); $t->info("lock_timeout: " . sfConfig::get('app_sf_guard_extra_plugin_lock_timeout') . " seconds"); $t->is(false, Doctrine::getTable('sfGuardLoginAttempt')->isLockedOut('127.0.0.1'), "->isLockedOut()"); addFailedLogin(); $t->is(false, Doctrine::getTable('sfGuardLoginAttempt')->isLockedOut('127.0.0.1'), "->isLockedOut() after 1 failed login"); // oh no, someone hammered the web site! ;p for ($i = 0; $i < 10; $i++) { addFailedLogin(); } //$t->comment("Account locked until: ".Doctrine::getTable('sfGuardLoginAttempt')->isLockedOut('127.0.0.1')); $t->is(true, Doctrine::getTable('sfGuardLoginAttempt')->isLockedOut('127.0.0.1'), "->isLockedOut() after plus 10 failed logins"); /** * Function used to add a failed login to the database */ function addFailedLogin() { $tmp = new sfGuardLoginAttempt();
public function testGetConnectionByTableName() { $connectionBefore = Doctrine::getConnectionByTableName('entity'); Doctrine_Manager::connection('sqlite::memory:', 'test_memory'); Doctrine_Manager::getInstance()->bindComponent('Entity', 'test_memory'); $connectionAfter = Doctrine::getConnectionByTableName('entity'); $this->assertEqual($connectionAfter->getName(), 'test_memory'); Doctrine_Manager::getInstance()->bindComponent('Entity', $connectionBefore->getName()); $connectionAfter = Doctrine::getConnectionByTableName('entity'); $this->assertEqual($connectionBefore->getName(), $connectionAfter->getName()); }
/** * getConnection * * @param string $tableName * @return void */ public function getConnection($tableName) { return Doctrine::getConnectionByTableName($tableName); }
/** * Creates an empty sfGuardUser with profile field Facebook UID set * * @param Integer $facebook_uid * @return sfGuardUser * @author fabriceb * @since 2009-08-11 */ public function createSfGuardUserWithFacebookUid($facebook_uid) { $con = Doctrine::getConnectionByTableName('sfGuardUser'); return parent::createSfGuardUserWithFacebookUidAndCon($facebook_uid, $con); }
$con->beginTransaction(); $sfGuardUser->save(); $sfGuardUser->getProfile()->save(); $con->commit(); $t->is(sfFacebook::getGuardAdapter()->getSfGuardUserByFacebookUid(9999999999.0)->getUsername(), 'test'); } catch (Exception $e) { $con->rollback(); throw $e; } $sfGuardUser->delete(); $t->diag('sfFacebook::getGuardAdapter()->getSfGuardUserByEmailHashes Test'); $sfGuardUser = new sfGuardUser(); $sfGuardUser->setUsername('test'); sfFacebook::getGuardAdapter()->setUserProfileProperty($sfGuardUser, 'email_hash', sfFacebookConnect::getEmailHash('*****@*****.**')); try { $con = Doctrine::getConnectionByTableName('sfGuardUser'); $con->beginTransaction(); $sfGuardUser->save(); $sfGuardUser->getProfile()->save(); $con->commit(); $t->is(sfFacebook::getGuardAdapter()->getSfGuardUserByEmailHashes(array('trucmuche', sfFacebookConnect::getEmailHash('*****@*****.**')))->getUsername(), 'test'); } catch (Exception $e) { $con->rollback(); throw $e; } $sfGuardUser->delete(); $t->diag('sfFacebook::getGuardAdapter()->createSfGuardUserWithFacebookUid Test'); sfFacebook::getGuardAdapter()->createSfGuardUserWithFacebookUid(9999999999.0); $sfGuardUser = sfFacebook::getGuardAdapter()->getSfGuardUserByFacebookUid(9999999999.0); $t->is($sfGuardUser->getUsername(), 'Facebook_9999999999'); $sfGuardUser->delete();
/** * getConnection() - get the connection to the database * * @return Doctrine_Connection|null */ public function getConnection() { if (null === $this->_conn && null !== $this->_tableName) { $this->_conn = Doctrine::getConnectionByTableName($this->_tableName); } return $this->_conn; }
public function call($uri, $method = 'get', $parameters = array(), $changeStack = true) { $conn = Doctrine::getConnectionByTableName('sf_guard_user'); $conn->clear(); return parent::call($uri, $method, $parameters, $changeStack); }
<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfTestFunctional(new sfBrowser()); $test = $browser->test(); $conn = Doctrine::getConnectionByTableName('location'); $conn->beginTransaction(); $browser->get('/')->info('1 - homepage')->with('request')->begin()->isParameter('module', 'collector')->isParameter('action', 'locations')->end()->with('response')->begin()->isStatusCode(200)->end(); $browser->get('/data')->info('1.1 - locations data')->with('request')->begin()->isParameter('module', 'collector')->isParameter('action', 'data')->end()->with('response')->begin()->isStatusCode(200)->end(); $browser->info('2 - main links')->get('/')->info('2.1 - profits')->click("Отчёты")->with('request')->begin()->isParameter('module', 'profit')->isParameter('action', 'list')->end()->with('response')->begin()->isStatusCode(200)->end(); $browser->info('2 - main linkчёs')->get('/')->info('2.2 - talks')->click("Обсуждения")->with('request')->begin()->isParameter('module', 'talk')->isParameter('action', 'list')->end()->with('response')->begin()->isStatusCode(200)->end(); $browser->info('2 - main links')->get('/')->info('2.3 - events')->click("События")->with('request')->begin()->isParameter('module', 'event')->isParameter('action', 'list')->end()->with('response')->begin()->isStatusCode(200)->end(); //@todo: make submit check //$browser-> // info('2 - main links')-> // get('/')-> // info('2.4 - search')-> // click("Поиск")-> // with('request')->begin()-> // isParameter('module', 'location')-> // isParameter('action', 'search')-> // end()-> // with('response')->begin()-> // isStatusCode(200)-> // end() //; $browser->info('2 - main links')->get('/')->info('2.5 - signin')->click("Вход")->with('request')->begin()->isParameter('module', 'sfGuardAuth')->isParameter('action', 'signin')->end()->with('response')->begin()->isStatusCode(401)->end(); $browser->info('2 - main links')->get('/')->info('2.6 - signup')->click("Регистрация")->with('request')->begin()->isParameter('module', 'sfApply')->isParameter('action', 'apply')->end()->with('response')->begin()->isStatusCode(200)->end(); $browser->info('3 -footer links')->get('/')->info('3.1- Top')->click("По рейтингу")->with('request')->begin()->isParameter('module', 'collector')->isParameter('action', 'top')->end()->with('response')->begin()->isStatusCode(200)->end(); $browser->info('3 -footer links')->get('/')->info('3.2- Regions')->click("По регионам")->with('request')->begin()->isParameter('module', 'collector')->isParameter('action', 'regions')->end()->with('response')->begin()->isStatusCode(200)->end(); $browser->info('3 -footer links')->get('/')->info('3.3 - Free')->click("Бесплатная рыбалка")->with('request')->begin()->isParameter('module', 'collector')->isParameter('action', 'listFree')->end()->with('response')->begin()->isStatusCode(200)->end();
<?php /** * @author * @package sfGurardExpiredPassword * @subpackage unit test * @version $Id$ */ include dirname(__FILE__) . '/../bootstrap/bootstrap.php'; $databaseManager = new sfDatabaseManager($configuration); $conn = Doctrine::getConnectionByTableName('sfGuardUserPassword'); $t = new lime_test(); $user = $context->getUser(); $sfGuardUser = Doctrine::getTable('sfGuardUser')->findOneByUsername('user'); $user->signIn($sfGuardUser); $t->comment('Settings related to this test'); $t->info('password_expiration_date: ' . sfConfig::get('app_sf_guard_extra_plugin_password_expiration_date')); // let's change the user password created_at date to make sure it's expired $result = Doctrine::getTable('sfGuardUserPassword')->createQuery()->where('user_id = ?', $sfGuardUser->getId())->orderBy('created_at DESC')->fetchOne(); // password should not be expired $result->setCreatedAt(date("Y-m-d H:i:s")); $result->save(); $t->is(false, Doctrine::getTable('sfGuardUserPassword')->isPassExpired($sfGuardUser->getId()), '->isPassExpired()'); // pass expired $result->setCreatedAt('2000-01-01 00:00:00'); $result->save(); $t->is(true, Doctrine::getTable('sfGuardUserPassword')->isPassExpired($sfGuardUser->getId()), '->isPassExpired()');