scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class); $this->deploymentConfigMock = $this->createMock(DeploymentConfig::class); $this->model = new Syslog( $this->scopeConfigMock, $this->deploymentConfigMock, 'Magento' ); } /** * @return void */ public function testIsHandling(): void { $record = [ 'level' => Monolog::DEBUG, ]; $this->scopeConfigMock ->expects($this->never()) ->method('getValue'); $this->deploymentConfigMock ->expects($this->once()) ->method('isDbAvailable') ->willReturn(true); $this->deploymentConfigMock ->expects($this->once()) ->method('get') ->with(ConfigOptionsList::CONFIG_PATH_SYSLOG_LOGGING) ->willReturn(1); $this->assertTrue( $this->model->isHandling($record) ); } /** * @return void */ public function testIsHandlingNotInstalled(): void { $record = [ 'level' => Monolog::DEBUG, ]; $this->scopeConfigMock ->expects($this->never()) ->method('getValue'); $this->deploymentConfigMock ->expects($this->once()) ->method('isDbAvailable') ->willReturn(false); $this->assertFalse( $this->model->isHandling($record) ); } /** * @return void */ public function testIsHandlingDisabled(): void { $record = [ 'level' => Monolog::DEBUG, ]; $this->scopeConfigMock ->expects($this->never()) ->method('getValue'); $this->deploymentConfigMock ->expects($this->once()) ->method('isDbAvailable') ->willReturn(true); $this->deploymentConfigMock ->expects($this->once()) ->method('get') ->with(ConfigOptionsList::CONFIG_PATH_SYSLOG_LOGGING) ->willReturn(0); $this->assertFalse( $this->model->isHandling($record) ); } }