Skip to content

Commit edf4e22

Browse files
janedbalondrejmirtes
authored andcommitted
Add tests for errorFormat DIC parameter from CLI option
1 parent c2f17a1 commit edf4e22

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

‎tests/PHPStan/Command/CommandHelperTest.php‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,4 +393,53 @@ public function testAutoloadFileAndConfigurationAreNormalized(): void
393393
$this->assertContains($relativePaths . 'root.neon', $parameters['additionalConfigFiles']);
394394
}
395395

396+
/**
397+
* @throws InceptionNotSuccessfulException
398+
*/
399+
public function testErrorFormatFromCli(): void
400+
{
401+
$result = CommandHelper::begin(
402+
new StringInput(''),
403+
new NullOutput(),
404+
[__DIR__],
405+
null,
406+
null,
407+
[],
408+
null,
409+
null,
410+
'0',
411+
false,
412+
false,
413+
null,
414+
null,
415+
false,
416+
errorFormat: 'json',
417+
);
418+
$this->assertSame('json', $result->getContainer()->getParameter('errorFormat'));
419+
}
420+
421+
/**
422+
* @throws InceptionNotSuccessfulException
423+
*/
424+
public function testErrorFormatDefault(): void
425+
{
426+
$result = CommandHelper::begin(
427+
new StringInput(''),
428+
new NullOutput(),
429+
[__DIR__],
430+
null,
431+
null,
432+
[],
433+
null,
434+
null,
435+
'0',
436+
false,
437+
false,
438+
null,
439+
null,
440+
false,
441+
);
442+
$this->assertNull($result->getContainer()->getParameter('errorFormat'));
443+
}
444+
396445
}

0 commit comments

Comments
 (0)