Skip to content

Commit

Permalink
fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
ShockedPlot7560 authored Jul 9, 2024
1 parent 4a0ec1d commit 872efd8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/TestProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ public function stop() : void {
if (TestMemory::$currentTest !== null) {
global $lastExceptionError, $lastError;
$error = $lastExceptionError ?? $lastError;
if($error === null){
if ($error === null) {
TestResults::fatalTest(TestMemory::$currentTest, new ServerCrashedException());
}else{
} else {
TestResults::fatalTest(TestMemory::$currentTest, ServerCrashedException::fromArray($error));
}
$this->finish(false);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/TimeoutException.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
use RuntimeException;

class TimeoutException extends RuntimeException {
}
}
17 changes: 9 additions & 8 deletions tests/pmmpunit/suitetest/normal/tests/TimeoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ShockedPlot7560\PmmpUnit\tests\normal;

use Exception;
use React\Promise\PromiseInterface;
use ShockedPlot7560\PmmpUnit\framework\attribute\ExpectedExceptionAttribute;
use ShockedPlot7560\PmmpUnit\framework\TestCase;
Expand All @@ -12,15 +13,15 @@ class TimeoutTest extends TestCase {
/**
* @return PromiseInterface<null>
*/
#[ExpectedExceptionAttribute(TimeoutException::class)]
#[ExpectedExceptionAttribute(TimeoutException::class)]
public function testTimeout() : PromiseInterface {
return $this->getPlayer()->then(function (TestPlayer $testPlayer) {
$promise = $this->promisePlayerReceiveMessageEquals("an_unique_string", $testPlayer, timeout: 5);
return $this->getPlayer()->then(function (TestPlayer $testPlayer) {
$promise = $this->promisePlayerReceiveMessageEquals("an_unique_string", $testPlayer, timeout: 5);

return $promise;
})
->then(function () {
throw new \Exception("This should not be called");
});
return $promise;
})
->then(function () {
throw new Exception("This should not be called");
});
}
}

0 comments on commit 872efd8

Please sign in to comment.