for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Tests;
use Psr\EventManager\EventInterface;
use Psr\EventManager\EventManagerInterface;
use Event\Event;
use Event\EventManager;
use Tests\EventTestSuite;
final class EventManagerTest extends EventTestSuite
{
public function testCanListenerReturnTrue()
$this->assertTrue(call_user_func($this->eventListener));
}
public function testCanEventManagerObjectCreated()
$this->assertNotEmpty($this->eventManager);
public function testCanAttachEventToEventManager()
$this->assertTrue($this->eventManager->attach($this->event->getName(), $this->eventListener));
public function testCanInvalidAttachEventToEventManager()
$this->assertFalse($this->eventManager->attach($this->event->getName(), null));
null
callable
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
public function testCanDetachEventFromEventManager()
$this->assertTrue($this->eventManager->detach($this->event->getName(), $this->eventListener));
public function testCanClearAllListenersFromEvent()
$this->eventManager->attach($this->event->getName(), $this->eventListener);
$this->assertTrue($this->eventManager->clearListeners($this->event->getName()));
$this->assertFalse($this->eventManager->isExistListeners($this->event->getName()));
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: