Skip to content

Commit

Permalink
DX: check deprecations exactly - order or count of expectation vs act…
Browse files Browse the repository at this point in the history
…ual usage can vary, but result sets must be identical
  • Loading branch information
keradus committed Jan 15, 2024
1 parent 36fcb86 commit e84d2c2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ abstract class TestCase extends BaseTestCase
protected function tearDown(): void
{
if (null !== $this->previouslyDefinedErrorHandler) {
$this->actualDeprecations = array_unique($this->actualDeprecations);
sort($this->actualDeprecations);
$this->expectedDeprecations = array_unique($this->expectedDeprecations);
sort($this->expectedDeprecations);
self::assertSame($this->expectedDeprecations, $this->actualDeprecations);

restore_error_handler();
}

parent::tearDown();
}

final public function testNotDefiningConstructor(): void
Expand Down Expand Up @@ -66,8 +72,6 @@ function (
) {
if (E_USER_DEPRECATED === $code || E_DEPRECATED === $code) {
$this->actualDeprecations[] = $message;
$this->actualDeprecations = array_unique($this->actualDeprecations);
sort($this->actualDeprecations);
}

return true;
Expand Down

0 comments on commit e84d2c2

Please sign in to comment.