Skip to content

Commit 29ce0d4

Browse files
committed
fix exception test
1 parent 8a327a5 commit 29ce0d4

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

tests/AppTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,16 @@ public function testAllowRouteOverrides()
324324
echo 'Hello first';
325325
});
326326

327-
$this->expectException(Exception::class);
328-
App::get('/')->action(function () {
329-
echo 'Hello second';
330-
});
327+
try {
328+
App::get('/')->action(function () {
329+
echo 'Hello second';
330+
});
331+
$this->fail('Failed to throw exception');
332+
} catch (Exception $e) {
333+
// Threw exception as expected
334+
$this->assertEquals('Route for (GET:) already registered.', $e->getMessage());
335+
336+
}
331337

332338
// Test success
333339
App::setAllowOverride(true);

0 commit comments

Comments
 (0)