Example #1
0
 /**
  * Login as given roles
  *
  * @param CakeTestCase $test CakeTestCase instance
  * @param string $role role key
  * @return void
  */
 public static function login(CakeTestCase $test, $role = Role::ROLE_KEY_SYSTEM_ADMINISTRATOR)
 {
     $test->controller->Components->Auth->staticExpects($test->any())->method('user')->will($test->returnCallback(function ($key = null) use($role) {
         CakeSession::write('Auth.User', self::$roles[$role]);
         if (isset(self::$roles[$role][$key])) {
             return self::$roles[$role][$key];
         } else {
             return self::$roles[$role];
         }
     }));
     $test->controller->Components->Auth->login(['username' => self::$roles[$role]['username'], 'password' => self::$roles[$role]['password']]);
 }
 public function setUp()
 {
     parent::setUp();
     $Controller = new Controller();
     $View = new View($Controller);
     $this->Progress = new ProgressHelper($View);
 }
Example #3
0
 /**
  * End a test
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Article);
     ClassRegistry::flush();
     DebugKitDebugger::clearTimers();
 }
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->Time = new CakeTime();
     $this->_systemTimezoneIdentifier = date_default_timezone_get();
     Configure::write('Config.language', 'eng');
 }
 /**
  * Method executed after each test
  *
  */
 public function tearDown()
 {
     unset($this->Article);
     unset($this->User);
     unset($this->Tag);
     parent::tearDown();
 }
Example #6
0
/**
 * tearDown method
 *
 * @return void
 */
	public function tearDown() {
		parent::tearDown();
		Configure::write('Cache.disable', $this->_cacheDisable);
		Cache::drop('xcache');
		Cache::drop('xcache_groups');
		Cache::config('default');
	}
Example #7
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     $_SESSION = array();
     unset($this->View, $this->Session);
     CakePlugin::unload();
     parent::tearDown();
 }
Example #8
0
 /**
  * tearDown()
  *
  * @return void
  */
 public function tearDown()
 {
     if (file_exists($this->Task->bootstrap)) {
         unlink($this->Task->bootstrap);
     }
     parent::tearDown();
 }
Example #9
0
 public function tearDown()
 {
     Cache::delete(UrlCacheManager::$cacheKey, '_cake_core_');
     Cache::delete(UrlCacheManager::$cachePageKey, '_cake_core_');
     Configure::delete('UrlCache');
     parent::tearDown();
 }
Example #10
0
 /**
  * setUp
  *
  * @retun void
  * @access public
  */
 function setUp()
 {
     parent::setUp();
     $this->Formatacao = new FormatacaoHelper();
     $this->Formatacao->Time = new TimeHelper();
     $this->Formatacao->Number = new NumberHelper();
 }
 /**
  * setup test
  *
  * @return void
  */
 public function setUp()
 {
     $this->out = $this->getMock('ConsoleOutput', array(), array(), '', false);
     $this->in = $this->getMock('ConsoleInput', array(), array(), '', false);
     $this->Shell = $this->getMock('TranslationsShell', array('in', 'out', 'hr', 'err', '_stop', '_getModels'), array($this->out, $this->out, $this->in));
     parent::setUp();
 }
Example #12
0
 /**
  * endTest
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Article);
     unset($this->Post);
     ClassRegistry::flush();
 }
 public function setUp()
 {
     parent::setUp();
     $Controller = new Controller();
     $View = new View($Controller);
     $this->Tab = new BootstrapTabHelper($View);
 }
Example #14
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     unset($this->Game);
     // Supprimer le fichier chargé
     @unlink(WWW_ROOT . 'img' . DS . 'uploads' . DS . 'TestFile.png');
     parent::tearDown();
 }
Example #15
0
 /**
  * setUp
  *
  * @retun void
  * @access public
  */
 public function setUp()
 {
     parent::setUp();
     $this->Controller = new Controller(null);
     $this->View = new View($this->Controller);
     $this->Locale = new LocaleHelper($this->View, array('locale' => 'pt_BR'));
 }
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     $Folder = new Folder($this->Task->path . 'bake_test_app');
     $Folder->delete();
     unset($this->Task);
 }
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     unset($this->Task);
     ClassRegistry::flush();
     App::build();
     parent::tearDown();
 }
Example #18
0
/**
 * tearDown method
 *
 * @return void
 */
	public function tearDown() {
		parent::tearDown();
		Configure::write('log', true);
		if ($this->_restoreError) {
			restore_error_handler();
		}
	}
Example #19
0
 public function setUp()
 {
     parent::setUp();
     Configure::delete('Ajax');
     $this->Controller = new AjaxComponentTestController(new CakeRequest(), new CakeResponse());
     $this->Controller->constructClasses();
 }
Example #20
0
/**
 * tearDown
 *
 * @return void
 */
	public function tearDown() {
		parent::tearDown();
		if (!empty($this->_case)) {
			$_GET['case'] = $this->_case;
		}
		Configure::write('App', $this->_app);
	}
 /**
  * Tear Down
  * 
  * @author	Everton Yoshitani <*****@*****.**>
  * @since	1.0
  * @return	void 
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->ApiBehavior);
     unset($this->Thing);
     ClassRegistry::flush();
 }
 /**
  * SetUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('Config.language', 'deu');
     Configure::delete('Passwordable');
     Configure::write('Passwordable.auth', 'AuthTest');
     $this->User = ClassRegistry::init('Tools.ToolsUser');
     if (isset($this->User->validate['pwd'])) {
         unset($this->User->validate['pwd']);
     }
     if (isset($this->User->validate['pwd_repeat'])) {
         unset($this->User->validate['pwd_repeat']);
     }
     if (isset($this->User->validate['pwd_current'])) {
         unset($this->User->validate['pwd_current']);
     }
     if (isset($this->User->order)) {
         unset($this->User->order);
     }
     $this->User->create();
     $data = ['id' => '5', 'name' => 'admin', 'password' => Security::hash('somepwd', null, true), 'role_id' => '1'];
     $this->User->set($data);
     $result = $this->User->save();
     $this->assertTrue((bool) $result);
     Router::setRequestInfo(new CakeRequest(null, false));
 }
 public function setUp()
 {
     parent::setUp();
     $Controller = new Controller();
     $View = new View($Controller);
     $this->Gravatar = new GravatarHelper($View);
 }
Example #24
0
 /**
  * Sets up a Dbo class instance for testing
  *
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->model);
     ClassRegistry::flush();
     Configure::write('debug', $this->_debug);
 }
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $out = $this->getMock('ConsoleOutput', array(), array(), '', false);
     $in = $this->getMock('ConsoleInput', array(), array(), '', false);
     $this->Shell = $this->getMock('ApiShell', array('in', 'out', 'createFile', 'hr', '_stop'), array($out, $out, $in));
 }
Example #26
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     CakePlugin::unload();
     Router::fullBaseUrl('');
     Configure::write('App.fullBaseUrl', 'http://localhost');
 }
Example #27
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     Cache::delete('object_map', '_cake_core_');
     App::build();
     CakePlugin::unload();
 }
 public function tearDown()
 {
     parent::tearDown();
     //  終了した後のお掃除
     unset($this->PagematronComponent);
     unset($this->Controller);
 }
Example #29
0
 public function tearDown()
 {
     parent::tearDown();
     $this->Data->cleanUp();
     ClassRegistry::flush();
     Configure::write('Media', $this->oldConfig);
 }
Example #30
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Task);
     $Folder = new Folder($this->path);
     $Folder->delete();
 }