Skip to content

Commit

Permalink
Renaming the decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed May 18, 2016
1 parent 757198a commit 515ba4b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Expand Up @@ -14,7 +14,7 @@
*/
namespace Cake\Event\Decorator;

class EventDecorator {
class BaseDecorator {

/**
* Callable
Expand Down
Expand Up @@ -18,14 +18,15 @@
use RuntimeException;

/**
* Event Filter Decorator
* Event Condition Decorator
*/
class FilterDecorator extends EventDecorator {
class ConditionDecorator extends BaseDecorator {

/**
* @inheritdoc
*/
public function __invoke() {
public function __invoke()
{
$args = func_get_args();
if (!$this->canTrigger($args[0])) {
return false;
Expand Down
Expand Up @@ -19,13 +19,13 @@
namespace Cake\Test\TestCase\Event;

use Cake\Event\Event;
use Cake\Event\Decorator\FilterDecorator;
use Cake\Event\Decorator\ConditionDecorator;
use Cake\TestSuite\TestCase;

/**
* Tests the Cake\Event\Event class functionality
*/
class EventTest extends TestCase
class ConditionDecoratorTest extends TestCase
{

/**
Expand All @@ -39,7 +39,7 @@ public function testCanTriggerIf()
return 'success';
};

$decorator = new FilterDecorator($callable, [
$decorator = new ConditionDecorator($callable, [
'if' => function(Event $event) {
if (isset($event->data['canTrigger'])) {
return true;
Expand All @@ -66,12 +66,13 @@ public function testCanTriggerIf()
*
* @expectedException \RuntimeException
*/
public function testCallableRuntimeException() {
public function testCallableRuntimeException()
{
$callable = function(Event $event) {
return 'success';
};

$decorator = new FilterDecorator($callable, [
$decorator = new ConditionDecorator($callable, [
'if' => 'not a callable'
]);

Expand Down

0 comments on commit 515ba4b

Please sign in to comment.