コード例 #1
0
 /**
  * test timestamp enforcement for script tags with plugin syntax.
  *
  * @return void
  */
 public function testPluginScriptTimestamping()
 {
     Plugin::load('TestPlugin');
     $pluginPath = App::pluginPath('TestPlugin');
     $pluginJsPath = $pluginPath . 'webroot/js';
     $this->skipIf(!is_writable($pluginJsPath), $pluginJsPath . ' is not Writable, timestamp testing has been skipped.');
     Configure::write('debug', true);
     Configure::write('Asset.timestamp', true);
     touch($pluginJsPath . DS . '__cake_js_test.js');
     $timestamp = substr(strtotime('now'), 0, 8);
     $result = $this->Html->script('TestPlugin.__cake_js_test', array('once' => false));
     $this->assertRegExp('/test_plugin\\/js\\/__cake_js_test.js\\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
     Configure::write('debug', false);
     Configure::write('Asset.timestamp', 'force');
     $result = $this->Html->script('TestPlugin.__cake_js_test', array('once' => false));
     $this->assertRegExp('/test_plugin\\/js\\/__cake_js_test.js\\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
     unlink($pluginJsPath . DS . '__cake_js_test.js');
     Configure::write('Asset.timestamp', false);
     Plugin::unload('TestPlugin');
 }
コード例 #2
0
ファイル: PhpConfig.php プロジェクト: ripzappa0924/carte0.0.1
 /**
  * Get file path
  *
  * @param string $key The identifier to write to. If the key has a . it will be treated
  *  as a plugin prefix.
  * @return string Full file path
  */
 protected function _getFilePath($key)
 {
     if (substr($key, -4) === '.php') {
         $key = substr($key, 0, -4);
     }
     list($plugin, $key) = pluginSplit($key);
     $key .= '.php';
     if ($plugin) {
         $file = App::pluginPath($plugin) . 'Config' . DS . $key;
     } else {
         $file = $this->_path . $key;
     }
     return $file;
 }
コード例 #3
0
ファイル: AppTest.php プロジェクト: ripzappa0924/carte0.0.1
 /**
  * test that pluginPath can find paths for plugins.
  *
  * @return void
  */
 public function testPluginPath()
 {
     Plugin::load(array('TestPlugin', 'TestPluginTwo'));
     $path = App::pluginPath('TestPlugin');
     $expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS;
     $this->assertPathEquals($expected, $path);
     $path = App::pluginPath('TestPluginTwo');
     $expected = TEST_APP . 'Plugin' . DS . 'TestPluginTwo' . DS;
     $this->assertPathEquals($expected, $path);
 }