Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Sep 14, 2023
1 parent f7d7c4e commit 327364e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
$rectorConfig->skip([
ClosureToArrowFunctionRector::class,
JsonThrowOnErrorRector::class,
__DIR__ . '/tests/SynchronizerTest.php',
]);
};
17 changes: 9 additions & 8 deletions tests/SynchronizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,21 @@ public function testExecuteWithErrorCapture(): void
{
$result = false;

$exceptionMessage = null;
try {
$this->synchronizer->execute('testExecuteExceptionThrown', function () use (&$result) {
$undefined = null;
$result = file_exists($this->mutex->getFile());
return $undefined;
});
} catch (ErrorException $e) {
$this->assertSame(
PHP_VERSION_ID >= 80000 ? 'Undefined variable $undefined' : 'Undefined variable: undefined',
$e->getMessage(),
);
} finally {
$this->assertTrue($result);
$this->assertFileDoesNotExist($this->mutex->getFile());
$exceptionMessage = $e->getMessage();
}

$this->assertSame(
PHP_VERSION_ID >= 80000 ? 'Undefined variable $undefined' : 'Undefined variable: undefined',
$exceptionMessage,
);
$this->assertTrue($result);
$this->assertFileDoesNotExist($this->mutex->getFile());
}
}

0 comments on commit 327364e

Please sign in to comment.