Skip to content
Permalink
Browse files

Renaming the decorators

  • Loading branch information...
burzum committed May 18, 2016
1 parent 757198a commit 515ba4b5224fa7dbcf1172f8badb2fa216700cc1
@@ -14,7 +14,7 @@
*/
namespace Cake\Event\Decorator;
class EventDecorator {
class BaseDecorator {
/**
* Callable
@@ -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;
@@ -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
{
/**
@@ -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;
@@ -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'
]);

0 comments on commit 515ba4b

Please sign in to comment.
You can’t perform that action at this time.