本文整理汇总了PHP中yiiunit\TestCase::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP TestCase::setUp方法的具体用法?PHP TestCase::setUp怎么用?PHP TestCase::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yiiunit\TestCase
的用法示例。
在下文中一共展示了TestCase::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
parent::setUp();
$_SERVER['SCRIPT_FILENAME'] = "/index.php";
$_SERVER['SCRIPT_NAME'] = "/index.php";
$this->mockWebApplication();
}
示例2: setUp
protected function setUp()
{
parent::setUp();
$this->security = new ExposedSecurity();
$this->security->derivationIterations = 1000;
// speed up test running
}
示例3: setUp
protected function setUp()
{
parent::setUp();
$this->_cacheController = Yii::createObject(['class' => 'yiiunit\\framework\\console\\controllers\\CacheConsoledController', 'interactive' => false], [null, null]);
//id and module are null
$this->mockApplication(['components' => ['firstCache' => 'yii\\caching\\ArrayCache', 'secondCache' => 'yii\\caching\\ArrayCache']]);
}
示例4: setUp
protected function setUp()
{
parent::setUp();
$this->mockApplication();
Yii::$app->set('db', ['class' => Connection::className(), 'dsn' => 'sqlite::memory:']);
Yii::$app->db->createCommand()->createTable('session', ['id' => 'string', 'expire' => 'integer', 'data' => 'text', 'user_id' => 'integer'])->execute();
}
示例5: setUp
protected function setUp()
{
parent::setUp();
IntlTestHelper::setIntlStatus($this);
$this->mockApplication(['timeZone' => 'UTC', 'language' => 'ru-RU']);
$this->formatter = new Formatter(['locale' => 'en-US']);
}
示例6: setUp
protected function setUp()
{
parent::setUp();
$this->mockApplication();
Yii::setAlias('@testWeb', '/');
Yii::setAlias('@testWebRoot', '@yiiunit/data/web');
}
示例7: setUp
public function setUp()
{
$dsn = getenv('DB_DRIVER') . ':host=' . getenv('DB_HOST') . ';dbname=' . getenv('DB_NAME');
$this->databaseConfig = ['class' => Connection::class, 'dsn' => $dsn, 'username' => getenv('DB_USERNAME'), 'password' => getenv('DB_PASSWORD'), 'charset' => 'utf8'];
$this->mockWebApplication(['bootstrap' => ['algolia'], 'components' => ['algolia' => ['class' => AlgoliaComponent::class, 'applicationId' => getenv('ALGOLIA_ID'), 'apiKey' => getenv('ALGOLIA_KEY')], 'db' => $this->databaseConfig]]);
$this->migrateTestSchema();
parent::setUp();
}
示例8: setUp
public function setUp()
{
$this->migrateControllerClass = MigrateController::className();
$this->migrationBaseClass = Migration::className();
$this->mockApplication(['components' => ['db' => ['class' => 'yii\\db\\Connection', 'dsn' => 'sqlite::memory:']]]);
$this->setUpMigrationPath();
parent::setUp();
}
示例9: setUp
protected function setUp()
{
parent::setUp();
$_SERVER['SCRIPT_FILENAME'] = "/index.php";
$_SERVER['SCRIPT_NAME'] = "/index.php";
$appConfig = ['components' => ['user' => ['identityClass' => UserIdentity::className()]], 'controllerMap' => ['test' => TestController::className()]];
$this->mockWebApplication($appConfig);
}
示例10: setUp
public function setUp()
{
parent::setUp();
$mockAlgoliaFactory = m::mock(AlgoliaFactory::class);
$this->mockAlgoliaClient = m::mock(Client::class);
$mockAlgoliaFactory->shouldReceive('make')->andReturn($this->mockAlgoliaClient);
Yii::$container->set(AlgoliaFactory::class, $mockAlgoliaFactory);
$this->mockWebApplication(['bootstrap' => ['algolia'], 'components' => ['algolia' => ['class' => AlgoliaComponent::class, 'applicationId' => 'test', 'apiKey' => 'secret']]]);
}
示例11: setUp
protected function setUp()
{
parent::setUp();
if (!extension_loaded('intl')) {
$this->markTestSkipped('intl extension is required.');
}
$this->mockApplication(['timeZone' => 'UTC']);
$this->formatter = new Formatter(['locale' => 'en-US']);
}
示例12: setUp
protected function setUp()
{
parent::setUp();
$this->mockApplication();
$this->tmpPath = \Yii::$app->runtimePath . '/assetConverterTest_' . getmypid();
if (!is_dir($this->tmpPath)) {
mkdir($this->tmpPath, 0777, true);
}
}
示例13: setUp
protected function setUp()
{
parent::setUp();
// dirty way to have Request object not throwing exception when running testHomeLinkNull()
$_SERVER['SCRIPT_FILENAME'] = "/index.php";
$_SERVER['SCRIPT_NAME'] = "/index.php";
$this->mockWebApplication();
$this->breadcrumbs = new Breadcrumbs();
}
示例14: setUp
/**
* @inheritdoc
*/
protected function setUp()
{
parent::setUp();
file_put_contents($this->itemFile, file_get_contents(__DIR__ . '/data/_rbac/items.php'));
file_put_contents($this->assignmentFile, file_get_contents(__DIR__ . '/data/_rbac/assignments.php'));
file_put_contents($this->ruleFile, file_get_contents(__DIR__ . '/data/_rbac/rules.php'));
$this->mockWebApplication(['components' => ['authManager' => ['class' => \yii\rbac\PhpManager::className(), 'itemFile' => $this->itemFile, 'assignmentFile' => $this->assignmentFile, 'ruleFile' => $this->ruleFile]]]);
$this->itemController = new ItemController('item', Yii::$app);
$this->itemController->detachBehavior('verbs');
}
示例15: setUp
protected function setUp()
{
parent::setUp();
if (defined('HHVM_VERSION')) {
// https://github.com/facebook/hhvm/issues/1447
$this->markTestSkipped('Can not test on HHVM because require is cached.');
}
$this->mockApplication();
$this->_fixtureController = Yii::createObject(['class' => 'yiiunit\\extensions\\faker\\FixtureConsoledController', 'interactive' => false, 'fixtureDataPath' => '@runtime/faker', 'templatePath' => '@yiiunit/data/extensions/faker/templates'], ['fixture-faker', Yii::$app]);
}