本文整理匯總了PHP中CakeTestCase::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP CakeTestCase::__construct方法的具體用法?PHP CakeTestCase::__construct怎麽用?PHP CakeTestCase::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CakeTestCase
的用法示例。
在下文中一共展示了CakeTestCase::__construct方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* @brief setup the test case and try catch any errors
*
* CakePHP just throws errors all over if there is a missing fixture.
* Here we try and catch any errors and display them so that its easier
* to fix.
*
* @access public
*
* @return void
*/
public function __construct()
{
parent::__construct();
if (is_subclass_of($this, 'AppControllerTestCase')) {
try {
$this->AppTest = new AppTest($this);
} catch (AppTestException $e) {
pr($e->error());
exit;
}
}
}
示例2: __construct
/**
* {@inheritDoc}
*/
public function __construct($name = null, array $data = array(), $dataName = '')
{
parent::__construct($name, $data, $dataName);
// ブラウザと、コンソールでCakeRequestの內容が違うので一旦トップページとして初期化する
Configure::write('debug', 1);
Configure::write('App.baseUrl', '');
$this->_getRequest('/');
// =====================================================================
// 上記のBaserTestCase::_getRequest()実行時、 routes.php が呼び出され、
// Pageモデル等が、テストモードでない狀態でインスタンス化されてしまうので一旦、
// ClassRegistry を初期化する
// =====================================================================
ClassRegistry::flush();
}
示例3: __construct
/**
* construct
*
* @param string $name
* @param array $data
* @param string $dataName
* @return void
*/
public function __construct($name = null, array $data = array(), $dataName = '')
{
// =====================================================================
// Router::url() を內部的に利用するテストを実施した場合、Baser/Config/routes.php
// が呼び出され、そこで利用されている PluginContent / Page モデルを利用する事になる。
// その際、fixture で接続先を test に切り替えた PluginContent / Page を利用しないと
// missing table となってい、原因がつかみにくい為、利用していない場合は強製的に
// 利用する設定とした。
// =====================================================================
if (!isset($this->fixtures) || !in_array('baser.Default.PluginContent', $this->fixtures)) {
$this->fixtures[] = 'baser.Default.PluginContent';
}
if (!isset($this->fixtures) || !in_array('baser.Default.Page', $this->fixtures)) {
$this->fixtures[] = 'baser.Default.Page';
}
parent::__construct($name, $data, $dataName);
}
示例4: __construct
/**
* Constructor
*
* If a class is extending AppTestCase it will merge these with the extending classes
* so that you don't have to put the plugin fixtures into the AppTestCase
*
* @return void
*/
public function __construct()
{
parent::__construct();
if (is_subclass_of($this, 'AppTestCase')) {
$parentClass = get_parent_class($this);
$parentVars = get_class_vars($parentClass);
if (isset($parentVars['fixtures'])) {
$this->fixtures = array_unique(array_merge($parentVars['fixtures'], $this->fixtures));
}
if (!empty($this->plugin)) {
$this->dependedFixtures = $this->solveDependancies($this->plugin);
}
if (!empty($this->dependedFixtures)) {
foreach ($this->dependedFixtures as $plugin) {
$fixtures = $this->loadConfig('fixtures', $plugin);
if (!empty($fixtures)) {
$this->fixtures = array_unique(array_merge($this->fixtures, $fixtures));
}
}
}
}
}
示例5: __construct
/**
* Constructor
*
* If a class is extending AppTestCase it will merge these with the extending classes
* so that you don't have to put the plugin fixtures into the AppTestCase
*
* @return void
*/
public function __construct()
{
parent::__construct();
if (is_subclass_of($this, 'AppTestCase')) {
$parentClass = get_parent_class($this);
$parentVars = get_class_vars($parentClass);
if (isset($parentVars['fixtures'])) {
$this->fixtures = array_unique(array_merge($parentVars['fixtures'], $this->fixtures));
}
if (isset($parentVars['fixtureGroups'])) {
$this->fixtureGroups = array_unique(array_merge($parentVars['fixtureGroups'], $this->fixtureGroups));
}
if (isset($parentVars['fixtureGroupsConfig'])) {
$this->fixtureGroupsConfig = array_unique(array_merge($parentVars['fixtureGroupsConfig'], $this->fixtureGroupsConfig));
}
if (!empty($this->plugin)) {
$this->dependedFixtures = $this->solveDependancies($this->plugin);
}
if (!empty($this->dependedFixtures)) {
foreach ($this->dependedFixtures as $plugin) {
$fixtures = $this->loadConfig('fixtures', $plugin);
if (!empty($fixtures)) {
$this->fixtures = array_unique(array_merge($this->fixtures, $fixtures));
}
}
}
// inject Configure::read('fixtures');
$configuredFixtures = Configure::read('fixtures');
if (is_array($configuredFixtures) && !empty($configuredFixtures)) {
$this->fixtures = array_unique(array_merge($this->fixtures, $configuredFixtures));
}
// inject Configure::read('fixtureGroups');
$configuredFixtureGroups = Configure::read('fixtureGroups');
if (is_array($configuredFixtureGroups) && !empty($configuredFixtureGroups)) {
$this->fixtureGroups = array_unique(array_merge($this->fixtureGroups, $configuredFixtureGroups));
}
// inject Configure::read('fixtureGroups');
$configuredFixtureGroupsConfig = Configure::read('fixtureGroupsConfig');
if (is_array($configuredFixtureGroupsConfig) && !empty($configuredFixtureGroupsConfig)) {
$this->fixtureGroupsConfig = Set::merge($this->fixtureGroupsConfig, $configuredFixtureGroupsConfig);
}
// inject the fixtureGroups
foreach ($this->fixtureGroups as $group) {
if (!array_key_exists($group, $this->fixtureGroupsConfig)) {
throw new OutOfBoundsException("Icing.AppTestCase.construct() - unable to find \$group '{$group}' in fixtureGroupsConfig");
}
$this->fixtures = array_unique(array_merge($this->fixtures, $this->fixtureGroupsConfig[$group]));
}
}
}
示例6: __construct
/**
* SqlViewTestCase constructor.
*
* @param null $name
* @param array $data
* @param string $dataName
*/
public function __construct($name = null, array $data = array(), $dataName = '')
{
$this->_sqlViewFixtureHandler = new SqlViewFixtureHandler();
$this->_sqlViewFixtureHandler->init($this);
parent::__construct($name, $data, $dataName);
}
示例7:
function __construct()
{
$this->fixtures = $this->getFixtures();
parent::__construct();
}
示例8: __construct
/**
* Constructor
*
* If a class is extending AppTestCase it will merge these with the extending classes
* so that you don't have to put the plugin fixtures into the AppTestCase
*
* @return void
*/
public function __construct()
{
parent::__construct();
$this->checkAppRequirements();
if (!empty($this->fixtures) || false === $this->fixtures) {
return;
}
$fixtures = $this->loadConfig('fixtures');
if (!empty($fixtures)) {
$this->fixtures = array_unique(array_merge($this->fixtures, $fixtures));
}
if (is_subclass_of($this, __CLASS__)) {
$parentClass = get_parent_class($this);
$parentVars = get_class_vars($parentClass);
if (isset($parentVars['fixtures'])) {
$this->fixtures = array_unique(array_merge($parentVars['fixtures'], $this->fixtures));
}
if (!empty($this->plugin)) {
$this->pluginDependencies = $this->solveDependencies($this->plugin);
}
if (!empty($this->pluginDependencies)) {
foreach ($this->pluginDependencies as $plugin) {
$fixtures = $this->loadConfig('fixtures', $plugin);
if (!empty($fixtures)) {
$this->fixtures = array_unique(array_merge($this->fixtures, $fixtures));
}
}
}
}
}
示例9: __construct
public function __construct($name = NULL, array $data = array(), $dataName = '')
{
parent::__construct($name, $data, $dataName);
}