当前位置: 首页>>代码示例>>PHP>>正文


PHP Mailer::getLastMail方法代码示例

本文整理汇总了PHP中Mailer::getLastMail方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::getLastMail方法的具体用法?PHP Mailer::getLastMail怎么用?PHP Mailer::getLastMail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mailer的用法示例。


在下文中一共展示了Mailer::getLastMail方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testFromName

 public function testFromName()
 {
     $config = Config::getInstance();
     $config->setValue("app_title_prefix", "My Crazy Custom ");
     $_SERVER['HTTP_HOST'] = "my_thinkup_hostname";
     Mailer::mail('you@example.com', 'Testing 123', 'Me worky, yo?');
     $email_body = Mailer::getLastMail();
     $this->debug($email_body);
     $this->assertPattern('/From: "My Crazy Custom ThinkUp" <notifications@my_thinkup_hostname>/', $email_body);
     $config->setValue("app_title_prefix", "My Other Installation of ");
     $_SERVER['HTTP_HOST'] = "my_other_hostname";
     Mailer::mail('you@example.com', 'Testing 123', 'Me worky, yo?');
     $email_body = Mailer::getLastMail();
     $this->debug($email_body);
     $this->assertPattern('/From: "My Other Installation of ThinkUp" <notifications@my_other_hostname>/', $email_body);
 }
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:16,代码来源:TestOfMailer.php

示例2: testForgotPasswordSuccess

 public function testForgotPasswordSuccess()
 {
     $config = Config::getInstance();
     $this->get($this->url . '/session/login.php');
     $this->click('Forgot your password?');
     $this->assertTitle($config->getValue('app_title_prefix') . 'ThinkUp');
     $this->assertText('Reset your password');
     $this->setField('email', 'me@example.com');
     $this->click('Send');
     $this->assertPattern('/Password recovery information has been sent to your email address./');
     $email_file = Mailer::getLastMail();
     preg_match('/reset it:\\n(http.*)/m', $email_file, $urls);
     $this->get($urls[1]);
     $this->assertNoPattern('/You have reached this page in error/');
     $this->assertText('Reset your password');
     $this->setField('password', 'abc123');
     $this->setField('password_confirm', 'abc123');
     $this->click('Send');
     //Doesn't work b/c it's a JS message?
     //$this->assertPattern('/You have changed your password/');
     //No longer at the reset page
     $this->assertPattern('/Log in/');
 }
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:23,代码来源:WebTestOfForgottonPassword.php

示例3: testOfControllerWithValidEmailAddressAndSSL

    public function testOfControllerWithValidEmailAddressAndSSL()
    {
        $config = Config::getInstance();
        $config->setValue('app_title_prefix', '');
        $site_root_path = $config->getValue('site_root_path');
        $_POST['email'] = 'me@example.com';
        $_POST['Submit'] = "Send";
        $_SERVER['HTTP_HOST'] = "mytestthinkup";
        $_SERVER['HTTPS'] = true;
        $controller = new ForgotPasswordController(true);
        $result = $controller->go();
        $this->assertTrue(strpos($result, 'Password recovery information has been sent to your email address.') > 0);
        $actual_forgot_email = Mailer::getLastMail();
        $this->debug($actual_forgot_email);
        $expected_forgot_email_pattern = '/to: me@example.com
subject: ThinkUp Password Recovery
message: Hi there!

Looks like you forgot your ThinkUp password. Go to this URL to reset it:
https:\\/\\/mytestthinkup' . str_replace('/', '\\/', $site_root_path) . 'session\\/reset.php/';
        $this->assertPattern($expected_forgot_email_pattern, $actual_forgot_email);
    }
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:22,代码来源:TestOfForgotPasswordController.php

示例4: testInviteUser

    public function testInviteUser()
    {
        $config = Config::getInstance();
        $site_root_path = $config->getValue('site_root_path');
        $builders = array();
        // make sure registration is closed
        $builders[] = FixtureBuilder::build('options', array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'is_registration_open', 'option_value' => 'false'));
        $builders[] = FixtureBuilder::build('invites', array('invite_code' => '0123456789', 'created_time' => '-3s'));
        $_SERVER['HTTP_HOST'] = "mythinkup";
        $_GET['code'] = '0123456789';
        $_POST['Submit'] = 'Register';
        $_POST['full_name'] = "Angelina Jolie";
        $_POST['email'] = 'angie@example.com';
        $_POST['user_code'] = '123456';
        $_POST['pass1'] = 'mypass';
        $_POST['pass2'] = 'mypass';
        $controller = new RegisterController(true);
        $results = $controller->go();
        $this->debug($results);
        $v_mgr = $controller->getViewManager();
        $this->assertEqual($v_mgr->getTemplateDataItem('controller_title'), 'Register');
        $this->assertEqual($v_mgr->getTemplateDataItem('success_msg'), 'Success! Check your email for an activation link.');
        $expected_reg_email_pattern = '/to: angie@example.com
subject: Activate Your ThinkUp Account
message: Click on the link below to activate your new ThinkUp account:

http:\\/\\/mythinkup' . str_replace('/', '\\/', $site_root_path) . 'session\\/activate.php\\?usr=angie%40example.com/';
        $actual_reg_email = Mailer::getLastMail();
        $this->debug($actual_reg_email);
        $this->assertPattern($expected_reg_email_pattern, $actual_reg_email);
    }
开发者ID:narpaldhillon,项目名称:ThinkUp,代码行数:31,代码来源:TestOfRegisterController.php

示例5: testCrawlWithAuthError

    public function testCrawlWithAuthError()
    {
        //build active instance owned by a owner
        $instance_with_autherror = array('id' => 5, 'network_username' => 'Liz Lemon', 'network_user_id' => '123456', 'network_viewer_id' => '123456', 'last_post_id' => '0', 'total_posts_in_system' => '0', 'total_replies_in_system' => '0', 'total_follows_in_system' => '0', 'is_archive_loaded_replies' => '0', 'is_archive_loaded_follows' => '0', 'crawler_last_run' => '', 'earliest_reply_in_system' => '', 'avg_replies_per_day' => '2', 'is_public' => '0', 'is_active' => '1', 'network' => 'facebook', 'last_favorite_id' => '0', 'owner_favs_in_system' => '0', 'total_posts_by_owner' => 0, 'posts_per_day' => 1, 'posts_per_week' => 1, 'percentage_replies' => 50, 'percentage_links' => 50, 'earliest_post_in_system' => '2009-01-01 13:48:05', 'favorites_profile' => '0');
        $instance_builder_1 = FixtureBuilder::build('instances', $instance_with_autherror);
        $builders = array();
        $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'email' => 'me@example.com', 'is_activated' => 1));
        $builders[] = FixtureBuilder::build('owner_instances', array('owner_id' => 1, 'instance_id' => 5, 'auth_error' => ''));
        //assert invalid_oauth_email_sent_timestamp option is not set
        $option_dao = DAOFactory::getDAO('OptionDAO');
        $plugin_dao = DAOFactory::getDAO('PluginDAO');
        $plugin_id = $plugin_dao->getPluginId('facebook');
        $last_email_timestamp = $option_dao->getOptionByName(OptionDAO::PLUGIN_OPTIONS . '-' . $plugin_id, 'invalid_oauth_email_sent_timestamp');
        $this->assertNull($last_email_timestamp);
        //log in as that owner
        $this->simulateLogin('me@example.com');
        $_SERVER['HTTP_HOST'] = "mytestthinkup";
        //run the crawl
        $fb_plugin = new FacebookPlugin();
        $fb_plugin->crawl();
        //assert that APIOAuthException was caught and recorded in owner_instances table
        $owner_instance_dao = new OwnerInstanceMySQLDAO();
        $owner_instance = $owner_instance_dao->get(1, 5);
        $this->assertEqual($owner_instance->auth_error, 'Error validating access token: Session has expired at unix ' . 'time SOME_TIME. The current unix time is SOME_TIME.');
        //assert that the email notification was sent to the user
        $expected_reg_email_pattern = '/to: me@example.com
subject: Please re-authorize ThinkUp to access Liz Lemon on Facebook
message: Hi! Your ThinkUp installation is no longer connected to the Liz Lemon Facebook account./';
        $actual_reg_email = Mailer::getLastMail();
        $this->debug($actual_reg_email);
        $this->assertPattern($expected_reg_email_pattern, $actual_reg_email);
        //assert invalid_oauth_email_sent_timestamp option has been set
        $last_email_timestamp = $option_dao->getOptionByName(OptionDAO::PLUGIN_OPTIONS . '-' . $plugin_id, 'invalid_oauth_email_sent_timestamp');
        $this->assertNotNull($last_email_timestamp);
        //Delete last mail file
        $test_email_file = FileDataManager::getDataPath(Mailer::EMAIL);
        unlink($test_email_file);
        $actual_reg_email = Mailer::getLastMail();
        //Assert it's been deleted
        $this->assertEqual($actual_reg_email, '');
        //Crawl again
        $fb_plugin->crawl();
        //Assert email has not been resent
        $actual_reg_email = Mailer::getLastMail();
        $this->debug($actual_reg_email);
        $this->assertEqual($actual_reg_email, '');
    }
开发者ID:nagyistoce,项目名称:ThinkUp,代码行数:47,代码来源:TestOfFacebookPlugin.php

示例6: testFreshInstallStep3SuccessfulInstall

 public function testFreshInstallStep3SuccessfulInstall()
 {
     self::time(__METHOD__);
     //get valid credentials
     $config = Config::getInstance();
     $valid_db_username = $config->getValue('db_user');
     $valid_db_pwd = $config->getValue('db_password');
     $valid_db_name = $config->getValue('db_name');
     $valid_db_host = $config->getValue('db_host');
     $valid_db_socket = $config->getValue('db_socket');
     //drop DB
     $this->testdb_helper->drop($this->test_database_name);
     //remove config file
     $config = null;
     Config::destroyInstance();
     //unset PDO so it must be recreated
     InstallerMySQLDAO::$PDO = null;
     //remove config file
     $this->removeConfigFile();
     //force a refresh of getTables
     Installer::$show_tables = null;
     //set param for step 3
     $_GET['step'] = '3';
     //set post values from form
     $_POST['site_email'] = "you@example.com";
     $_POST['password'] = "asdfadsf123";
     $_POST['confirm_password'] = "asdfadsf123";
     $_POST['db_user'] = $valid_db_username;
     $_POST['db_passwd'] = $valid_db_pwd;
     $_POST['db_name'] = $valid_db_name;
     //$_POST['db_name'] = 'thinkup_install';
     $_POST['db_type'] = "mysql";
     $_POST['db_host'] = $valid_db_host;
     $_POST['db_socket'] = $valid_db_socket;
     $_POST['db_port'] = "";
     $_POST['db_prefix'] = "tu_";
     $_POST['full_name'] = "My Full Name";
     $_POST['timezone'] = "America/Los_Angeles";
     $_SERVER['HTTP_HOST'] = "example.com";
     $controller = new InstallerController(true);
     $this->assertTrue(isset($controller));
     $result = $controller->go();
     $this->debug($result);
     $this->assertPattern('/ThinkUp has been successfully installed./', $result);
     $option_dao = DAOFactory::getDAO('OptionDAO');
     $current_stored_server_name = $option_dao->getOptionByName(OptionDAO::APP_OPTIONS, 'server_name');
     $this->assertNotNull($current_stored_server_name);
     $this->assertEqual($current_stored_server_name->option_value, 'example.com');
     $this->assertEqual($current_stored_server_name->option_name, 'server_name');
     $install_email = Mailer::getLastMail();
     $this->debug($install_email);
     $this->assertPattern("/http:\\/\\/example.com\\/session\\/activate.php\\?usr=you\\%40example.com\\&code\\=/", $install_email);
     $this->restoreConfigFile();
     //echo $result;
 }
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:55,代码来源:TestOfInstallerController.php

示例7: testNoTimezoneHandling

 public function testNoTimezoneHandling()
 {
     $tz = date_default_timezone_get();
     unlink(FileDataManager::getDataPath(Mailer::EMAIL));
     $builders = array();
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'is_admin' => 1, 'email' => 'daily@example.com', 'is_activated' => 1, 'email_notification_frequency' => 'daily', 'timezone' => ''));
     $builders[] = FixtureBuilder::build('owner_instances', array('owner_id' => 1, 'instance_id' => 5, 'auth_error' => ''));
     $builders[] = FixtureBuilder::build('instances', array('network_username' => 'cdmoyer', 'id' => 5, 'network' => 'twitter', 'is_activated' => 1, 'is_public' => 1));
     $builders[] = FixtureBuilder::build('insights', array('id' => 1, 'instance_id' => 5, 'slug' => 'new_group_memberships', 'prefix' => 'Made the List:', 'text' => 'CDMoyer is on 29 new lists', 'time_generated' => date('Y-m-d 03:00:00')));
     $builders[] = FixtureBuilder::build('insights', array('id' => 2, 'instance_id' => 5, 'slug' => 'new_group_memberships', 'prefix' => 'Made the List:', 'text' => 'CDMoyer is on 99 new lists', 'time_generated' => date('Y-m-d 01:00:00')));
     $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
     $options = $plugin_option_dao->getOptionsHash($plugin->folder_name, true);
     $this->assertEqual(count($options), 0);
     $config = Config::getInstance();
     date_default_timezone_set($config->getValue('timezone'));
     $this->simulateLogin('daily@example.com');
     $plugin = new InsightsGeneratorPlugin();
     $plugin->current_timestamp = strtotime('3am');
     // Should not set yet
     $plugin->crawl();
     $sent = Mailer::getLastMail();
     $this->assertEqual('', $sent);
     $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
     $options = $plugin_option_dao->getOptionsHash($plugin->folder_name, true);
     $this->assertEqual(count($options), 0);
     $plugin->current_timestamp = strtotime('5am');
     // SHould send
     $plugin->crawl();
     $sent = Mailer::getLastMail();
     $this->assertNotEqual('', $sent);
     $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
     $options = $plugin_option_dao->getOptionsHash($plugin->folder_name, true);
     $this->assertTrue(count($options) > 0);
     date_default_timezone_set($tz);
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:35,代码来源:TestOfInsightsGeneratorPlugin.php

示例8: testTokenEmailWithSSL

 public function testTokenEmailWithSSL()
 {
     $config = Config::getInstance();
     $site_root_path = $config->getValue('site_root_path');
     // build 1 valid admin and two invalid admins
     $builder1 = FixtureBuilder::build('owners', array('is_admin' => 1, 'is_activated' => 1, 'email' => 'm@w.nz'));
     $builder2 = FixtureBuilder::build('owners', array('is_admin' => 0, 'is_activated' => 1, 'email' => 'm2@w.nz'));
     $builder3 = FixtureBuilder::build('owners', array('is_admin' => 1, 'is_activated' => 0, 'email' => 'm3@w.nz'));
     $_SERVER['HTTP_HOST'] = "mytestthinkup";
     $_SERVER['HTTPS'] = "mytestthinkup";
     $controller = new UpgradeDatabaseController(true);
     $results = $controller->go();
     $this->assertTrue(file_exists($this->token_file));
     $this->assertPattern('/<!--  we are upgrading -->/', $results);
     $this->assertTrue(file_exists($this->token_file));
     $token = file_get_contents($this->token_file);
     $this->assertPattern('/^[\\da-f]{32}$/', $token);
     $email_file = Mailer::getLastMail();
     $this->debug($email_file);
     $this->assertPattern('/to\\: m@w\\.nz\\s/', $email_file);
     $this->assertPattern('/subject\\: Upgrade Your ThinkUp Database/', $email_file);
     $token_regex = '/https:\\/\\/mytestthinkup' . str_replace('/', '\\/', $site_root_path) . 'install\\/upgrade-database.php\\?upgrade_token=' . $token . '/';
     $this->assertPattern($token_regex, $email_file);
     // build 1 more valid admin, should have two to emails
     $test_email = FileDataManager::getDataPath(Mailer::EMAIL);
     unlink($test_email);
     unlink($this->token_file);
     $builder4 = FixtureBuilder::build('owners', array('is_admin' => 1, 'is_activated' => 1, 'email' => 'm4@w.nz'));
     $results = $controller->go();
     $this->assertTrue(file_exists($this->token_file));
     $this->assertPattern('/<!--  we are upgrading -->/', $results);
     $this->assertTrue(file_exists($this->token_file));
     $token = file_get_contents($this->token_file);
     $this->assertPattern('/^[\\da-f]{32}$/', $token);
     $email_file = Mailer::getLastMail();
     $this->assertPattern('/to\\: m@w\\.nz,m4@w\\.nz\\s/', $email_file);
     $this->assertPattern('/subject\\: Upgrade Your ThinkUp Database/', $email_file);
     $token_regex = '/\\/install\\/upgrade-database.php\\?upgrade_token=' . $token . '/';
     $this->assertPattern($token_regex, $email_file);
     // should not send email if a token file exists
     $test_email = FileDataManager::getDataPath(Mailer::EMAIL);
     unlink($test_email);
     $results = $controller->go();
     $this->assertFalse(file_exists($test_email));
 }
开发者ID:rudimk,项目名称:Outro,代码行数:45,代码来源:TestOfUpgradeDatabaseController.php

示例9: testMandrillHTMLWithExceptions

 public function testMandrillHTMLWithExceptions()
 {
     unlink(FileDataManager::getDataPath(Mailer::EMAIL));
     $plugin = new InsightsGeneratorPlugin();
     $config = Config::getInstance();
     $config->setValue('mandrill_api_key', '1234');
     $plugin_dao = DAOFactory::getDAO('PluginDAO');
     $plugin_id = $plugin_dao->getPluginId($plugin->folder_name);
     $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
     $plugin_option_dao->insertOption($plugin_id, 'mandrill_template', $template = 'my_template');
     $long_ago = date('Y-m-d', strtotime('last year'));
     // When in test mode, the mailHTMLViaMandrill method will throw a Template Not Found exception
     // if the email address contains "templateerror".
     $builders = array();
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp Q. User', 'is_admin' => 1, 'email' => 'templateerror@example.com', 'is_activated' => 1, 'email_notification_frequency' => 'daily'));
     $builders[] = FixtureBuilder::build('instances', array('network_username' => 'cdmoyer', 'id' => 6, 'network' => 'twitter', 'is_activated' => 1, 'is_public' => 1));
     $builders[] = FixtureBuilder::build('owner_instances', array('owner_id' => 1, 'instance_id' => 6, 'id' => 1));
     $builders[] = FixtureBuilder::build('insights', array('id' => 2, 'instance_id' => 6, 'slug' => 'new_group_memberships', 'prefix' => 'Made the List:', 'text' => 'Joe Test is on 1234 new lists', 'time_generated' => date('Y-m-d 03:00:00', strtotime('1am'))));
     $this->simulateLogin('templateerror@example.com');
     $plugin->current_timestamp = strtotime('5pm');
     $exception = null;
     try {
         $plugin->crawl();
     } catch (Exception $e) {
         $exception = $e;
     }
     $this->assertNull($e, 'Should not get Mandrill template error');
     $sent = Mailer::getLastMail();
     //Sent plain text email
     $this->assertNotEqual($sent, '');
     $decoded = json_decode($sent);
     //Not HTML email via JSON
     $this->assertNull($decoded->global_merge_vars);
     //Check user got a log message
     $config = Config::getInstance();
     $logger_file = $config->getValue('log_location');
     $log = file($logger_file);
     $last_log = join("\n", array_slice($log, -10));
     $this->assertPattern('/invalid mandrill template/i', $last_log);
 }
开发者ID:nagyistoce,项目名称:ThinkUp,代码行数:40,代码来源:TestOfInsightsGeneratorPlugin.php

示例10: testHTMLViaMandrillTemplate

 public function testHTMLViaMandrillTemplate()
 {
     $config = Config::getInstance();
     $config->setValue("app_title_prefix", "Prefix ");
     $config->setValue("mandrill_api_key", "asdfasdfasdfadsfasd");
     $_SERVER['HTTP_HOST'] = "thinkup.com";
     Mailer::mailHTMLViaMandrillTemplate($to = 'chris@inarow.net', $subject = 'Test Subject', 'thinkup-digest', array('insights' => 'test insights', 'merge2' => 'Some other text'));
     $email_body = Mailer::getLastMail();
     $decoded = json_decode($email_body);
     $this->assertEqual($subject, $decoded->subject);
     $this->assertEqual($to, $decoded->to[0]->email);
     $this->assertEqual(2, count($decoded->global_merge_vars));
 }
开发者ID:jkuehl-carecloud,项目名称:ThinkUp,代码行数:13,代码来源:TestOfMailer.php

示例11: testCrawlWithAuthError

    public function testCrawlWithAuthError()
    {
        //build active instance owned by a owner
        $instance_with_autherror = array('id' => 5, 'network_username' => 'Liz Lemon', 'network_user_id' => '123456', 'network_viewer_id' => '123456', 'last_post_id' => '0', 'last_page_fetched_replies' => 0, 'last_page_fetched_tweets' => '0', 'total_posts_in_system' => '0', 'total_replies_in_system' => '0', 'total_follows_in_system' => '0', 'is_archive_loaded_replies' => '0', 'is_archive_loaded_follows' => '0', 'crawler_last_run' => '', 'earliest_reply_in_system' => '', 'avg_replies_per_day' => '2', 'is_public' => '0', 'is_active' => '1', 'network' => 'facebook', 'last_favorite_id' => '0', 'last_unfav_page_checked' => '0', 'last_page_fetched_favorites' => '0', 'owner_favs_in_system' => '0', 'total_posts_by_owner' => 0, 'posts_per_day' => 1, 'posts_per_week' => 1, 'percentage_replies' => 50, 'percentage_links' => 50, 'earliest_post_in_system' => '01-01-2009', 'favorites_profile' => '0');
        $instance_builder_1 = FixtureBuilder::build('instances', $instance_with_autherror);
        $builders = array();
        $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'email' => 'me@example.com', 'is_activated' => 1));
        $builders[] = FixtureBuilder::build('owner_instances', array('owner_id' => 1, 'instance_id' => 5, 'auth_error' => ''));
        //log in as that owner
        $this->simulateLogin('me@example.com');
        $_SERVER['HTTP_HOST'] = "mytestthinkup";
        //run the crawl
        $fb_plugin = new FacebookPlugin();
        $fb_plugin->crawl();
        //assert that APIOAuthException was caught and recorded in owner_instances table
        $owner_instance_dao = new OwnerInstanceMySQLDAO();
        $owner_instance = $owner_instance_dao->get(1, 5);
        $this->assertEqual($owner_instance->auth_error, 'Error validating access token: Session has expired at unix ' . 'time SOME_TIME. The current unix time is SOME_TIME.');
        //assert that the email notification was sent to the user
        $expected_reg_email_pattern = '/to: me@example.com
subject: Please re-authorize ThinkUp to access Liz Lemon on Facebook
message: Hi! Your ThinkUp installation is no longer connected to the Liz Lemon Facebook account./';
        $actual_reg_email = Mailer::getLastMail();
        $this->debug($actual_reg_email);
        $this->assertPattern($expected_reg_email_pattern, $actual_reg_email);
    }
开发者ID:ninjapanzer,项目名称:ThinkUp,代码行数:26,代码来源:TestOfFacebookPlugin.php

示例12: testCrawlWithUnexpectedErrorPleaseTryAgain

 public function testCrawlWithUnexpectedErrorPleaseTryAgain()
 {
     //build active instance owned by a owner
     $instance_with_autherror = array('id' => 5, 'network_username' => 'Liz Lemon', 'network_user_id' => '123456-app-throttled', 'network_viewer_id' => '123456-unexpected-error-try-again', 'last_post_id' => '0', 'total_posts_in_system' => '0', 'total_replies_in_system' => '0', 'total_follows_in_system' => '0', 'is_archive_loaded_replies' => '0', 'is_archive_loaded_follows' => '0', 'crawler_last_run' => '', 'earliest_reply_in_system' => '', 'avg_replies_per_day' => '2', 'is_public' => '0', 'is_active' => '1', 'network' => 'facebook', 'last_favorite_id' => '0', 'owner_favs_in_system' => '0', 'total_posts_by_owner' => 0, 'posts_per_day' => 1, 'posts_per_week' => 1, 'percentage_replies' => 50, 'percentage_links' => 50, 'earliest_post_in_system' => '2009-01-01 13:48:05', 'favorites_profile' => '0');
     $instance_builder_1 = FixtureBuilder::build('instances', $instance_with_autherror);
     $builders = array();
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'email' => 'admin@example.com', 'is_activated' => 1, 'is_admin' => 1));
     $builders[] = FixtureBuilder::build('owners', array('id' => 2, 'full_name' => 'ThinkUp K. User', 'email' => 'notadmin@example.com', 'is_activated' => 1));
     $builders[] = FixtureBuilder::build('owner_instances', array('owner_id' => 2, 'instance_id' => 5, 'auth_error' => '', 'oauth_access_token' => 'zL11BPY2fZPPyYY', 'oauth_access_token_secret' => ''));
     //assert invalid_oauth_email_sent_timestamp option is not set
     $option_dao = DAOFactory::getDAO('OptionDAO');
     $plugin_dao = DAOFactory::getDAO('PluginDAO');
     $plugin_id = $plugin_dao->getPluginId('facebook');
     $last_email_timestamp = $option_dao->getOptionByName(OptionDAO::PLUGIN_OPTIONS . '-' . $plugin_id, 'invalid_oauth_email_sent_timestamp');
     $this->assertNull($last_email_timestamp);
     //log in as that owner
     $this->simulateLogin('admin@example.com');
     $_SERVER['HTTP_HOST'] = "mytestthinkup";
     //run the crawl
     $fb_plugin = new FacebookPlugin();
     $fb_plugin->crawl();
     //assert that APIOAuthException was caught and recorded in owner_instances table
     $owner_instance_dao = new OwnerInstanceMySQLDAO();
     $owner_instance = $owner_instance_dao->get(2, 5);
     $this->debug(Utils::varDumpToString($owner_instance));
     //assert that the application request throttling error was not saved
     $this->assertEqual($owner_instance->auth_error, '');
     //assert that the reauth email notification was not sent to user
     $actual_reg_email = Mailer::getLastMail();
     $this->debug($actual_reg_email);
     $this->assertEqual($actual_reg_email, '');
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:32,代码来源:TestOfFacebookPlugin.php

示例13: testHandlingLastSentTime

 public function testHandlingLastSentTime()
 {
     $tz = date_default_timezone_get();
     unlink(FileDataManager::getDataPath(Mailer::EMAIL));
     $builders = array();
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'is_admin' => 1, 'email' => 'daily@example.com', 'is_activated' => 1, 'email_notification_frequency' => 'daily', 'timezone' => 'America/New_York'));
     $builders[] = FixtureBuilder::build('owner_instances', array('owner_id' => 1, 'instance_id' => 5, 'auth_error' => ''));
     $builders[] = FixtureBuilder::build('instances', array('network_username' => 'cdmoyer', 'id' => 5, 'network' => 'twitter', 'is_activated' => 1, 'is_public' => 1));
     $builders[] = FixtureBuilder::build('insights', array('id' => 1, 'instance_id' => 5, 'slug' => 'new_group_memberships', 'headline' => 'Made the List:', 'related_data' => null, 'text' => 'CDMoyer is on 29 new lists', 'time_generated' => date('Y-m-d 4:00', strtotime('-49 hour'))));
     $builders[] = FixtureBuilder::build('insights', array('id' => 2, 'instance_id' => 5, 'slug' => 'new_group_memberships', 'headline' => 'Made the List:', 'related_data' => null, 'text' => 'CDMoyer is on 99 new lists', 'time_generated' => date('Y-m-d H:00:00', strtotime('-45 hour'))));
     $builders[] = FixtureBuilder::build('insights', array('id' => 3, 'instance_id' => 5, 'slug' => 'new_group_memberships', 'headline' => 'Made the List:', 'related_data' => null, 'text' => 'CDMoyer is on 42 new lists', 'time_generated' => date('Y-m-d H:00:00', strtotime('-42 hour'))));
     $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
     $options = $plugin_option_dao->getOptionsHash($plugin->folder_name, true);
     $this->assertEqual(count($options), 0);
     $config = Config::getInstance();
     //date_default_timezone_set($config->getValue('timezone'));
     $this->simulateLogin('daily@example.com');
     $plugin = new InsightsGeneratorPlugin();
     $plugin->current_timestamp = strtotime('Yesterday 4am');
     // Should send
     $plugin->crawl();
     $sent = Mailer::getLastMail();
     $this->assertNoPattern('/29 new lists/', $sent);
     unlink(FileDataManager::getDataPath(Mailer::EMAIL));
     $plugin->current_timestamp = strtotime('4am');
     // Should send
     $plugin_dao = DAOFactory::getDAO('PluginDAO');
     $plugin_id = $plugin_dao->getPluginId($plugin->folder_name);
     $options = $plugin_option_dao->getOptionsHash($plugin->folder_name, true);
     $plugin_option_dao->updateOption($options['last_daily_email']->id, 'last_daily_email', date('Y-m-d H:00:00', strtotime('-43 hour')));
     $options = $plugin_option_dao->getOptionsHash($plugin->folder_name, true);
     $plugin->crawl();
     $sent = Mailer::getLastMail();
     $this->assertNoPattern('/29 new lists/', $sent);
     $this->assertNoPattern('/99 new lists/', $sent);
     $this->assertPattern('/42 new lists/', $sent);
 }
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:37,代码来源:TestOfInsightsGeneratorPlugin.php

示例14: testSpaceInHostName

    public function testSpaceInHostName() {
        // make sure registration is on...
        $bvalues = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'is_registration_open',
        'option_value' => 'true');
        $bdata = FixtureBuilder::build('options', $bvalues);

        $_SERVER['HTTP_HOST'] = "mytestthinkup/";
        $_POST['Submit'] = 'Register';
        $_POST['full_name'] = "Angelina Jolie";
        $_POST['email'] = 'angie@example.com';
        $_POST['user_code'] = '123456';
        $_POST['pass1'] = 'mypass';
        $_POST['pass2'] = 'mypass';
        $config = Config::getInstance();
        $config->setValue('site_root_path', 'test url with spaces/');
        $controller = new RegisterController(true);
        $results = $controller->go();

        $email = Mailer::getLastMail();
        $this->debug("Email contents: " . $email);
        $this->assertPattern('/test%20url%20with%20spaces/', $email, 'Spaces found in activation URL.');
    }
开发者ID:rgoncalves,项目名称:ThinkUp,代码行数:22,代码来源:TestOfRegisterController.php


注:本文中的Mailer::getLastMail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。