Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class MyTest extends TestCase
// Wait until the result is set (max 10 seconds, check every 500ms)
self::assertEventually(function () use (&$result) {
$this->assertNotNull($result);
$this->assertEquals('expected', $result);
$this->assertSame('expected', $result);
}, timeoutMs: 10000, waitMs: 500);
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/AsyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function testCriticalExceptionStopsRetrying(): void
}, timeoutMs: 5000, waitMs: 100);

// Counter should be exactly 2, not more
$this->assertEquals(2, $counter);
$this->assertSame(2, $counter);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Unreachable assertion after expectException.

This assertion will never execute because the Critical exception thrown at line 47 is caught by PHPUnit (via expectException at line 42), ending the test immediately. The counter verification intended here never occurs.

Consider removing this line or restructuring the test to verify the counter value in a way that's actually reachable.

Note: This is a pre-existing issue not introduced by this PR, but worth addressing while modifying this line.

🤖 Prompt for AI Agents
In tests/AsyncTest.php around line 53, the assertion `$this->assertSame(2,
$counter);` is unreachable because PHPUnit's expectException causes the test to
end when the Critical exception is thrown; either remove this unreachable
assertion or restructure the test so the counter is verified: either (a) move
the counter assertion to before the point that triggers the exception, or (b)
remove expectException and wrap the code that throws in a try/catch, asserting
the counter in the catch (and rethrow or assert the exception) so the counter
check runs.

}

public function testDefaultTimeout(): void
Expand Down Expand Up @@ -82,9 +82,9 @@ public function testMultipleAssertionsInProbe(): void
$counter++;
$this->assertGreaterThan(0, $counter);
$this->assertLessThanOrEqual(10, $counter);
$this->assertEquals(3, $counter); // Will pass on 3rd attempt
$this->assertSame(3, $counter); // Will pass on 3rd attempt
}, timeoutMs: 3000, waitMs: 100);

$this->assertEquals(3, $counter);
$this->assertSame(3, $counter);
}
}