Skip to content
This repository has been archived by the owner on Dec 4, 2019. It is now read-only.

Commit

Permalink
Add one more test to make sure input can be accessed.
Browse files Browse the repository at this point in the history
  • Loading branch information
franzliedke committed Oct 14, 2014
1 parent d3f0636 commit c2ff770
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions spec/FluxBB/Core/ActionSpec.php
Expand Up @@ -2,13 +2,28 @@

namespace spec\FluxBB\Core;

use FluxBB\Server\Response;
use Illuminate\Contracts\Events\Dispatcher;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use FluxBB\Core\Action;

class ActionSpec extends ObjectBehavior
{
function it_always_returns_responses()
{
$this->beAnInstanceOf('spec\FluxBB\Core\EmptyAction');

$this->execute()->shouldReturnAnInstanceOf('FluxBB\Server\Response');
}

function it_can_access_input()
{
$this->beAnInstanceOf('spec\FluxBB\Core\InputAction');

$this->execute(['foo' => 'bar', 'baz' => 'bam'])->getData()->shouldReturn(['result' => 'barbam']);
}

function it_can_raise_events(Dispatcher $dispatcher)
{
$this->beAnInstanceOf('spec\FluxBB\Core\EventAction');
Expand All @@ -18,13 +33,6 @@ function it_can_raise_events(Dispatcher $dispatcher)
$this->setEvents($dispatcher);
$this->execute();
}

function it_always_returns_responses()
{
$this->beAnInstanceOf('spec\FluxBB\Core\EmptyAction');

$this->execute()->shouldReturnAnInstanceOf('FluxBB\Server\Response');
}
}

class EmptyAction extends Action
Expand All @@ -33,6 +41,17 @@ protected function run()
{ }
}

class InputAction extends Action
{
protected function run()
{
$foo = $this->get('foo');
$baz = $this->get('baz');
$result = $foo.$baz;
return compact('result');
}
}

class EventAction extends Action
{
protected function run()
Expand Down

0 comments on commit c2ff770

Please sign in to comment.