updater.test.php
来自「一款可以和GOOGLE媲美的开源统计系统,运用AJAX.功能强大. 无色提示:」· PHP 代码 · 共 75 行
PHP
75 行
<?phpif(!defined("PATH_TEST_TO_ROOT")) { define('PATH_TEST_TO_ROOT', getcwd().'/../../');}if(!defined('CONFIG_TEST_INCLUDED')){ require_once PATH_TEST_TO_ROOT."tests/config_test.php";}//Zend_Loader::loadClass('Piwik_');require_once "Updater.php";require_once "Database.test.php";class Test_Piwik_Blank extends Test_Database { function __construct( $title = '') { parent::__construct( $title ); } public function setUp() { parent::setUp(); Piwik::createConfigObject(); Piwik::createDatabaseObject(); } public function test_updaterChecksCoreVersion_andDetectsUpdateFile() { $updater = new Piwik_Updater(); $updater->pathUpdateFileCore = PIWIK_INCLUDE_PATH . '/tests/core/Updater/core/'; $updater->recordComponentSuccessfullyUpdated('core', '0.1'); $updater->addComponentToCheck('core', '0.3'); $componentsWithUpdateFile = $updater->getComponentsWithUpdateFile(); $this->assertTrue(count($componentsWithUpdateFile) == 1); } public function test_updaterChecksGivenPluginVersion_andDetectsMultipleUpdateFile_inOrder() { $updater = new Piwik_Updater(); $updater->pathUpdateFilePlugins = PIWIK_INCLUDE_PATH . '/tests/core/Updater/%s/'; $updater->recordComponentSuccessfullyUpdated('testpluginUpdates', '0.1beta'); $updater->addComponentToCheck('testpluginUpdates', '0.1'); $componentsWithUpdateFile = $updater->getComponentsWithUpdateFile(); $this->assertTrue(count($componentsWithUpdateFile) == 1); $updateFiles = $componentsWithUpdateFile['testpluginUpdates']; $this->assertTrue(count($updateFiles) == 2); $expectedInOrder = array('0.1beta2.php', '0.1.php'); $this->assertEqual(array_map("basename", $updateFiles), $expectedInOrder); } public function test_updaterChecksCoreAndPlugin_checkThatCoreIsRanFirst() { $updater = new Piwik_Updater(); $updater->pathUpdateFilePlugins = PIWIK_INCLUDE_PATH . '/tests/core/Updater/%s/'; $updater->pathUpdateFileCore = PIWIK_INCLUDE_PATH . '/tests/core/Updater/core/'; $updater->recordComponentSuccessfullyUpdated('testpluginUpdates', '0.1beta'); $updater->addComponentToCheck('testpluginUpdates', '0.1'); $updater->recordComponentSuccessfullyUpdated('core', '0.1'); $updater->addComponentToCheck('core', '0.3'); $componentsWithUpdateFile = $updater->getComponentsWithUpdateFile(); $this->assertTrue(count($componentsWithUpdateFile) == 2); reset($componentsWithUpdateFile); $this->assertTrue(key($componentsWithUpdateFile) == 'core'); } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?