Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: XML and HTML reports as string paths instead of boolean options #1129

Open
wants to merge 1 commit into
base: v2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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