Else it will just be null when called
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
/** @var EventDispatcherInterface */
private $dispatcher;
- /**
- * @param EventDispatcherInterface $dispatcher
- */
- public function setDispatcher(EventDispatcherInterface $dispatcher): void {
+ public function __construct(EventDispatcherInterface $dispatcher) {
$this->dispatcher = $dispatcher;
}
$this->logger = $this->getMockBuilder(ILogger::class)
->disableOriginalConstructor()
->getMock();
+ $this->dispatcher = $this->createMock(EventDispatcherInterface::class);
$this->job = $this->getMockBuilder(BackgroundRepair::class)
+ ->setConstructorArgs([$this->dispatcher])
->setMethods(['loadApp'])
->getMock();
-
- $this->dispatcher = $this->createMock(EventDispatcherInterface::class);
- $this->job->setDispatcher($this->dispatcher);
}
public function testNoArguments() {