I have a piece of code that is shown as not covered, even though I have a specific test to trigger it. Here is the code:
private function processConfiguration($baseFileName, ConfigurationInterface $definition)
{
$fileName = $this->createEnvironmentSpecificFileName($baseFileName);
$processor = new Processor();
$configuration = $this->loader->load($fileName);
if (is_null($configuration) === true) {
throw new \UnexpectedValueException('The configuration file can not be empty.');
}
return $processor->processConfiguration($definition, $configuration);
}
And the unit test that is made to specifically make this function throw an exception:
public function testGetQueueSettingsWithEmptyFile()
{
$this->setExpectedException('UnexpectedValueException');
$loader = $this->mockLoaderWith([], null, 0);
(new Reader($loader))->getQueueSettings();
}
However, even though this unit test passes, when I get the coverage report using Codeception, which probably gets the report from PHPUnit, this line is red:
throw new \UnexpectedValueException('The configuration file can not be empty.');
Why?
Aucun commentaire:
Enregistrer un commentaire