當前位置: 首頁>>代碼示例>>PHP>>正文


PHP yiiunit\TestCase類代碼示例

本文整理匯總了PHP中yiiunit\TestCase的典型用法代碼示例。如果您正苦於以下問題:PHP TestCase類的具體用法?PHP TestCase怎麽用?PHP TestCase使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TestCase類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: tearDown

 protected function tearDown()
 {
     if (is_dir($this->tmpPath)) {
         FileHelper::removeDirectory($this->tmpPath);
     }
     parent::tearDown();
 }
開發者ID:howq,項目名稱:yii2,代碼行數:7,代碼來源:AssetConverterTest.php

示例2: tearDown

 public function tearDown()
 {
     @unlink(Yii::getAlias('@runtime/faker/user.php'));
     @unlink(Yii::getAlias('@runtime/faker/profile.php'));
     @unlink(Yii::getAlias('@runtime/faker/book.php'));
     parent::tearDown();
 }
開發者ID:aivavic,項目名稱:yii2,代碼行數:7,代碼來源:FixtureControllerTest.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->mockApplication();
     Yii::setAlias('@testWeb', '/');
     Yii::setAlias('@testWebRoot', '@yiiunit/data/web');
 }
開發者ID:howq,項目名稱:yii2,代碼行數:7,代碼來源:AssetBundleTest.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     $_SERVER['SCRIPT_FILENAME'] = "/index.php";
     $_SERVER['SCRIPT_NAME'] = "/index.php";
     $this->mockWebApplication();
 }
開發者ID:howq,項目名稱:yii2,代碼行數:7,代碼來源:HttpCacheTest.php

示例5: 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

示例6: 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

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->security = new ExposedSecurity();
     $this->security->derivationIterations = 1000;
     // speed up test running
 }
開發者ID:aivavic,項目名稱:yii2,代碼行數:7,代碼來源:SecurityTest.php

示例8: 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

示例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: tearDown

 public function tearDown()
 {
     m::close();
     // The mockWebApplication is called after a mock has been already set to the container
     // So we need to manually clear that.
     Yii::$container->clear(AlgoliaFactory::class);
     parent::tearDown();
 }
開發者ID:lordthorzonus,項目名稱:yii2-algolia,代碼行數:8,代碼來源:AlgoliaComponentTest.php

示例11: 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

示例12: 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

示例13: setUp

 protected function setUp()
 {
     parent::setUp();
     $databases = self::getParam('databases');
     $this->database = $databases[$this->driverName];
     $pdo_database = 'pdo_' . $this->driverName;
     if (!extension_loaded('pdo') || !extension_loaded($pdo_database)) {
         $this->markTestSkipped('pdo and ' . $pdo_database . ' extension are required.');
     }
     $this->mockApplication();
 }
開發者ID:kaneghost,項目名稱:yii2Advansed,代碼行數:11,代碼來源:DatabaseTestCase.php

示例14: setUp

 protected function setUp()
 {
     parent::setUp();
     if (!extension_loaded('mongo')) {
         $this->markTestSkipped('mongo extension required.');
     }
     $config = self::getParam('mongodb');
     if (!empty($config)) {
         $this->mongoDbConfig = $config;
     }
     $this->mockApplication();
     static::loadClassMap();
 }
開發者ID:sciurodont,項目名稱:yii2,代碼行數:13,代碼來源:MongoDbTestCase.php

示例15: setUp

 protected function setUp()
 {
     $databases = $this->getParam('databases');
     $params = isset($databases['redis']) ? $databases['redis'] : null;
     if ($params === null) {
         $this->markTestSkipped('No redis server connection configured.');
     }
     $connection = new Connection($params);
     if (!@stream_socket_client($connection->hostname . ':' . $connection->port, $errorNumber, $errorDescription, 0.5)) {
         $this->markTestSkipped('No redis server running at ' . $connection->hostname . ':' . $connection->port . ' : ' . $errorNumber . ' - ' . $errorDescription);
     }
     $this->mockApplication(['components' => ['redis' => $connection]]);
     parent::setUp();
 }
開發者ID:rajanishtimes,項目名稱:basicyii,代碼行數:14,代碼來源:RedisTestCase.php


注:本文中的yiiunit\TestCase類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。