I have unit tests running for my component (using a bootstrap file to get the usual requirements) but as soon as I add any logging, I get:
Class '\Joomla\CMS\Log\Log' not found`
I have tried mocking out the Log class, but I don't know how to assign my mock to the global JLog namespace. My tests were passing before I added logging to the methods, so I know that the bootstrap is good in principle, it just seems to be the log that is throwing it.
My setup looks like this:
public function setUp():void {
parent::setUp();
$this->channel_store = $this->createMock('ChannelStore');
$this->application = $this->getMockBuilder(JApplication::class)
->setMethods(['get', 'set'])
->getMock();
JFactory::$application = $this->application;
$this->log = $this->getMockBuilder(JLog::class)
->setMethods(['add'])
->getMock();
// JLog = $this->log; ???
}
What do I need to do in order to mock out JLog correctly?