Skip to content

Commit

Permalink
normalize path for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nuernbergerA committed Jan 28, 2024
1 parent b1558dd commit e70edbf
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/Visual/JUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@
}
};

test('junit output', function () use ($run) {
$normalizedPath = function (string $path) {
return str_replace('/', DIRECTORY_SEPARATOR, $path);
};

test('junit output', function () use ($normalizedPath, $run) {
$result = $run('tests/.tests/SuccessOnly.php');

expect($result['testsuite']['@attributes'])
->name->toBe('Tests\tests\SuccessOnly')
->file->toBe('tests/.tests/SuccessOnly.php')
->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php'))
->tests->toBe('2')
->assertions->toBe('2')
->errors->toBe('0')
Expand All @@ -43,19 +47,19 @@

expect($result['testsuite']['testcase'][0]['@attributes'])
->name->toBe('it can pass with comparison')
->file->toBe('tests/.tests/SuccessOnly.php::it can pass with comparison')
->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php::it can pass with comparison'))
->class->toBe('Tests\tests\SuccessOnly')
->classname->toBe('Tests.tests.SuccessOnly')
->assertions->toBe('1')
->time->toStartWith('0.0');
});

test('junit with parallel', function () use ($run) {
test('junit with parallel', function () use ($normalizedPath, $run) {
$result = $run('tests/.tests/SuccessOnly.php', '--parallel', '--processes=1', '--filter', 'can pass with comparison');

expect($result['testsuite']['@attributes'])
->name->toBe('Tests\tests\SuccessOnly')
->file->toBe('tests/.tests/SuccessOnly.php')
->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php'))
->tests->toBe('1')
->assertions->toBe('1')
->errors->toBe('0')
Expand All @@ -67,7 +71,7 @@

expect($result['testsuite']['testcase']['@attributes'])
->name->toBe('it can pass with comparison')
->file->toBe('tests/.tests/SuccessOnly.php::it can pass with comparison')
->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php::it can pass with comparison'))
->class->toBe('Tests\tests\SuccessOnly')
->classname->toBe('Tests.tests.SuccessOnly')
->assertions->toBe('1')
Expand Down

0 comments on commit e70edbf

Please sign in to comment.