Skip to content

Commit

Permalink
DX: Allow PHPUnit 7 (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Sep 24, 2020
1 parent 1c7f906 commit 7d872a9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"symfony/yaml": "^2.0.5 || ^3.0 || ^4.0 || ^5.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.4.3 || ^6.0"
"phpunit/phpunit": "^4.8.35 || ^5.4.3 || ^6.0 || ^7.0"
},
"suggest": {
"symfony/http-kernel": "Allows Symfony integration"
Expand Down
35 changes: 23 additions & 12 deletions tests/ProjectTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,29 +150,40 @@ protected function normalizePath($path)
}

/**
* @param string $expected
* @param string $input
* @param string $msg
* @param string $expected
* @param string $input
* @param null|string $msg
*/
protected function assertSamePath($expected, $input, $msg = null)
{
$this->assertSame(
$this->normalizePath($expected),
$this->normalizePath($input),
$msg
);
if ($msg !== null) {
$this->assertSame(
$this->normalizePath($expected),
$this->normalizePath($input),
$msg
);
} else {
$this->assertSame(
$this->normalizePath($expected),
$this->normalizePath($input)
);
}
}

/**
* @param string[] $expected
* @param string[] $input
* @param string $msg
* @param string[] $expected
* @param string[] $input
* @param null|string $msg
*/
protected function assertSamePaths(array $expected, array $input, $msg = null)
{
$expected = array_map(function ($path) { return $this->normalizePath($path); }, $expected);
$input = array_map(function ($path) { return $this->normalizePath($path); }, $input);

$this->assertSame($expected, $input, $msg);
if ($msg !== null) {
$this->assertSame($expected, $input, $msg);
} else {
$this->assertSame($expected, $input);
}
}
}

0 comments on commit 7d872a9

Please sign in to comment.