Skip to content

Commit

Permalink
Add additional tests.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Mar 15, 2015
1 parent 091782f commit 6baf01a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/Migrator/OperationTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,27 @@ public function testResolveModelMethod()
$this->assertEquals($model, $this->getModel());
}

/**
* Test Orchestra\Tenanti\Migrator\OperationTrait::resolveModel()
* method with connection name.
*
* @test
*/
public function testResolveModelMethodWithConnectionName()
{
$this->app = m::mock('\Illuminate\Container\Container[make]');
$this->config = ['model' => 'User', 'database' => 'primary'];

$model = m::mock('\Illuminate\Database\Eloquent\Model');

$this->app->shouldReceive('make')->once()->with('User')->andReturn($model);

$model->shouldReceive('on')->once()->with('primary')->andReturnSelf()
->shouldReceive('useWritePdo')->once()->andReturnSelf();

$this->assertEquals($model, $this->getModel());
}

/**
* Test Orchestra\Tenanti\Migrator\OperationTrait::resolveModel()
* method throw an exception when model is not an instance of
Expand Down

0 comments on commit 6baf01a

Please sign in to comment.