Skip to content

Commit

Permalink
fix: XML and HTML reports as string paths instead of boolean options
Browse files Browse the repository at this point in the history
  • Loading branch information
petrisorciprian-vitals committed Apr 2, 2024
1 parent 24c1609 commit fcb12a5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions doc/tasks/codeception.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ grumphp:
fail_fast: false
suite: ~
test: ~
xml: false
html: false
xml: ~
html: ~
```
Expand Down Expand Up @@ -52,12 +52,12 @@ This option can only be used in combination with a suite.

**xml**

*Default: false*
*Default: null*

When this option is enabled, Codeception will output an XML report for the test run.
When this option is specified, Codeception will output an XML report for the test run. If left `null`, no XML report is generated.

**html**

*Default: false*
*Default: null*

When this option is enabled, Codeception will output an HTML report for the test run.
When this option is specified, Codeception will output an HTML report for the test run. If left `null`, no HTML report is generated.
12 changes: 6 additions & 6 deletions src/Task/Codeception.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ public static function getConfigurableOptions(): ConfigOptionsResolver
'suite' => null,
'test' => null,
'fail_fast' => false,
'xml' => false,
'html' => false,
'xml' => null,
'html' => null,
]);

$resolver->addAllowedTypes('config_file', ['null', 'string']);
$resolver->addAllowedTypes('suite', ['null', 'string']);
$resolver->addAllowedTypes('test', ['null', 'string']);
$resolver->addAllowedTypes('fail_fast', ['bool']);
$resolver->addAllowedTypes('xml', ['bool']);
$resolver->addAllowedTypes('html', ['bool']);
$resolver->addAllowedTypes('xml', ['null', 'string']);
$resolver->addAllowedTypes('html', ['null', 'string']);

return ConfigOptionsResolver::fromOptionsResolver($resolver);
}
Expand Down Expand Up @@ -64,8 +64,8 @@ public function run(ContextInterface $context): TaskResultInterface
$arguments->add('run');
$arguments->addOptionalArgument('--config=%s', $config['config_file']);
$arguments->addOptionalArgument('--fail-fast', $config['fail_fast']);
$arguments->addOptionalArgument('--xml', $config['xml']);
$arguments->addOptionalArgument('--html', $config['html']);
$arguments->addOptionalArgument('--xml=%s', $config['xml']);
$arguments->addOptionalArgument('--html=%s', $config['html']);
$arguments->addOptionalArgument('%s', $config['suite']);
$arguments->addOptionalArgument('%s', $config['test']);

Expand Down
12 changes: 6 additions & 6 deletions test/Unit/Task/CodeceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public function provideConfigurableOptions(): iterable
'suite' => null,
'test' => null,
'fail_fast' => false,
'xml' => false,
'html' => false,
'xml' => null,
'html' => null,
]
];
}
Expand Down Expand Up @@ -147,24 +147,24 @@ public function provideExternalTaskRuns(): iterable
];
yield 'xml' => [
[
'xml' => true,
'xml' => 'report.xml',
],
$this->mockContext(RunContext::class, ['hello.php', 'hello2.php']),
'codecept',
[
'run',
'--xml'
'--xml=report.xml'
]
];
yield 'html' => [
[
'html' => true,
'html' => 'report.html',
],
$this->mockContext(RunContext::class, ['hello.php', 'hello2.php']),
'codecept',
[
'run',
'--html'
'--html=report.html'
]
];
}
Expand Down

0 comments on commit fcb12a5

Please sign in to comment.