Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ziaratban committed Oct 11, 2020
1 parent 756825e commit cb9e128
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 35 deletions.
1 change: 0 additions & 1 deletion tests/ActiveDataProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class ActiveDataProviderTest extends TestCase
protected function setUp()
{
parent::setUp();
$this->mockApplication();
$this->setUpTestRows();
}

Expand Down
5 changes: 0 additions & 5 deletions tests/ActiveFixtureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

class ActiveFixtureTest extends TestCase
{
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}

protected function tearDown()
{
Expand Down
6 changes: 4 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ protected function setUp()
if (!empty($config)) {
$this->mongoDbConfig = $config;
}
Yii::$app->setComponents(['mongodb' => $this->getConnection()]);
//$this->mockApplication();
$this->mockApplication();
}

protected function tearDown()
Expand Down Expand Up @@ -75,6 +74,9 @@ protected function mockApplication($config = [], $appClass = '\yii\console\Appli
'basePath' => __DIR__,
'vendorPath' => $this->getVendorPath(),
'runtimePath' => dirname(__DIR__) . '/runtime',
'components' => [
'mongodb' => $this->getConnection(),
],
], $config));
}

Expand Down
2 changes: 0 additions & 2 deletions tests/console/controllers/MigrateControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ public function setUp()
$this->migrationNamespace = 'yiiunit\extensions\mongodb\runtime\test_migrations';

$this->setUpMigrationPath();

$this->mockApplication();
}

public function tearDown()
Expand Down
18 changes: 0 additions & 18 deletions tests/file/StreamWrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ public function testCreateFromDownload()

public function testWriteResource()
{
$this->mockApplication([
'components' => [
'mongodb' => yii::$app->mongodb
],
]);

yii::$app->mongodb->registerFileStreamWrapper(true);
$databaseName = yii::$app->mongodb->getDefaultDatabaseName();

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

public function testReadResource()
{
$this->mockApplication([
'components' => [
'mongodb' => yii::$app->mongodb
],
]);

$collection = yii::$app->mongodb->getFileCollection();
$upload = $collection->createUpload();
$document = $upload->addContent('test content')->complete();
Expand All @@ -80,12 +68,6 @@ public function testReadResource()

public function testSeek()
{
$this->mockApplication([
'components' => [
'mongodb' => yii::$app->mongodb
],
]);

yii::$app->mongodb->registerFileStreamWrapper(true);
$databaseName = yii::$app->mongodb->getDefaultDatabaseName();

Expand Down
1 change: 0 additions & 1 deletion tests/validators/MongoDateValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class MongoDateValidatorTest extends TestCase
protected function setUp()
{
parent::setUp();
$this->mockApplication();
date_default_timezone_set('UTC');
}

Expand Down
6 changes: 0 additions & 6 deletions tests/validators/MongoIdValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@

class MongoIdValidatorTest extends TestCase
{
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}

public function testValidateValue()
{
$validator = new MongoIdValidator();
Expand Down

0 comments on commit cb9e128

Please sign in to comment.