-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed missing Orchestra\Control\Presenter\AbstractablePresenter class
and add some tests. Closes #18. Signed-off-by: crynobone <[email protected]>
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php namespace Orchestra\Control\TestCase; | ||
|
||
use Mockery as m; | ||
use Orchestra\Control\Presenter\Role; | ||
use Orchestra\Support\Facades\Form; | ||
use Orchestra\Support\Facades\Table; | ||
|
||
class RoleTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Teardown the test environment. | ||
*/ | ||
public function tearDown() | ||
{ | ||
m::close(); | ||
} | ||
|
||
/** | ||
* Test constructing Orchestra\Control\Presenter\Role. | ||
* | ||
* @test | ||
*/ | ||
public function testContructMethod() | ||
{ | ||
$stub = new Role; | ||
} | ||
|
||
/** | ||
* Test Orchestra\Control\Presenter\Role::table() method. | ||
* | ||
* @test | ||
*/ | ||
public function testTableMethod() | ||
{ | ||
$table = m::mock('\Orchestra\Html\Table\Environment'); | ||
$model = m::mock('\Orchestra\Model\Role'); | ||
|
||
$table->shouldReceive('of')->once()->with('control.roles', m::type('Closure')) | ||
->andReturnUsing(function ($n, $c) { | ||
return true; | ||
}); | ||
$stub = new Role; | ||
|
||
Table::swap($table); | ||
|
||
$this->assertTrue($stub->table($model)); | ||
} | ||
|
||
/** | ||
* Test Orchestra\Control\Presenter\Role::form() method. | ||
* | ||
* @test | ||
*/ | ||
public function testFormMethod() | ||
{ | ||
$form = m::mock('\Orchestra\Html\Form\Environment'); | ||
$model = m::mock('\Orchestra\Model\Role'); | ||
|
||
$form->shouldReceive('of')->once()->with('control.roles', m::type('Closure')) | ||
->andReturnUsing(function ($n, $c) { | ||
return true; | ||
}); | ||
$stub = new Role; | ||
|
||
Form::swap($form); | ||
|
||
$this->assertTrue($stub->form($model)); | ||
} | ||
} |