public function setUp() { parent::setUp(); Configure::write('Routing.prefixes', ['admin']); Router::reload(); $this->Html = new HtmlExtHelper(new View(null)); }
public function testIs() { $result = Reveal::is('App.online'); $expected = !in_array(gethostbyname('google.com'), array('google.com', false)); $this->assertEqual($result, $expected); $result = Reveal::is('DebugKit.loaded'); $expected = CakePlugin::loaded('DebugKit'); $this->assertEqual($result, $expected); $result = Reveal::is(array('OR' => array('DebugKit.enabled', 'DebugKit.automated'))); $expected = Configure::read('debug') || Configure::read('DebugKit.forceEnable') || Configure::read('DebugKit.autoRun'); $this->assertEqual($result, $expected); $_GET['debug'] = 'true'; $this->assertTrue(Reveal::is('DebugKit.requested')); $result = Reveal::is('DebugKit.loaded', array('OR' => array('DebugKit.enabled', array('AND' => array('DebugKit.automated', 'DebugKit.requested'))))); $expected = CakePlugin::loaded('DebugKit') || Configure::read('debug') || Configure::read('DebugKit.forceEnable') || Configure::read('DebugKit.autoRun') && isset($_GET['debug']) && 'true' == $_GET['debug']; $this->assertEqual($result, $expected); $this->assertEqual(Reveal::is('DebugKit.running'), $expected); $request = new CakeRequest(); Router::setRequestInfo($request->addParams(array('controller' => 'pages', 'action' => 'display', 'pass' => array('home')))); $result = Reveal::is('Page.front'); $this->assertTrue($result); Router::reload(); $request = new CakeRequest(); Router::setRequestInfo($request->addParams(array('prefix' => 'admin', 'admin' => true))); $result = Reveal::is('Page.prefixed'); $this->assertTrue($result); Router::reload(); $request = new CakeRequest(); Router::setRequestInfo($request->addParams(array('controller' => 'users', 'action' => 'login'))); $result = Reveal::is('Page.login'); $this->assertTrue($result); $this->assertTrue(Reveal::is('Page.test')); }
/** * 指定されたURLに対応しRouterパース済のCakeRequestのインスタンスを返す * * @param string $url URL * @return CakeRequest */ protected function _getRequest($url) { Router::reload(); $request = new CakeRequest($url); // コンソールからのテストの場合、requestのパラメーターが想定外のものとなってしまうので調整 if (isConsole()) { $baseUrl = Configure::read('App.baseUrl'); if ($request->url === false) { $request->here = $baseUrl . '/'; } elseif (preg_match('/^' . preg_quote($request->webroot, '/') . '/', $request->here)) { $request->here = $baseUrl . '/' . preg_replace('/^' . preg_quote($request->webroot, '/') . '/', '', $request->here); } if ($baseUrl) { if (preg_match('/^\\//', $baseUrl)) { $request->base = $baseUrl; } else { $request->base = '/' . $baseUrl; } $request->webroot = $baseUrl; } else { $request->base = ''; $request->webroot = '/'; } } Router::setRequestInfo($request); $params = Router::parse($request->url); $request->addParams($params); return $request; }
/** * start a test * * @return void */ public function setUp() { parent::setUp(); $this->_pluginPath = App::pluginPath('AssetCompress'); $this->_testFiles = $this->_pluginPath . 'Test' . DS . 'test_files' . DS; $testFile = $this->_testFiles . 'Config' . DS . 'config.ini'; AssetConfig::clearAllCachedKeys(); Cache::drop(AssetConfig::CACHE_CONFIG); Cache::config(AssetConfig::CACHE_CONFIG, array( 'path' => TMP, 'prefix' => 'asset_compress_test_', 'engine' => 'File' )); $controller = null; $request = new CakeRequest(null, false); $request->webroot = ''; $view = new View($controller); $view->request = $request; $this->Helper = new AssetCompressHelper($view, array('noconfig' => true)); $Config = AssetConfig::buildFromIniFile($testFile); $this->Helper->config($Config); $this->Helper->Html = new HtmlHelper($view); Router::reload(); Configure::write('debug', 2); }
public function setUp() { parent::setUp(); Router::reload(); $this->View = new View(); $this->Flash = new FlashHelper($this->View); }
/** * tearDown * * @return void */ public function tearDown() { unset($this->BlogBaser); unset($this->BlogContent); Router::reload(); parent::tearDown(); }
/** * Loads routes and resets if the test case dictates it should * * @return void */ protected function _loadRoutes() { parent::_loadRoutes(); if (!$this->loadRoutes) { Router::reload(); } }
function setUp() { Router::reload(); $this->PostsController = new PostsController(); $this->PostsController->index(); $this->view = new View($this->PostsController); }
/** * tearDown * * @return void */ public function tearDown() { unset($this->Toolbar, $this->Controller); ClassRegistry::flush(); Router::reload(); TestFireCake::reset(); }
public function setUp() { parent::setUp(); Router::reload(); $View = new View(null); $this->Common = new CommonHelper($View); $this->Html = new CommonHelper($View); }
public function tearDown() { parent::tearDown(); Configure::write('Security', $this->_initialState['Security']); Configure::write('Opauth', $this->_initialState['Opauth']); Router::reload(); unset($this->Controller); }
/** * start a test * * @return void **/ function startTest() { $this->_pluginPath = App::pluginPath('AssetCompress'); $testFile = $this->_pluginPath . 'tests' . DS . 'test_files' . DS . 'config' . DS . 'config.ini'; $this->Helper = new AssetCompressHelper(array('iniFile' => $testFile)); $this->Helper->Html = new HtmlHelper(); Router::reload(); Configure::write('debug', 2); }
function setUp() { Router::reload(); $this->Controller = new Controller(); $this->PostsController = new ThemePostsController(); $this->PostsController->viewPath = 'posts'; $this->PostsController->index(); $this->ThemeView = new ThemeView($this->PostsController); }
/** * Setup * * @return void */ public function setUp() { Configure::write('App.linkMap', array('blogSlug' => array('preset' => array('controller' => 'blog_posts', 'action' => 'view'), 'alias' => 'BlogPost', 'fieldMap' => array('id' => '{alias}.id', 'slug' => '{alias}.slug', 'categorySlug' => 'Category.slug'), 'titleField' => 'BlogPost.title'))); $null = null; $this->View = new View(null); $this->View->Helpers->load('Html'); $this->Link = new LinkHelper($this->View); Router::reload(); Router::connect('/article/:categorySlug/:slug-:id', array('controller' => 'blog_posts', 'action' => 'view')); }
/** * startTest method * * @return void * @access public */ public function startTest() { Router::reload(); $this->Controller = new Controller(); $this->View = new View($this->Controller); $this->Controller->here = $this->View->here = '/'; $this->Controller->params = $this->View->params = array('base' => '/', 'here' => '/', 'webroot' => '/', 'passedArgs' => array(), 'namedArgs' => array()); $this->Menu = new TestMenuHelper(); $this->Menu->Html = new HtmlHelper(); }
function setUp() { ClassRegistry::flush(); Router::reload(); $null = null; $this->View = new View($null); $this->Helper = new Helper(); $this->Cleaner = new CleanerHelper(); $this->Cleaner->Javascript = new JavascriptHelper(); }
/** * setup create a request object to get out of router later. * * @return void */ public function setUp() { parent::setUp(); App::build(array('View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)), App::RESET); Router::reload(); $request = new CakeRequest(null, false); $request->base = ''; Router::setRequestInfo($request); Configure::write('debug', 2); }
/** * setup * * @return void **/ function setup() { parent::setup(); $this->_pluginPath = dirname(dirname(dirname(dirname(dirname(__FILE__))))); $controller = new Controller(); $view = new View($controller); $view->set('basePath', $this->_pluginPath); $this->ApiDoc = new ApiDocHelper($view); Router::reload(); Router::parse('/'); }
function setUp() { ClassRegistry::flush(); Router::reload(); $null = null; $this->View = new View($null); $this->Helper = new Helper(); ClassRegistry::addObject('HelperTestPost', new HelperTestPost()); ClassRegistry::addObject('HelperTestComment', new HelperTestComment()); ClassRegistry::addObject('HelperTestTag', new HelperTestTag()); }
public function setUp() { parent::setUp(); Configure::write('UrlCache.active', true); Configure::write('UrlCache.pageFiles', true); Configure::write('UrlCache.verbosePrefixes', true); Configure::write('Routing.prefixes', array('admin')); Router::reload(); $this->HtmlHelper = new MyHelper(new View(new Controller(new CakeRequest('/test', false)))); $this->HtmlHelper->beforeRender('foo'); }
/** * setup create a request object to get out of router later. * * @return void */ public function setUp() { App::build(array('View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)), true); Router::reload(); $request = new CakeRequest(null, false); $request->base = ''; Router::setRequestInfo($request); $this->_debug = Configure::read('debug'); $this->_error = Configure::read('Error'); Configure::write('debug', 2); }
/** * startTest * * @return void **/ function startTest() { $this->_pluginPath = dirname(dirname(dirname(dirname(__FILE__)))); $controller = new Controller(); $view = new View($controller); $view->set('basePath', $this->_pluginPath); $this->ApiDoc = new ApiDocHelper(); $this->ApiDoc->Html = new HtmlHelper(); Router::reload(); Router::parse('/'); }
/** * startTest * * @return void * @access public */ public function startTest() { ClassRegistry::flush(); Router::reload(); $null = null; $this->View = new View($null); ClassRegistry::removeObject('view'); ClassRegistry::addObject('view', $this->View); $this->TinyMce = new TinyMceHelper(); $this->TinyMce->Html = new HtmlHelper(); }
/** * Setup * * @return void */ public function setUp() { ClassRegistry::flush(); Router::reload(); $null = null; $this->View = new View(null); $this->View->Helpers->load('Time'); $this->View->Helpers->load('Html'); $this->View->Helpers->load('Paginator'); $this->Table = new TableHelper($this->View); }
/** * setup create a request object to get out of router later. * * @return void */ function setUp() { App::build(array('views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS, TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS)), true); Router::reload(); $request = new CakeRequest(null, false); $request->base = ''; Router::setRequestInfo($request); $this->_debug = Configure::read('debug'); $this->_error = Configure::read('Error'); Configure::write('debug', 2); }
/** * start a test * * @return void **/ function startTest() { $this->_pluginPath = App::pluginPath('AssetCompress'); $testFile = $this->_pluginPath . 'tests' . DS . 'test_files' . DS . 'config' . DS . 'config.ini'; AssetConfig::clearAllCachedKeys(); $this->Helper = new AssetCompressHelper(array('noconfig' => true)); $Config = AssetConfig::buildFromIniFile($testFile); $this->Helper->config($Config); $this->Helper->Html = new HtmlHelper(); Router::reload(); Configure::write('debug', 2); }
/** * setup create a request object to get out of router later. * * @return void */ public function setUp() { parent::setUp(); App::build(array('View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)), App::RESET); Router::reload(); $request = new CakeRequest(NULL, FALSE); $request->base = ''; Router::setRequestInfo($request); Configure::write('debug', 2); CakeLog::disable('stdout'); CakeLog::disable('stderr'); }
function setUp() { parent::setUp(); Router::reload(); Router::connect('/projects/:project_id/timelog/:action/*', array('controller' => 'timelog'), array('project_id' => '.+')); Router::connect('/projects/:project_id/timelog/:action/:page/:sort/:direction/*', array('controller' => 'timelog'), array('project_id' => '.+')); Router::connect('timelog/:action/:id/*', array('controller' => 'timelog')); $this->Timelog = new TimelogHelper(); $this->Timelog->Html =& new HtmlHelper(); $this->Controller =& new TimelogTestController(); $this->View =& new View($this->Controller); }
function setUp() { Router::reload(); $this->Ajax = new AjaxHelper(); $this->Ajax->Html = new HtmlHelper(); $this->Ajax->Form = new FormHelper(); $this->Ajax->Javascript = new JavascriptHelper(); $this->Ajax->Form->Html =& $this->Ajax->Html; $view = new View(new AjaxTestController()); ClassRegistry::addObject('view', $view); ClassRegistry::addObject('PostAjaxTest', new PostAjaxTest()); }
public function setUp() { ClassRegistry::flush(); Router::reload(); $null = null; $this->View = new View(null); $this->Helper = new Helper($this->View); $this->Helper = new Helper($this->View); $this->Cleaner = new CleanerHelper($this->View); $this->Cleaner->Html = new HtmlHelper($this->View); $this->Cleaner->Html->request = new CakeRequest(null, false); $this->Cleaner->Html->request->webroot = ''; }