Skip to content

Commit cb9e128

Browse files
committed
fix bugs
1 parent 756825e commit cb9e128

File tree

7 files changed

+4
-35
lines changed

7 files changed

+4
-35
lines changed

tests/ActiveDataProviderTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class ActiveDataProviderTest extends TestCase
1212
protected function setUp()
1313
{
1414
parent::setUp();
15-
$this->mockApplication();
1615
$this->setUpTestRows();
1716
}
1817

tests/ActiveFixtureTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010

1111
class ActiveFixtureTest extends TestCase
1212
{
13-
protected function setUp()
14-
{
15-
parent::setUp();
16-
$this->mockApplication();
17-
}
1813

1914
protected function tearDown()
2015
{

tests/TestCase.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ protected function setUp()
3434
if (!empty($config)) {
3535
$this->mongoDbConfig = $config;
3636
}
37-
Yii::$app->setComponents(['mongodb' => $this->getConnection()]);
38-
//$this->mockApplication();
37+
$this->mockApplication();
3938
}
4039

4140
protected function tearDown()
@@ -75,6 +74,9 @@ protected function mockApplication($config = [], $appClass = '\yii\console\Appli
7574
'basePath' => __DIR__,
7675
'vendorPath' => $this->getVendorPath(),
7776
'runtimePath' => dirname(__DIR__) . '/runtime',
77+
'components' => [
78+
'mongodb' => $this->getConnection(),
79+
],
7880
], $config));
7981
}
8082

tests/console/controllers/MigrateControllerTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ public function setUp()
4747
$this->migrationNamespace = 'yiiunit\extensions\mongodb\runtime\test_migrations';
4848

4949
$this->setUpMigrationPath();
50-
51-
$this->mockApplication();
5250
}
5351

5452
public function tearDown()

tests/file/StreamWrapperTest.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ public function testCreateFromDownload()
3535

3636
public function testWriteResource()
3737
{
38-
$this->mockApplication([
39-
'components' => [
40-
'mongodb' => yii::$app->mongodb
41-
],
42-
]);
43-
4438
yii::$app->mongodb->registerFileStreamWrapper(true);
4539
$databaseName = yii::$app->mongodb->getDefaultDatabaseName();
4640

@@ -59,12 +53,6 @@ public function testWriteResource()
5953

6054
public function testReadResource()
6155
{
62-
$this->mockApplication([
63-
'components' => [
64-
'mongodb' => yii::$app->mongodb
65-
],
66-
]);
67-
6856
$collection = yii::$app->mongodb->getFileCollection();
6957
$upload = $collection->createUpload();
7058
$document = $upload->addContent('test content')->complete();
@@ -80,12 +68,6 @@ public function testReadResource()
8068

8169
public function testSeek()
8270
{
83-
$this->mockApplication([
84-
'components' => [
85-
'mongodb' => yii::$app->mongodb
86-
],
87-
]);
88-
8971
yii::$app->mongodb->registerFileStreamWrapper(true);
9072
$databaseName = yii::$app->mongodb->getDefaultDatabaseName();
9173

tests/validators/MongoDateValidatorTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class MongoDateValidatorTest extends TestCase
1212
protected function setUp()
1313
{
1414
parent::setUp();
15-
$this->mockApplication();
1615
date_default_timezone_set('UTC');
1716
}
1817

tests/validators/MongoIdValidatorTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99

1010
class MongoIdValidatorTest extends TestCase
1111
{
12-
protected function setUp()
13-
{
14-
parent::setUp();
15-
$this->mockApplication();
16-
}
17-
1812
public function testValidateValue()
1913
{
2014
$validator = new MongoIdValidator();

0 commit comments

Comments
 (0)