Properly inject EventDispatched in BackgroundRepair

Else it will just be null when called

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2019-03-22 10:29:36 +01:00
parent b1b2378758
commit 3ecdf743bb
No known key found for this signature in database
GPG Key ID: F941078878347C0C
2 changed files with 3 additions and 7 deletions

View File

@ -47,10 +47,7 @@ class BackgroundRepair extends TimedJob {
/** @var EventDispatcherInterface */
private $dispatcher;
/**
* @param EventDispatcherInterface $dispatcher
*/
public function setDispatcher(EventDispatcherInterface $dispatcher): void {
public function __construct(EventDispatcherInterface $dispatcher) {
$this->dispatcher = $dispatcher;
}

View File

@ -77,12 +77,11 @@ class BackgroundRepairTest extends TestCase {
$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() {