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/7476'
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed May 4, 2015
2 parents 3f60d3a + 54b495e commit 91686e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
22 changes: 11 additions & 11 deletions test/EventManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function tearDown()
public function testAttachShouldReturnCallbackHandler()
{
$listener = $this->events->attach('test', array($this, __METHOD__));
$this->assertTrue($listener instanceof CallbackHandler);
$this->assertInstanceOf('Zend\Stdlib\CallbackHandler', $listener);
}

public function testAttachShouldAddListenerToEvent()
Expand All @@ -57,10 +57,10 @@ public function testAttachShouldAddListenerToEvent()
public function testAttachShouldAddEventIfItDoesNotExist()
{
$events = $this->events->getEvents();
$this->assertTrue(empty($events), var_export($events, 1));
$this->assertEmpty($events, var_export($events, 1));
$listener = $this->events->attach('test', array($this, __METHOD__));
$events = $this->events->getEvents();
$this->assertFalse(empty($events));
$this->assertNotEmpty($events);
$this->assertContains('test', $events);
}

Expand All @@ -73,7 +73,7 @@ public function testAllowsPassingArrayOfEventNamesWhenAttaching()

foreach (array('foo', 'bar') as $event) {
$listeners = $this->events->getListeners($event);
$this->assertTrue(count($listeners) > 0);
$this->assertNotEmpty($listeners);
foreach ($listeners as $listener) {
$this->assertSame($callback, $listener->getCallback());
}
Expand Down Expand Up @@ -144,7 +144,7 @@ public function testTriggerShouldReturnAllListenerReturnValues()
return str_rot13($string);
});
$responses = $this->events->trigger('string.transform', $this, array('string' => ' foo '));
$this->assertTrue($responses instanceof ResponseCollection);
$this->assertInstanceOf('Zend\EventManager\ResponseCollection', $responses);
$this->assertEquals(2, $responses->count());
$this->assertEquals('foo', $responses->first());
$this->assertEquals(\str_rot13(' foo '), $responses->last());
Expand All @@ -168,7 +168,7 @@ public function testTriggerUntilShouldReturnAsSoonAsCallbackReturnsTrue()
array('string' => 'foo', 'search' => 'f'),
array($this, 'evaluateStringCallback')
);
$this->assertTrue($responses instanceof ResponseCollection);
$this->assertInstanceOf('Zend\EventManager\ResponseCollection', $responses);
$this->assertSame(0, $responses->last());
}

Expand Down Expand Up @@ -208,7 +208,7 @@ public function testTriggerUntilShouldMarkResponseCollectionStoppedWhenCondition
$responses = $this->events->trigger('foo.bar', $this, array(), function ($result) {
return ($result === 'found');
});
$this->assertTrue($responses instanceof ResponseCollection);
$this->assertInstanceOf('Zend\EventManager\ResponseCollection', $responses);
$this->assertTrue($responses->stopped());
$result = $responses->last();
$this->assertEquals('found', $result);
Expand All @@ -224,7 +224,7 @@ public function testTriggerUntilShouldMarkResponseCollectionStoppedWhenCondition
$responses = $this->events->trigger('foo.bar', $this, array(), function ($result) {
return ($result === 'found');
});
$this->assertTrue($responses instanceof ResponseCollection);
$this->assertInstanceOf('Zend\EventManager\ResponseCollection', $responses);
$this->assertTrue($responses->stopped());
$this->assertEquals('found', $responses->last());
}
Expand All @@ -238,7 +238,7 @@ public function testResponseCollectionIsNotStoppedWhenNoCallbackMatchedByTrigger
$responses = $this->events->trigger('foo.bar', $this, array(), function ($result) {
return ($result === 'never found');
});
$this->assertTrue($responses instanceof ResponseCollection);
$this->assertInstanceOf('Zend\EventManager\ResponseCollection', $responses);
$this->assertFalse($responses->stopped());
$this->assertEquals('zero', $responses->last());
}
Expand Down Expand Up @@ -375,7 +375,7 @@ public function testCallingEventsStopPropagationMethodHaltsEventEmission()
$this->events->attach('foo.bar', function ($e) { return 'found'; }, 2);
$this->events->attach('foo.bar', function ($e) { return 'zero'; }, 1);
$responses = $this->events->trigger('foo.bar', $this, array());
$this->assertTrue($responses instanceof ResponseCollection);
$this->assertInstanceOf('Zend\EventManager\ResponseCollection', $responses);
$this->assertTrue($responses->stopped());
$this->assertEquals('nada', $responses->last());
$this->assertTrue($responses->contains('bogus'));
Expand Down Expand Up @@ -629,7 +629,7 @@ function ($e) {
return true;
}
);
$this->assertTrue($callbackHandler instanceof CallbackHandler);
$this->assertInstanceOf('Zend\Stdlib\CallbackHandler', $callbackHandler);
}

public function testDoesNotCreateStaticInstanceIfNonePresent()
Expand Down
2 changes: 1 addition & 1 deletion test/FilterChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function setUp()
public function testSubscribeShouldReturnCallbackHandler()
{
$handle = $this->filterchain->attach(array( $this, __METHOD__ ));
$this->assertTrue($handle instanceof CallbackHandler);
$this->assertInstanceOf('Zend\Stdlib\CallbackHandler', $handle);
}

public function testSubscribeShouldAddCallbackHandlerToFilters()
Expand Down
8 changes: 4 additions & 4 deletions test/StaticEventManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function testCanAttachCallbackToEvent()
$found = false;
$listeners = $events->getListeners('foo', 'bar');
$this->assertInstanceOf('Zend\Stdlib\PriorityQueue', $listeners);
$this->assertTrue(0 < count($listeners), 'Empty listeners!');
$this->assertNotEmpty($listeners, 'Empty listeners!');
foreach ($listeners as $listener) {
if ($expected === $listener->getCallback()) {
$found = true;
Expand All @@ -79,7 +79,7 @@ public function testCanAttachCallbackToMultipleEventsAtOnce()
$found = false;
$listeners = $events->getListeners('bar', $event);
$this->assertInstanceOf('Zend\Stdlib\PriorityQueue', $listeners);
$this->assertTrue(0 < count($listeners), 'Empty listeners!');
$this->assertNotEmpty($listeners, 'Empty listeners!');
foreach ($listeners as $listener) {
if ($expected === $listener->getCallback()) {
$found = true;
Expand All @@ -101,7 +101,7 @@ public function testCanAttachSameEventToMultipleResourcesAtOnce()
$found = false;
$listeners = $events->getListeners($id, 'bar');
$this->assertInstanceOf('Zend\Stdlib\PriorityQueue', $listeners);
$this->assertTrue(0 < count($listeners), 'Empty listeners!');
$this->assertNotEmpty($listeners, 'Empty listeners!');
foreach ($listeners as $listener) {
if ($expected === $listener->getCallback()) {
$found = true;
Expand All @@ -124,7 +124,7 @@ public function testCanAttachCallbackToMultipleEventsOnMultipleResourcesAtOnce()
$found = false;
$listeners = $events->getListeners($resource, $event);
$this->assertInstanceOf('Zend\Stdlib\PriorityQueue', $listeners);
$this->assertTrue(0 < count($listeners), 'Empty listeners!');
$this->assertNotEmpty($listeners, 'Empty listeners!');
foreach ($listeners as $listener) {
if ($expected === $listener->getCallback()) {
$found = true;
Expand Down

0 comments on commit 91686e3

Please sign in to comment.