Skip to content

Commit 66fc8c5

Browse files
committed
fix: use local server in tests httpstat.us is down
1 parent 81c4616 commit 66fc8c5

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

tests/data/app/status.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
$statusCode = filter_var($_GET['status'] ?? 200, FILTER_VALIDATE_INT);
5+
6+
http_response_code($statusCode);
7+
header("Content-Type: text/plain");
8+
echo "Status code: $statusCode\n";

tests/unit/Codeception/Module/PhpBrowserTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -708,37 +708,37 @@ public function testSetUserAgentUsingConfig(): void
708708

709709
public function testIfStatusCodeIsWithin2xxRange(): void
710710
{
711-
$this->module->amOnPage('https://httpstat.us/200');
711+
$this->module->amOnPage('http://localhost:8000/status.php?status=200');
712712
$this->module->seeResponseCodeIsSuccessful();
713713

714-
$this->module->amOnPage('https://httpstat.us/299');
714+
$this->module->amOnPage('http://localhost:8000/status.php?status=299');
715715
$this->module->seeResponseCodeIsSuccessful();
716716
}
717717

718718
public function testIfStatusCodeIsWithin3xxRange(): void
719719
{
720-
$this->module->amOnPage('https://httpstat.us/300');
720+
$this->module->amOnPage('http://localhost:8000/status.php?status=300');
721721
$this->module->seeResponseCodeIsRedirection();
722722

723-
$this->module->amOnPage('https://httpstat.us/399');
723+
$this->module->amOnPage('http://localhost:8000/status.php?status=399');
724724
$this->module->seeResponseCodeIsRedirection();
725725
}
726726

727727
public function testIfStatusCodeIsWithin4xxRange(): void
728728
{
729-
$this->module->amOnPage('https://httpstat.us/400');
729+
$this->module->amOnPage('http://localhost:8000/status.php?status=400');
730730
$this->module->seeResponseCodeIsClientError();
731731

732-
$this->module->amOnPage('https://httpstat.us/499');
732+
$this->module->amOnPage('http://localhost:8000/status.php?status=499');
733733
$this->module->seeResponseCodeIsClientError();
734734
}
735735

736736
public function testIfStatusCodeIsWithin5xxRange(): void
737737
{
738-
$this->module->amOnPage('https://httpstat.us/500');
738+
$this->module->amOnPage('http://localhost:8000/status.php?status=500');
739739
$this->module->seeResponseCodeIsServerError();
740740

741-
$this->module->amOnPage('https://httpstat.us/599');
741+
$this->module->amOnPage('http://localhost:8000/status.php?status=599');
742742
$this->module->seeResponseCodeIsServerError();
743743
}
744744

0 commit comments

Comments
 (0)