for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace AbterPhp\Framework\Bootstrappers\Events;
use Opulence\Events\Dispatchers\EventRegistry;
use Opulence\Events\Dispatchers\IEventDispatcher;
use Opulence\Ioc\Container;
use PHPUnit\Framework\TestCase;
class EventDispatcherBootstrapperTest extends TestCase
{
protected EventDispatcherBootstrapper $sut;
public function setUp(): void
$this->sut = new EventDispatcherBootstrapper();
}
public function testRegisterBindings()
$listenerName = 'foo';
$events1 = [$listenerName => [fn() => null]];
$events2 = [$listenerName => [fn() => null]];
$this->sut->setBaseEvents($events1);
$this->sut->setModuleEvents($events2);
$container = new Container();
$this->sut->registerBindings($container);
$actual = $container->resolve(IEventDispatcher::class);
$this->assertInstanceOf(IEventDispatcher::class, $actual);
/** @var EventRegistry $actual */
$actual = $container->resolve(EventRegistry::class);
$this->assertInstanceOf(EventRegistry::class, $actual);
$this->assertCount(2, $actual->getListeners($listenerName));