Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/CodeceptionAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ final class CodeceptionAdapter implements MemoryUsageAware, TestFrameworkAdapter
private ?string $cachedVersion = null;

public function __construct(
private readonly string $name,
private string $testFrameworkExecutable,
private CommandLineBuilder $commandLineBuilder,
private VersionParser $versionParser,
Expand Down Expand Up @@ -137,7 +138,7 @@ public function getMemoryUsed(string $output): float

public function getName(): string
{
return self::NAME;
return $this->name;
}

public function getInitialTestRunCommandLine(string $extraOptions, array $phpExtraArgs, bool $skipCoverage): array
Expand Down
7 changes: 5 additions & 2 deletions src/CodeceptionAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

final class CodeceptionAdapterFactory implements TestFrameworkAdapterFactory
{
private const NAME = 'Codeception';

private const COVERAGE_DIR = 'coverage-xml';

/**
Expand All @@ -62,9 +64,10 @@ public static function create(
bool $skipCoverage,
): TestFrameworkAdapter {
return new CodeceptionAdapter(
self::NAME,
$testFrameworkExecutable,
new CommandLineBuilder(),
new VersionParser(),
new VersionParser(self::NAME),
new JUnitTestCaseSorter(),
new Filesystem(),
Path::makeRelative($jUnitFilePath, $tmpDir),
Expand All @@ -80,7 +83,7 @@ public static function create(

public static function getAdapterName(): string
{
return CodeceptionAdapter::NAME;
return 'codeception';
}

public static function getExecutableName(): string
Expand Down
7 changes: 6 additions & 1 deletion src/VersionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ class VersionParser
{
private const VERSION_REGEX = '/(?<version>[0-9]+\.[0-9]+\.?[0-9]*)(?<prerelease>-[0-9a-zA-Z.]+)?(?<build>\+[0-9a-zA-Z.]+)?/';

public function __construct(
private readonly string $name,
) {
}

/**
* @throws InvalidVersion
*/
Expand All @@ -56,7 +61,7 @@ public function parse(string $content): string

if (!$matched) {
throw self::createInvalidVersion(
CodeceptionAdapter::NAME,
$this->name,
$content,
);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/phpunit/Adapter/CodeceptionAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,10 @@ public static function phpCoverageOptionProvider(): iterable
private function createAdapter(?array $config = null, ?string $version = 'unknown'): CodeceptionAdapter
{
$adapter = new CodeceptionAdapter(
'codeception',
'/path/to/codeception',
new CommandLineBuilder(),
new VersionParser(),
new VersionParser('Codeception'),
new JUnitTestCaseSorter(),
new Filesystem(),
'path/to/junit',
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/Adapter/VersionParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class VersionParserTest extends TestCase

protected function setUp(): void
{
$this->versionParser = new VersionParser();
$this->versionParser = new VersionParser('TestCodeception');
}

/**
Expand All @@ -62,7 +62,7 @@ public function test_it_throws_exception_when_content_has_no_version_substring()
{
$this->expectExceptionObject(
new InvalidVersion(
'Could not recognise the test framework version for codeception for the value "abc".',
'Could not recognise the test framework version for TestCodeception for the value "abc".',
),
);

Expand Down
Loading