/** * Tests that logging works correctly * * @return void */ public function testLogging() { $logger = new \Zend\Log\Logger(); $writer = new \Zend\Log\Writer\Mock(); $logger->addWriter($writer); $mockPM = $this->getMock('\\VuFind\\Config\\PluginManager'); $mockPM->expects($this->any())->method('get')->will($this->throwException(new \Zend\Config\Exception\RuntimeException())); $driver = new MultiBackend($mockPM, $this->getMockILSAuthenticator()); $driver->setConfig(['Drivers' => []]); $driver->setLogger($logger); $driver->init(); $this->callMethod($driver, 'getDriverConfig', ['bad']); $this->assertEquals('VuFind\\ILS\\Driver\\MultiBackend: Could not load config for bad', $writer->events[0]['message']); $this->callMethod($driver, 'getLocalId', ['bad']); $this->assertEquals('VuFind\\ILS\\Driver\\MultiBackend: ' . "Could not find local id in 'bad' using '.'", $writer->events[1]['message']); }