Skip to content

Commit

Permalink
test getting client from manager
Browse files Browse the repository at this point in the history
  • Loading branch information
sokil committed Feb 6, 2015
1 parent 12d5c1a commit 2deab35
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
15 changes: 15 additions & 0 deletions tests/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ public function testGetAvailableRevisions()
$this->assertEquals('Test5', $revision->getName());
$this->assertEquals('20140531201029_Test5.php', $revision->getFilename());
}

public function testGetClient()
{
$reflectionClass = new \ReflectionClass($this->_manager);
$method = $reflectionClass->getMethod('getClient');
$method->setAccessible(true);

$devClient = $method->invoke($this->_manager, 'development');
$this->assertInstanceof('\Sokil\Mongo\Client', $devClient);
$this->assertEquals('test', $devClient->getCurrentDatabaseName());

$stagingClient = $method->invoke($this->_manager, 'staging');
$this->assertInstanceof('\Sokil\Mongo\Client', $stagingClient);
$this->assertEquals('staging_db', $stagingClient->getCurrentDatabaseName());
}

public function testMigrate()
{
Expand Down
8 changes: 5 additions & 3 deletions tests/mongo-migrator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ environments:

log_database: test
log_collection: migrations

staging:
dsn: mongodb://localhost

default_database: test
default_database: staging_db

log_database: test
log_collection: migrations
Expand All @@ -26,4 +26,6 @@ environments:
default_database: test

log_database: test
log_collection: migrations
log_collection: migrations


0 comments on commit 2deab35

Please sign in to comment.