diff --git a/test/EventManagerTest.php b/test/EventManagerTest.php index 17f527d..0b8a26e 100644 --- a/test/EventManagerTest.php +++ b/test/EventManagerTest.php @@ -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() @@ -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); } @@ -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()); } @@ -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()); @@ -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()); } @@ -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); @@ -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()); } @@ -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()); } @@ -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')); @@ -629,7 +629,7 @@ function ($e) { return true; } ); - $this->assertTrue($callbackHandler instanceof CallbackHandler); + $this->assertInstanceOf('Zend\Stdlib\CallbackHandler', $callbackHandler); } public function testDoesNotCreateStaticInstanceIfNonePresent() diff --git a/test/FilterChainTest.php b/test/FilterChainTest.php index 39337b4..880c8ed 100644 --- a/test/FilterChainTest.php +++ b/test/FilterChainTest.php @@ -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() diff --git a/test/StaticEventManagerTest.php b/test/StaticEventManagerTest.php index 4131b20..f98bcb4 100644 --- a/test/StaticEventManagerTest.php +++ b/test/StaticEventManagerTest.php @@ -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; @@ -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; @@ -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; @@ -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;