当前位置: 首页>>代码示例>>PHP>>正文


PHP TestCase::setUp方法代码示例

本文整理汇总了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();
 }
开发者ID:howq,项目名称:yii2,代码行数:7,代码来源:HttpCacheTest.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->security = new ExposedSecurity();
     $this->security->derivationIterations = 1000;
     // speed up test running
 }
开发者ID:aivavic,项目名称:yii2,代码行数:7,代码来源:SecurityTest.php

示例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']]);
 }
开发者ID:albertborsos,项目名称:yii2,代码行数:7,代码来源:CacheControllerTest.php

示例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();
 }
开发者ID:advance100,项目名称:yunjianyi,代码行数:7,代码来源:DbSessionTest.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     IntlTestHelper::setIntlStatus($this);
     $this->mockApplication(['timeZone' => 'UTC', 'language' => 'ru-RU']);
     $this->formatter = new Formatter(['locale' => 'en-US']);
 }
开发者ID:howq,项目名称:yii2,代码行数:7,代码来源:FormatterNumberTest.php

示例6: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->mockApplication();
     Yii::setAlias('@testWeb', '/');
     Yii::setAlias('@testWebRoot', '@yiiunit/data/web');
 }
开发者ID:howq,项目名称:yii2,代码行数:7,代码来源:AssetBundleTest.php

示例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();
 }
开发者ID:lordthorzonus,项目名称:yii2-algolia,代码行数:8,代码来源:TestCase.php

示例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();
 }
开发者ID:aivavic,项目名称:yii2,代码行数:8,代码来源:MigrateControllerTest.php

示例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);
 }
开发者ID:howq,项目名称:yii2,代码行数:8,代码来源:CompositeAuthTest.php

示例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']]]);
 }
开发者ID:lordthorzonus,项目名称:yii2-algolia,代码行数:9,代码来源:AlgoliaComponentTest.php

示例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']);
 }
开发者ID:rajanishtimes,项目名称:basicyii,代码行数:9,代码来源:FormatterTest.php

示例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);
     }
 }
开发者ID:howq,项目名称:yii2,代码行数:9,代码来源:AssetConverterTest.php

示例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();
 }
开发者ID:howq,项目名称:yii2,代码行数:9,代码来源:BreadcrumbsTest.php

示例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');
 }
开发者ID:vandro,项目名称:gui-rbac-yii2,代码行数:13,代码来源:ItemControllerTest.php

示例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]);
 }
开发者ID:aivavic,项目名称:yii2,代码行数:10,代码来源:FixtureControllerTest.php


注:本文中的yiiunit\TestCase::setUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。