Skip to content

Commit

Permalink
Fixed missing Orchestra\Control\Presenter\AbstractablePresenter class
Browse files Browse the repository at this point in the history
and add some tests. Closes #18.

Signed-off-by: crynobone <[email protected]>
  • Loading branch information
crynobone committed Dec 24, 2013
1 parent 435e96c commit ed15096
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions tests/Presenter/RoleTest.php
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));
}
}

0 comments on commit ed15096

Please sign in to comment.