/** * setUp method * * @access public * @return void */ function setUp() { $this->Html =& new HtmlHelper(); $view =& new View(new TheHtmlTestController()); ClassRegistry::addObject('view', $view); $this->_appEncoding = Configure::read('App.encoding'); }
/** * setUp method * * @access public * @return void */ function startTest() { $view = new View(new TheGoogleStaticChartEngineTestController()); $this->GoogleStaticChartEngine = new GoogleStaticChartEngineHelper($view); $this->GoogleStaticChartEngine->Html = new HtmlHelper($view); ClassRegistry::addObject('view', $view); }
/** * Start Test * * Setup class vars for testing * * @return void */ public function startTest() { $this->ShareThis = new ShareThisHelper(); $this->ShareThis->Html = new HtmlHelper(); $this->View =& new TheView(new TheJsTestController()); ClassRegistry::addObject('view', $this->View); }
/** * setUp * * @return void */ public function setUp() { parent::setUp(); $this->View = new View(); $this->Form = new BoostCakeFormHelper($this->View); ClassRegistry::addObject('Contact', new Contact()); }
function startTest() { $this->User = new User(); $this->MockMiEmail = new MockMiEmail(); //$this->MockMiEmail->setReturnValue('send', true); ClassRegistry::addObject('MiEmail', $this->MockMiEmail); }
function setup() { $this->Menu = new MenuHelper(); $this->Menu->Html = new HtmlHelper(); $view =& new View(new TheMenuTestController()); ClassRegistry::addObject('view', $view); }
/** * Configuration method. * * In addition to configuring the settings (see $__defaults above for settings explanation), * this function also loops through the installed plugins and 'registers' those that have a * PluginNameCallback class. * * @param object $controller Controller object * @param array $settings Component settings * @access public * @return void */ public function initialize(&$controller, $settings = array()) { $this->__controller =& $controller; $this->settings = array_merge($this->__defaults, $settings); if (empty($this->settings['priority'])) { $this->settings['priority'] = Configure::listobjects('plugin'); } else { foreach (Configure::listobjects('plugin') as $plugin) { if (!in_array($plugin, $this->settings['priority'])) { array_push($this->settings['priority'], $plugin); } } } foreach ($this->settings['priority'] as $plugin) { $file = Inflector::underscore($plugin) . '_callback'; $className = $plugin . 'Callback'; if (App::import('File', $className, true, array(APP . 'plugins' . DS . Inflector::underscore($plugin)), $file . '.php')) { if (class_exists($className)) { $class = new $className(); ClassRegistry::addObject($className, $class); $this->__registered[] = $className; } } } /** * Called before the controller's beforeFilter method. */ $this->executeCallbacks('initialize'); }
/** * Initialization method. Attaches our error handlers into the current * execution and loads all of our error listeners. * * @return null * @access public */ public function initialize() { // Tell ClassRegistry about ourself ClassRegistry::addObject('Referee.Whistle', $this); // Get our grubby paws on the errors and load our listeners $this->attachHandlers(); $this->loadListeners(); }
/** * startTest * * @return void */ public function startTest() { $this->View = new View($controller = null); ClassRegistry::addObject('view', $this->View); Configure::write('Favorites', array('types' => array('favorite' => 'Article', 'watch' => 'Article'), 'defaultTexts' => array('favorite' => 'Favorite it', 'watch' => 'Watch it'), 'modelCategories' => array('Article'))); $this->Favorites = new FavoritesHelper($this->View); $this->Favorites->Html = new HtmlHelper($this->View); }
/** * setUp method * * The mailHide keys have to be in a certain format see https://groups.google.com/group/recaptcha/browse_thread/thread/3edc0ad4adc33073?pli=1#msg_73107610db1a1c15 * * @return void */ public function setUp() { Configure::write('Recaptcha.mailHide.publicKey', '01J_tiDKknxUV8w-2NbVFNAQ=='); Configure::write('Recaptcha.mailHide.privateKey', '411744faf004d447f8208fc51159dc03'); $this->View = new View(new PostsTestController()); ClassRegistry::addObject('view', $this->View); $this->Recaptcha = new RecaptchaHelper($this->View); }
function setUp() { $this->Javascript = new JavascriptHelper(); $this->Javascript->Html = new HtmlHelper(); $this->Javascript->Form = new FormHelper(); $view =& new View(new TheJsTestController()); ClassRegistry::addObject('view', $view); }
function setUp() { $this->Controller =& new EmailTestController(); restore_error_handler(); @$this->Controller->_initComponents(); set_error_handler('simpleTestErrorHandler'); $this->Controller->Email->startup($this->Controller); ClassRegistry::addObject('view', new View($this->Controller)); }
public function setUp() { parent::setUp(); $Controller = new Controller(); $View = new View($Controller); $this->GanacheFormHelper = new GanacheFormHelper($View); $this->FormHelper = new FormHelper($View); ClassRegistry::addObject('Contact', new Contact()); }
/** * Construction method. * @param array $mappings * @return null * @access public */ public function __construct($mappings = array()) { parent::__construct(); // Grab our View object for use later... $this->View = ClassRegistry::getObject('view'); // Merge our mappings together... $this->mappings = am($this->mappings, $mappings); // Add ourself to the ClassRegistry in case anyone wants to use us ClassRegistry::addObject('Analogue', $this); }
/** * setUp method * * @return void */ function setUp() { $request = new CakeRequest('controller_posts/index'); $response = new CakeResponse(); $this->Controller = new ArticlesTestController($request, $response); $this->Controller->modelClass = 'Article'; $this->Controller->Referer = new RefererComponent(); $this->Controller->Referer->initialize($this->Controller, array()); ClassRegistry::addObject('view', new View($this->Controller)); }
public function setUp() { $this->Controller = $this->getMock('AccessLimitTestController', array('dispatchMethod'), array($this->getMock('CakeRequest', array('is'), array(null, false)), $this->getMock('CakeResponse'))); $this->Model = $this->getMockForModel('Security.AccessLimit'); ClassRegistry::addObject('AccessLimit', $this->Model); $collection = new ComponentCollection(); $collection->init($this->Controller); $this->Controller->Components->init($this->Controller); $this->AccessLimit = $this->Controller->AccessLimit; }
public function startTest($method) { parent::startTest($method); $this->loadFixtures('Roster', 'Payment', 'PaymentOption', 'Involvement', 'PaymentType', 'Role', 'RolesRoster', 'RosterStatus'); $CreditCard = new MockRosterCreditCard(); $CreditCard->setReturnValue('save', true); ClassRegistry::removeObject('CreditCard'); ClassRegistry::addObject('CreditCard', $CreditCard); $this->Roster =& ClassRegistry::init('Roster'); }
/** * startTest method * * @access public * @return void */ function startTest() { $this->Js =& new JsHelper('JsBase'); $this->Js->Html =& new HtmlHelper(); $this->Js->Form =& new FormHelper(); $this->Js->Form->Html =& new HtmlHelper(); $this->Js->JsBaseEngine =& new JsBaseEngineHelper(); $view =& new JsHelperMockView(); ClassRegistry::addObject('view', $view); }
function setup(&$model, $settings = array()) { if (($this->_ImageUplodaer = ClassRegistry::getObject('ImageUploader')) === null) { $this->_ImageUploader = new ImageUplodaer(); $this->ImageUploader->initialize($settings); ClassRegistry::addObject('ImageUploader', $this->_ImageUploader); } else { $this->_ImageUplodaer->_set($settings); } }
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()); }
/** * setUp method * * @return void */ function setup() { // "Global" keys for testing Configure::write('Recaptcha.publicKey', '6LdsGskSAAAAAPz645yuA9Bwj4BgBkWtWJZj_iWa'); Configure::write('Recaptcha.privateKey', '6LdsGskSAAAAANEUP5yhcJ-XzbeUqSySGKfWH_Zm'); $view = new View(new PostsTestController()); $this->Recaptcha = new RecaptchaHelper(); $this->Recaptcha->Html = new RecaptchaTestHtmlHelper(); $this->Recaptcha->Form = new FormHelper(); ClassRegistry::addObject('view', $view); }
/** * (non-PHPdoc) * @see cake/tests/lib/CakeTestCase#startTest($method) */ public function setUp() { parent::setUp(); $this->Controller = new Controller(); $this->View = new View($this->Controller); $this->Rating = new RatingHelper($this->View); $this->Rating->Form = new FormHelper($this->View); $this->Rating->Html = new HtmlHelper($this->View); $this->Rating->Form->Html = $this->Rating->Html; ClassRegistry::addObject('view', $this->View); }
/** * undocumented function * * @return void * @access public */ function beforeFilter() { if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) { Assert::false($this->name == 'App', '404'); Assert::true(!!$this->action, '404'); } $this->Session = $this->AppSession; ClassRegistry::addObject('Component.Session', $this->Session); ClassRegistry::addObject('Component.RequestHandler', $this->RequestHandler); ClassRegistry::addObject('Component.Cookie', $this->Cookie); ClassRegistry::addObject('Component.Email', $this->Email); ClassRegistry::addObject('Component.Pgp', $this->Pgp); $this->_loadPermissions(); $this->_setLanguage(); $this->_loadPluginConfigs(); if ($this->isAdmin()) { $this->layout = 'admin'; } if (defined('CAKEPHP_UNIT_TEST_EXECUTION')) { return; } $this->RequestHandler->setContent('list', 'text/html'); if (empty($this->ignoreUserSession)) { $rules = Configure::read('App.userPermissions.' . User::get('Role.name')); Assert::notEmpty($rules, '500'); $canAccess = Common::requestAllowed($this->name, $this->action, $rules, true); if (!$canAccess) { Assert::true(User::is('guest'), '403'); if ($this->isOkForSessionRedirect()) { $this->Session->write($this->loginRedirectSesskey, $this->here); } $this->Session->write('cant_access', true); return $this->redirect('/admin/auth/login', '403', true); } if (!User::is('guest') && $this->name == 'auth' && $this->action == 'login') { $url = '/admin/home'; if ($this->Session->check($this->loginRedirectSesskey)) { $url = $this->Session->read($this->loginRedirectSesskey); } $this->redirect($url); } } $here = $this->params['url']['url']; if (!empty($here) && $here[0] != '/') { $here = '/' . $here; } $this->setJson('here', $here); $ajax = $isAjax = false; if ($this->isAjax()) { $this->layout = 'ajax'; $ajax = $isAjax = true; } $this->set(compact('ajax', 'isAjax', 'here')); }
/** * 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(); }
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()); }
function testRecursiveEncode() { $testData = array('post' => array('Post' => array('id' => 1, 'title' => 'test title', 'created' => date('Y-m-d H:m:s', strtotime('now'))), 'User' => array('id' => 1, 'username' => 'john', 'created' => date('Y-m-d H:m:s', strtotime('now'))))); $data = Set::map(array('Result' => $testData)); $expected = array($data->post, 3, 'Array'); $result = $this->AmfCallback->encode($data->post); $this->assertEqual($expected, $result); ClassRegistry::addObject('post', new Post()); $expected = array($data->post->Post, 3, 'models.Post'); $result = $this->AmfCallback->encode($data->post->Post); $this->assertEqual($expected, $result); }
/** * startTest method * * @access public * @return void */ function startTest() { $this->_asset = Configure::read('Asset.timestamp'); Configure::write('Asset.timestamp', false); $this->Js = new JsHelper('JsBase'); $this->Js->Html = new HtmlHelper(); $this->Js->Form = new FormHelper(); $this->Js->Form->Html = new HtmlHelper(); $this->Js->JsBaseEngine = new JsBaseEngineHelper(); $view =& new JsHelperMockView(); ClassRegistry::addObject('view', $view); }
/** * Initialize method * * @return null * @access public */ public function initialize() { // Call our parent's initialize() parent::initialize(); // Merge any parameters into our settings $this->_mergeSettings($this->params); // Set our debug and silent levels $this->debug = array_key_exists('debug', $this->params); $this->silent = array_key_exists('silent', $this->params); // Attach ourselves to the ClassRegistry as 'Shell' ClassRegistry::addObject('Shell', $this); }
/** * setup * * @return void */ public function setUp() { parent::setUp(); $this->Collection = $this->getMock('ComponentCollection'); $this->auth = new TwitterAuthenticate($this->Collection, array('userModel' => 'TwitterUser', 'datasource' => $this->testDatasourceName, 'authenticate' => false)); $this->response = $this->getMock('CakeResponse'); $this->TwimOauth = $this->getMock('TwimOauth', array('getRequestToken', 'getAccessToken')); $this->TwimOauth->setDatasource($this->testDatasourceName); ClassRegistry::addObject('TwimOauth', $this->TwimOauth); $this->TwitterUser = ClassRegistry::init('TwitterAuthenticateTwitterUser'); ClassRegistry::addObject('TwitterUser', $this->TwitterUser); }
public function startTest($method) { parent::startTest($method); $this->loadFixtures('Attachment'); $this->SysEmail =& ClassRegistry::init('SysEmail'); $this->Document =& ClassRegistry::init('Document'); // detach behaviors so they get deleted properly (since the files don't really exist) $this->Document->Behaviors->detach('Media.Transfer'); $this->Document->Behaviors->detach('Media.Polymorphic'); $this->Document->Behaviors->detach('Media.Coupler'); ClassRegistry::removeObject('Document'); ClassRegistry::addObject('Document', $this->Document); }