本文整理汇总了PHP中FileDataManager类的典型用法代码示例。如果您正苦于以下问题:PHP FileDataManager类的具体用法?PHP FileDataManager怎么用?PHP FileDataManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileDataManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: deleteFile
private function deleteFile($file)
{
$file = FileDataManager::getBackupPath($file);
if (file_exists($file)) {
unlink($file);
}
}
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:7,代码来源:TestOfExportServiceUserDataController.php
示例2: __construct
public function __construct($session_started = false)
{
parent::__construct($session_started);
$this->setViewTemplate('install.backup.tpl');
$this->setPageTitle('Backup & Restore');
$this->backup_file = FileDataManager::getDataPath('.htthinkup_db_backup.zip');
// not in the backup dir itself
}
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:8,代码来源:class.BackupController.php
示例3: tearDown
public function tearDown()
{
$this->builders = null;
$test_email = FileDataManager::getDataPath(Mailer::EMAIL);
if (file_exists($test_email)) {
unlink($test_email);
}
parent::tearDown();
}
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:9,代码来源:WebTestOfForgottonPassword.php
示例4: tearDown
public function tearDown()
{
parent::tearDown();
// delete test email file if it exists
$test_email = FileDataManager::getDataPath(Mailer::EMAIL);
if (file_exists($test_email)) {
unlink($test_email);
}
}
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:9,代码来源:TestOfMailer.php
示例5: getLastMail
/**
* Return the contents of the last email Mailer "sent" out.
* For testing purposes only; this will return nothing in production.
* @return str The contents of the last email sent
*/
public static function getLastMail()
{
$test_email_file = FileDataManager::getDataPath(Mailer::EMAIL);
if (file_exists($test_email_file)) {
return file_get_contents($test_email_file);
} else {
return '';
}
}
开发者ID:kuthulas,项目名称:ProjectX,代码行数:14,代码来源:class.Mailer.php
示例6: setUp
public function setUp()
{
parent::setUp();
new BackupMySQLDAO();
$this->config = Config::getInstance();
$this->pdo = BackupMySQLDAO::$PDO;
$this->backup_file = FileDataManager::getDataPath('.htthinkup_db_backup.zip');
$this->backup_test = FileDataManager::getDataPath('thinkup_db_backup_test.zip');
$this->backup_dir = FileDataManager::getBackupPath() . '/';
}
开发者ID:nix4,项目名称:ThinkUp,代码行数:10,代码来源:TestOfBackupController.php
示例7: tearDown
public function tearDown()
{
parent::tearDown();
$config = Config::getInstance();
$config->setValue("mandrill_api_key", "");
// delete test email file if it exists
$test_email = FileDataManager::getDataPath(Mailer::EMAIL);
if (file_exists($test_email)) {
unlink($test_email);
}
}
开发者ID:jkuehl-carecloud,项目名称:ThinkUp,代码行数:11,代码来源:TestOfMailer.php
示例8: tearDown
public function tearDown()
{
parent::tearDown();
$zipfile = FileDataManager::getBackupPath('.htthinkup_db_backup.zip');
$backup_dir = FileDataManager::getBackupPath();
if (file_exists($zipfile)) {
unlink($zipfile);
}
if (file_exists($backup_dir)) {
$this->recursiveDelete($backup_dir);
}
}
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:12,代码来源:TestOfBackupMySQLDAO.php
示例9: testGetBackupPath
public function testGetBackupPath()
{
require THINKUP_WEBAPP_PATH . 'config.inc.php';
//if test fails here, the config file doesn't have datadir_path set
$this->assertNotNull($THINKUP_CFG['datadir_path']);
//test just path
$path = FileDataManager::getBackupPath();
$this->assertEqual($path, $THINKUP_CFG['datadir_path'] . 'backup/');
//test just path
$path = FileDataManager::getBackupPath('README.txt');
$this->assertEqual($path, $THINKUP_CFG['datadir_path'] . 'backup/README.txt');
}
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:12,代码来源:TestOfFileDataManager.php
示例10: testViewManagerDefaultValues
/**
* Test default values
*/
public function testViewManagerDefaultValues()
{
$cfg = Config::getInstance();
$cfg->setValue('source_root_path', '/path/to/thinkup/');
$cfg->setValue('cache_pages', true);
$cfg->setValue('cache_lifetime', 600);
$v_mgr = new ViewManager();
$this->assertTrue(sizeof($v_mgr->template_dir), 2);
$this->assertEqual($v_mgr->template_dir[1], '/path/to/thinkup/tests/view');
$this->assertTrue(sizeof($v_mgr->plugins_dir), 2);
$this->assertEqual($v_mgr->plugins_dir[0], 'plugins');
$this->assertEqual($v_mgr->cache_dir, FileDataManager::getDataPath('compiled_view/cache'));
$this->assertEqual($v_mgr->cache_lifetime, $cfg->getValue('cache_lifetime'));
$this->assertTrue($v_mgr->caching);
}
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:18,代码来源:TestOfViewManager.php
示例11: 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' => '[email protected]'));
$builder2 = FixtureBuilder::build('owners', array('is_admin' => 0, 'is_activated' => 1, 'email' => '[email protected]'));
$builder3 = FixtureBuilder::build('owners', array('is_admin' => 1, 'is_activated' => 0, 'email' => '[email protected]'));
$_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' => '[email protected]'));
$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
示例12: testIsSessionDirectoryWritable
public function testIsSessionDirectoryWritable()
{
//get whatever session save path is set to
$session_save_path = ini_get('session.save_path');
ini_set('session.save_path', FileDataManager::getDataPath());
$installer = Installer::getInstance();
$session_save_permission = $installer->isSessionDirectoryWritable();
$this->assertTrue($session_save_permission);
//reset back to what it was
ini_set('session.save_path', $session_save_path);
}
开发者ID:73sl4,项目名称:ThinkUp,代码行数:11,代码来源:TestOfInstaller.php
示例13: export
public function export($backup_file = null)
{
// get table names...
$q = "show tables";
$q2 = "show create table ";
$stmt = $this->execute($q);
$data = $this->getDataRowsAsArrays($stmt);
$create_tables = '';
$zip_file = FileDataManager::getDataPath('.htthinkup_db_backup.zip');
if ($backup_file) {
$zip_file = $backup_file;
}
$zip = new ZipArchive();
if (file_exists($zip_file)) {
unlink($zip_file);
}
// make sure w can create this zip file, ZipArchive is a little funky and wont let us know its status
// until we call close
$zip_create_status = @touch($zip_file);
if ($zip_create_status) {
unlink($zip_file);
}
$backup_dir = FileDataManager::getBackupPath();
if (!$zip_create_status || $zip->open($zip_file, ZIPARCHIVE::CREATE) !== TRUE) {
throw new Exception("Unable to open backup file for exporting: {$zip_file}");
}
// write lock tables...
$table_locks_list = '';
foreach ($data as $table) {
foreach ($table as $key => $value) {
if ($table_locks_list != '') {
$table_locks_list .= ', ';
}
$table_locks_list .= $value . ' WRITE';
}
}
try {
$stmt = $this->execute("LOCK TABLES " . $table_locks_list);
$tmp_table_files = array();
foreach ($data as $table) {
foreach ($table as $key => $value) {
if (getenv('BACKUP_VERBOSE') !== false) {
print " Backing up data for table: {$value}\n";
}
$stmt = $this->execute($q2 . $value);
$create_tables .= "-- Create {$value} table statement\n";
$create_tables .= "DROP TABLE IF EXISTS {$value};\n";
$create_data = $this->getDataRowAsArray($stmt);
$create_tables .= $create_data["Create Table"] . ";";
$create_tables .= "\n\n";
// export table data
$table_file = FileDataManager::getBackupPath($value . '.txt');
if (file_exists($table_file)) {
unlink($table_file);
}
$q3 = "select * INTO OUTFILE '{$table_file}' from {$value}";
$stmt = $this->execute($q3);
$zip->addFile($table_file, "/{$value}" . '.txt');
array_push($tmp_table_files, $table_file);
}
}
} catch (Exception $e) {
$err = $e->getMessage();
if (preg_match("/Can't create\\/write to file/", $err) || preg_match("/Can\\'t get stat of/", $err)) {
// a file perm issue?
throw new OpenFileException("It looks like the MySQL user does not have the proper file permissions " . "to back up data");
} else {
// assume its a GRANT FILE OR LOCK TABLES issue?
throw new MySQLGrantException("It looks like the MySQL user does not have the proper grant permissions " . "to back up data");
}
error_log("export DB OUTFILE error: " . $e->getMessage());
}
// unlock tables...
$stmt = $this->execute("unlock tables");
if (getenv('BACKUP_VERBOSE') !== false) {
print "\n Backing up create table statments\n";
}
$zip->addFromString("create_tables.sql", $create_tables);
$zip_close_status = $zip->close();
// clean up tmp table files
foreach ($tmp_table_files as $tmp_file) {
unlink($tmp_file);
}
if ($zip_close_status == false) {
throw new Exception("Unable to create backup file for exporting. Bad file path?: {$zip_file}");
}
return $zip_file;
}
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:88,代码来源:class.BackupMySQLDAO.php
示例14: generateUpgradeToken
/**
* Generates a one time upgrade token, and emails admins with the token info.
*/
public static function generateUpgradeToken()
{
$token_file = FileDataManager::getDataPath('.htupgrade_token');
$md5_token = '';
if (!file_exists($token_file)) {
$fp = fopen($token_file, 'w');
if ($fp) {
$token = self::TOKEN_KEY . rand(0, time());
$md5_token = md5($token);
if (!fwrite($fp, $md5_token)) {
throw new OpenFileException("Unable to write upgrade token file: " + $token_file);
}
fclose($fp);
} else {
throw new OpenFileException("Unable to create upgrade token file: " + $token_file);
}
// email our admin with this token.
$owner_dao = DAOFactory::getDAO('OwnerDAO');
$admins = $owner_dao->getAdmins();
if ($admins) {
$tos = array();
foreach ($admins as $admin) {
$tos[] = $admin->email;
}
$to = join(',', $tos);
$upgrade_email = new SmartyThinkUp();
$upgrade_email->caching = false;
$server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost';
//supress test weirdness
$upgrade_email->assign('server', $server);
$upgrade_email->assign('token', $md5_token);
$message = $upgrade_email->fetch('_email.upgradetoken.tpl');
$config = Config::getInstance();
Mailer::mail($to, "Upgrade Your ThinkUp Database", $message);
}
}
}
开发者ID:rudimk,项目名称:Outro,代码行数:40,代码来源:class.UpgradeDatabaseController.php
示例15: 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' => '[email protected]', '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('[email protected]');
$_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: [email protected]
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
示例16: exportCountHistory
protected function exportCountHistory($user_id, $network)
{
//just the max of each day's count
$count_history_table_file = FileDataManager::getBackupPath('count_history.tmp');
$export_dao = DAOFactory::getDAO('ExportDAO');
$export_dao->exportCountHistoryToFile($user_id, $network, $count_history_table_file);
$this->files_to_zip[] = array('path' => $count_history_table_file, 'name' => 'count_history.tmp');
$import_instructions = "LOAD DATA INFILE '/your/path/to/count_history.tmp' ";
$import_instructions .= "IGNORE INTO TABLE tu_count_history;\n\n";
self::appendToReadme($import_instructions);
}
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:11,代码来源:class.ExportServiceUserDataController.php
示例17: clearFollowerIDLastCursor
/**
* Clear the follower ID last cursor saved to file.
* @return bool
*/
public function clearFollowerIDLastCursor()
{
return unlink(FileDataManager::getDataPath('follower-id-last-cursor.txt'));
}
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:8,代码来源:class.TwitterCrawler.php
示例18: step1
/**
* Step 1 - Check system requirements
*/
private function step1()
{
$this->setViewTemplate('install.step1.tpl');
// php version check
$php_compat = false;
if ($this->installer->checkVersion()) {
$php_compat = true;
}
$this->addToView('php_compat', $php_compat);
$requiredVersion = $this->installer->getRequiredVersion();
$this->addToView('php_required_version', $requiredVersion['php']);
// libs check
if (isset($this->reqs)) {
//testing only
$libs = $this->installer->checkDependency($this->reqs);
} else {
$libs = $this->installer->checkDependency();
}
$libs_compat = true;
foreach ($libs as $lib) {
if (!$lib) {
$libs_compat = false;
}
}
$this->addToView('libs', $libs);
// path permissions check
$permissions = $this->installer->checkPermission();
$this->addToView('permission', $permissions);
$permissions_compat = true;
foreach ($permissions as $perm) {
if (!$perm) {
$permissions_compat = false;
}
}
$this->addToView('permissions_compat', $permissions_compat);
$this->addToView('writable_data_directory', FileDataManager::getDataPath());
// session save path permissions check
$session_permissions_compat = $this->installer->isSessionDirectoryWritable();
$this->addToView('session_permissions_compat', $session_permissions_compat);
$this->addToView('writable_session_save_directory', ini_get('session.save_path'));
// other vars set to view
$requirements_met = $php_compat && $libs_compat && $permissions_compat && $session_permissions_compat;
$this->addToView('requirements_met', $requirements_met);
$this->addToView('subtitle', 'Check System Requirements');
//If all requirements are met, go to step 2
if ($requirements_met) {
$this->addSuccessMessage("<strong>Great!</strong> Your system has everything it needs to run ThinkUp.", null, true);
$this->step2();
}
}
开发者ID:jkuehl-carecloud,项目名称:ThinkUp,代码行数:53,代码来源:class.InstallerController.php
示例19: runUpdate
/**
* Upgrade the application code to the latest version.
* @throws Exception
* @param bool $verify_updatable Whether or not to verify if installation is updatable, defaults to false
* @return array Backup file information
*/
public function runUpdate($file_path, $verify_updatable = false)
{
$app_dir = preg_replace("/\\/_lib\\/controller/", '', $file_path);
// do we have the disk space we need?
$disk_util = new AppUpgraderDiskUtil($app_dir);
$disk_space_megs = $disk_util->getAvailableDiskSpace();
// do we have the perms to do what we need?
$disk_util->validateUpdatePermissions($app_dir);
// do we need to update?
$update_client = new AppUpgraderClient();
$update_info = $update_client->getLatestVersionInfo();
require dirname(__FILE__) . '/../../install/version.php';
$version = Config::GetInstance()->getvalue('THINKUP_VERSION');
if ($update_info['version'] < $version) {
throw new Exception("You are running the latest version of ThinkUp.");
}
if ($verify_updatable == true) {
return array('latest_version' => $update_info['version']);
}
// download zip...
$update_zip_data = $update_client->getLatestVersionZip($update_info['url']);
$update_zip = $disk_util->writeZip($update_zip_data);
$zip = new ZipArchive();
$open_result = $zip->open($update_zip);
if ($open_result !== true) {
unlink($update_zip);
throw new Exception("Unable to extract " . $update_zip . ". ZipArchive::open failed with error code " . $open_result);
}
$num_files = $zip->numFiles;
if ($num_files < 1) {
unlink($update_zip);
throw new Exception("Unable to extract " . $update_zip . ". ZipArchive->numFiles is " . $num_files);
}
$backup_file_info = array();
$backup_file_info = $disk_util->backupInstall();
$disk_util->deleteOldInstall();
$data_path = FileDataManager::getDataPath();
if ($zip->extractTo($data_path) !== true) {
throw new Exception("Unable to extract new files into {$app_dir}: " . $zip->getStatusString());
} else {
$new_version_dir = $data_path . 'thinkup';
$disk_util->recurseCopy($new_version_dir, $app_dir);
// delete install files
$disk_util->deleteDir($new_version_dir);
unlink($update_zip);
}
//replace config file
copy($backup_file_info['config'], "{$app_dir}/config.inc.php");
return $backup_file_info;
}
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:56,代码来源:class.UpgradeApplicationController.php
示例20: 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' => '[email protected]', '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('[email protected]');
$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
注:本文中的FileDataManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论