for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\Core\Event\Tests;
use eZ\Publish\Core\Event\AfterEvent;
use eZ\Publish\Core\Event\BeforeEvent;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Stopwatch\Stopwatch;
abstract class AbstractServiceTest extends TestCase
{
public function getEventDispatcher(string $beforeEventName, string $eventName): TraceableEventDispatcher
$eventDispatcher = new EventDispatcher();
$eventDispatcher->addListener($beforeEventName, function (BeforeEvent $event) {});
$event
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$eventDispatcher->addListener($eventName, function (AfterEvent $event) {});
return new TraceableEventDispatcher(
$eventDispatcher,
new Stopwatch()
);
}
public function getListenersStack(array $listeners): array
$stack = [];
foreach ($listeners as $listener) {
$stack[] = [$listener['event'], $listener['priority']];
return $stack;
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.