mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-01 10:50:21 +02:00
Fix IntrospectionProcessor tests that were not validating the code under test (#1896)
Three tests in IntrospectionProcessorTest (testLevelTooLow, testLevelEqual, testLevelHigher) aren't actually testing anything. Because `$expected = $input` is a reference, the changes made to `$expected['extra']` are made to $input and carried forward to $actual. You can demonstrate this by adding a `return $record` at the immediate start of `InstrospectionProcessor::__invoke` -- the tests still pass despite bypassing all the code.
This commit is contained in:
committed by
GitHub
parent
47e301d3e2
commit
4e03d25f6d
@@ -68,7 +68,7 @@ class IntrospectionProcessorTest extends TestCase
|
|||||||
{
|
{
|
||||||
$input = $this->getRecord(Level::Debug);
|
$input = $this->getRecord(Level::Debug);
|
||||||
|
|
||||||
$expected = $input;
|
$expected = clone $input;
|
||||||
|
|
||||||
$processor = new IntrospectionProcessor(Level::Critical);
|
$processor = new IntrospectionProcessor(Level::Critical);
|
||||||
$actual = $processor($input);
|
$actual = $processor($input);
|
||||||
@@ -80,7 +80,7 @@ class IntrospectionProcessorTest extends TestCase
|
|||||||
{
|
{
|
||||||
$input = $this->getRecord(Level::Critical);
|
$input = $this->getRecord(Level::Critical);
|
||||||
|
|
||||||
$expected = $input;
|
$expected = clone $input;
|
||||||
$expected['extra'] = [
|
$expected['extra'] = [
|
||||||
'file' => null,
|
'file' => null,
|
||||||
'line' => null,
|
'line' => null,
|
||||||
@@ -99,7 +99,7 @@ class IntrospectionProcessorTest extends TestCase
|
|||||||
{
|
{
|
||||||
$input = $this->getRecord(Level::Emergency);
|
$input = $this->getRecord(Level::Emergency);
|
||||||
|
|
||||||
$expected = $input;
|
$expected = clone $input;
|
||||||
$expected['extra'] = [
|
$expected['extra'] = [
|
||||||
'file' => null,
|
'file' => null,
|
||||||
'line' => null,
|
'line' => null,
|
||||||
|
Reference in New Issue
Block a user