本文整理汇总了PHP中CakeTestCase类的典型用法代码示例。如果您正苦于以下问题:PHP CakeTestCase类的具体用法?PHP CakeTestCase怎么用?PHP CakeTestCase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CakeTestCase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
/**
* 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']]);
}
示例2: setUp
public function setUp()
{
parent::setUp();
$Controller = new Controller();
$View = new View($Controller);
$this->Progress = new ProgressHelper($View);
}
示例3: tearDown
/**
* End a test
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
unset($this->Article);
ClassRegistry::flush();
DebugKitDebugger::clearTimers();
}
示例4: setUp
/**
* setUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
$this->Time = new CakeTime();
$this->_systemTimezoneIdentifier = date_default_timezone_get();
Configure::write('Config.language', 'eng');
}
示例5: tearDown
/**
* Method executed after each test
*
*/
public function tearDown()
{
unset($this->Article);
unset($this->User);
unset($this->Tag);
parent::tearDown();
}
示例6: tearDown
/**
* 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');
}
示例7: tearDown
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
$_SESSION = array();
unset($this->View, $this->Session);
CakePlugin::unload();
parent::tearDown();
}
示例8: tearDown
/**
* tearDown()
*
* @return void
*/
public function tearDown()
{
if (file_exists($this->Task->bootstrap)) {
unlink($this->Task->bootstrap);
}
parent::tearDown();
}
示例9: tearDown
public function tearDown()
{
Cache::delete(UrlCacheManager::$cacheKey, '_cake_core_');
Cache::delete(UrlCacheManager::$cachePageKey, '_cake_core_');
Configure::delete('UrlCache');
parent::tearDown();
}
示例10: setUp
/**
* setUp
*
* @retun void
* @access public
*/
function setUp()
{
parent::setUp();
$this->Formatacao = new FormatacaoHelper();
$this->Formatacao->Time = new TimeHelper();
$this->Formatacao->Number = new NumberHelper();
}
示例11: setUp
/**
* 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();
}
示例12: tearDown
/**
* endTest
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
unset($this->Article);
unset($this->Post);
ClassRegistry::flush();
}
示例13: setUp
public function setUp()
{
parent::setUp();
$Controller = new Controller();
$View = new View($Controller);
$this->Tab = new BootstrapTabHelper($View);
}
示例14: tearDown
/**
* 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();
}
示例15: setUp
/**
* 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'));
}