Browse Source

fixed unit test config.

Qiang Xue 12 years ago
parent
commit
749d72c33b
3 changed files with 18 additions and 4 deletions
  1. 0 0
      tests/unit.suite.yml
  2. 1 4
      tests/unit/_bootstrap.php
  3. 17 0
      tests/unit/_config.php

tests/unit.suite.dist.yml → tests/unit.suite.yml


+ 1 - 4
tests/unit/_bootstrap.php

@@ -2,7 +2,4 @@
 
 // add unit testing specific bootstrap code here
 
-yii\codeception\TestCase::$appConfig = yii\helpers\ArrayHelper::merge(
-	require(__DIR__ . '/../../config/web.php'),
-	require(__DIR__ . '/../../config/codeception/unit.php')
-);
+yii\codeception\TestCase::$appConfig = require(__DIR__ . '/_config.php');

+ 17 - 0
tests/unit/_config.php

@@ -0,0 +1,17 @@
+<?php
+
+use yii\helpers\ArrayHelper;
+
+$config = require(__DIR__ . '/../../config/web.php');
+
+return ArrayHelper::merge($config, [
+	'components' => [
+		'fixture' => [
+			'class' => 'yii\test\DbFixtureManager',
+			'basePath' => '@tests/unit/fixtures',
+		],
+		'db' => [
+			'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit',
+		],
+	],
+]);