Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/3130' into develop
Browse files Browse the repository at this point in the history
Forward port zendframework/zendframework#3130

Conflicts:
	README.md
	library/Zend/Version/Version.php
  • Loading branch information
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 24 deletions.
36 changes: 26 additions & 10 deletions test/EventManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,18 @@ public function testAttachAggregateReturnsAttachOfListenerAggregate()
public function testCanDetachListenerAggregates()
{
// setup some other event listeners, to ensure appropriate items are detached
$listenerFooBar1 = $this->events->attach('foo.bar', function() { return true; });
$listenerFooBar2 = $this->events->attach('foo.bar', function() { return true; });
$listenerFooBaz1 = $this->events->attach('foo.baz', function() { return true; });
$listenerOther = $this->events->attach('other', function() { return true; });
$listenerFooBar1 = $this->events->attach('foo.bar', function () {
return true;
});
$listenerFooBar2 = $this->events->attach('foo.bar', function () {
return true;
});
$listenerFooBaz1 = $this->events->attach('foo.baz', function () {
return true;
});
$listenerOther = $this->events->attach('other', function () {
return true;
});

$aggregate = new TestAsset\MockAggregate();
$this->events->attachAggregate($aggregate);
Expand All @@ -307,10 +315,18 @@ public function testCanDetachListenerAggregates()
public function testCanDetachListenerAggregatesViaDetach()
{
// setup some other event listeners, to ensure appropriate items are detached
$listenerFooBar1 = $this->events->attach('foo.bar', function() { return true; });
$listenerFooBar2 = $this->events->attach('foo.bar', function() { return true; });
$listenerFooBaz1 = $this->events->attach('foo.baz', function() { return true; });
$listenerOther = $this->events->attach('other', function() { return true; });
$listenerFooBar1 = $this->events->attach('foo.bar', function () {
return true;
});
$listenerFooBar2 = $this->events->attach('foo.bar', function () {
return true;
});
$listenerFooBaz1 = $this->events->attach('foo.baz', function () {
return true;
});
$listenerOther = $this->events->attach('other', function () {
return true;
});

$aggregate = new TestAsset\MockAggregate();
$this->events->attach($aggregate);
Expand Down Expand Up @@ -593,7 +609,7 @@ public function testListenersAttachedWithWildcardAreTriggeredForAllEvents()
{
$test = new stdClass;
$test->events = array();
$callback = function($e) use ($test) {
$callback = function ($e) use ($test) {
$test->events[] = $e->getName();
};

Expand All @@ -618,7 +634,7 @@ public function testSharedEventManagerAttachReturnsCallbackHandler()
$callbackHandler = $shared->attach(
'foo',
'bar',
function($e) {
function ($e) {
return true;
}
);
Expand Down
10 changes: 5 additions & 5 deletions test/FilterChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ public function testRetrievingAttachedFiltersShouldReturnEmptyArrayWhenNoFilters

public function testFilterChainShouldReturnLastResponse()
{
$this->filterchain->attach(function($context, $params, $chain) {
$this->filterchain->attach(function ($context, $params, $chain) {
if (isset($params['string'])) {
$params['string'] = trim($params['string']);
}
$return = $chain->next($context, $params, $chain);
return $return;
});
$this->filterchain->attach(function($context, array $params) {
$this->filterchain->attach(function ($context, array $params) {
$string = isset($params['string']) ? $params['string'] : '';
return str_rot13($string);
});
Expand All @@ -107,17 +107,17 @@ public function testInterceptingFilterShouldReceiveChain()

public function testFilteringStopsAsSoonAsAFilterFailsToCallNext()
{
$this->filterchain->attach(function($context, $params, $chain) {
$this->filterchain->attach(function ($context, $params, $chain) {
if (isset($params['string'])) {
$params['string'] = trim($params['string']);
}
return $chain->next($context, $params, $chain);
}, 10000);
$this->filterchain->attach(function($context, array $params) {
$this->filterchain->attach(function ($context, array $params) {
$string = isset($params['string']) ? $params['string'] : '';
return str_rot13($string);
}, 1000);
$this->filterchain->attach(function($context, $params, $chain) {
$this->filterchain->attach(function ($context, $params, $chain) {
$string = isset($params['string']) ? $params['string'] : '';
return hash('md5', $string);
}, 100);
Expand Down
18 changes: 9 additions & 9 deletions test/StaticEventManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function testListenersAttachedUsingWildcardEventWillBeTriggeredByResource
{
$test = new stdClass;
$test->events = array();
$callback = function($e) use ($test) {
$callback = function ($e) use ($test) {
$test->events[] = $e->getName();
};

Expand Down Expand Up @@ -252,10 +252,10 @@ public function testListenersAttachedToAnyIdentifierProvidedToEventManagerWillBe

$test = new \stdClass;
$test->triggered = 0;
$events->attach('foo', 'bar', function($e) use ($test) {
$events->attach('foo', 'bar', function ($e) use ($test) {
$test->triggered++;
});
$events->attach('bar', 'bar', function($e) use ($test) {
$events->attach('bar', 'bar', function ($e) use ($test) {
$test->triggered++;
});
$manager->trigger('bar', $this, array());
Expand All @@ -271,11 +271,11 @@ public function testListenersAttachedToWildcardsWillBeTriggered()

$test = new \stdClass;
$test->triggered = 0;
$events->attach('*', 'bar', function($e) use ($test) {
$events->attach('*', 'bar', function ($e) use ($test) {
$test->triggered++;
});
//Tests one can have multiple wildcards attached
$events->attach('*', 'bar', function($e) use ($test) {
$events->attach('*', 'bar', function ($e) use ($test) {
$test->triggered++;
});
$manager->trigger('bar', $this, array());
Expand All @@ -291,17 +291,17 @@ public function testListenersAttachedToAnyIdentifierProvidedToEventManagerOrWild

$test = new \stdClass;
$test->triggered = 0;
$events->attach('foo', 'bar', function($e) use ($test) {
$events->attach('foo', 'bar', function ($e) use ($test) {
$test->triggered++;
});
$events->attach('bar', 'bar', function($e) use ($test) {
$events->attach('bar', 'bar', function ($e) use ($test) {
$test->triggered++;
});
$events->attach('*', 'bar', function($e) use ($test) {
$events->attach('*', 'bar', function ($e) use ($test) {
$test->triggered++;
});
//Tests one can have multiple wildcards attached
$events->attach('*', 'bar', function($e) use ($test) {
$events->attach('*', 'bar', function ($e) use ($test) {
$test->triggered++;
});
$manager->trigger('bar', $this, array());
Expand Down

0 comments on commit ee1d485

Please # to comment.