Skip to content

Commit 6969a53

Browse files
committed
test: fix $request->setMethod() HTTP verbs
1 parent f3302a4 commit 6969a53

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

tests/system/Router/RouteCollectionTest.php

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function testAddIgnoresDefaultNamespaceWhenExists(): void
144144

145145
public function testAddWorksWithCurrentHTTPMethods(): void
146146
{
147-
Services::request()->setMethod('get');
147+
Services::request()->setMethod('GET');
148148

149149
$routes = $this->getCollector();
150150

@@ -176,7 +176,7 @@ public function testAddWithLeadingSlash(): void
176176

177177
public function testMatchIgnoresInvalidHTTPMethods(): void
178178
{
179-
Services::request()->setMethod('get');
179+
Services::request()->setMethod('GET');
180180

181181
$routes = $this->getCollector();
182182

@@ -189,7 +189,7 @@ public function testMatchIgnoresInvalidHTTPMethods(): void
189189

190190
public function testAddWorksWithArrayOFHTTPMethods(): void
191191
{
192-
Services::request()->setMethod('post');
192+
Services::request()->setMethod('POST');
193193

194194
$routes = $this->getCollector();
195195

@@ -696,7 +696,7 @@ public function testPresenterScaffoldsCorrectly(): void
696696

697697
public function testResourcesWithCustomController(): void
698698
{
699-
Services::request()->setMethod('get');
699+
Services::request()->setMethod('GET');
700700
$routes = $this->getCollector();
701701

702702
$routes->resource('photos', ['controller' => '<script>gallery']);
@@ -713,7 +713,7 @@ public function testResourcesWithCustomController(): void
713713

714714
public function testResourcesWithCustomPlaceholder(): void
715715
{
716-
Services::request()->setMethod('get');
716+
Services::request()->setMethod('GET');
717717
$routes = $this->getCollector();
718718

719719
$routes->resource('photos', ['placeholder' => ':num']);
@@ -730,7 +730,7 @@ public function testResourcesWithCustomPlaceholder(): void
730730

731731
public function testResourcesWithDefaultPlaceholder(): void
732732
{
733-
Services::request()->setMethod('get');
733+
Services::request()->setMethod('GET');
734734
$routes = $this->getCollector();
735735

736736
$routes->setDefaultConstraint('num');
@@ -748,7 +748,7 @@ public function testResourcesWithDefaultPlaceholder(): void
748748

749749
public function testResourcesWithBogusDefaultPlaceholder(): void
750750
{
751-
Services::request()->setMethod('get');
751+
Services::request()->setMethod('GET');
752752
$routes = $this->getCollector();
753753

754754
$routes->setDefaultConstraint(':num');
@@ -766,7 +766,7 @@ public function testResourcesWithBogusDefaultPlaceholder(): void
766766

767767
public function testResourcesWithOnly(): void
768768
{
769-
Services::request()->setMethod('get');
769+
Services::request()->setMethod('GET');
770770
$routes = $this->getCollector();
771771

772772
$routes->resource('photos', ['only' => 'index']);
@@ -780,7 +780,7 @@ public function testResourcesWithOnly(): void
780780

781781
public function testResourcesWithExcept(): void
782782
{
783-
Services::request()->setMethod('get');
783+
Services::request()->setMethod('GET');
784784
$routes = $this->getCollector();
785785

786786
$routes->resource('photos', ['except' => 'edit,new']);
@@ -811,23 +811,23 @@ public function testResourcesWithWebsafe(): void
811811

812812
public function testMatchSupportsMultipleMethods(): void
813813
{
814-
Services::request()->setMethod('get');
814+
Services::request()->setMethod('GET');
815815
$routes = $this->getCollector();
816816

817817
$expected = ['here' => '\there'];
818818

819819
$routes->match(['GET', 'POST'], 'here', 'there');
820820
$this->assertSame($expected, $routes->getRoutes());
821821

822-
Services::request()->setMethod('post');
822+
Services::request()->setMethod('POST');
823823
$routes = $this->getCollector();
824824
$routes->match(['GET', 'POST'], 'here', 'there');
825825
$this->assertSame($expected, $routes->getRoutes());
826826
}
827827

828828
public function testGet(): void
829829
{
830-
Services::request()->setMethod('get');
830+
Services::request()->setMethod('GET');
831831
$routes = $this->getCollector();
832832

833833
$expected = ['here' => '\there'];
@@ -949,7 +949,7 @@ public function testEnvironmentRestricts(): void
949949
{
950950
// ENVIRONMENT should be 'testing'
951951

952-
Services::request()->setMethod('get');
952+
Services::request()->setMethod('GET');
953953
$routes = $this->getCollector();
954954

955955
$expected = ['here' => '\there'];
@@ -1434,7 +1434,7 @@ static function (): void {},
14341434

14351435
public function testRouteGroupWithFilterSimple(): void
14361436
{
1437-
Services::request()->setMethod('get');
1437+
Services::request()->setMethod('GET');
14381438
$routes = $this->getCollector();
14391439

14401440
$routes->group(
@@ -1453,7 +1453,7 @@ static function ($routes): void {
14531453

14541454
public function testRouteGroupWithFilterWithParams(): void
14551455
{
1456-
Services::request()->setMethod('get');
1456+
Services::request()->setMethod('GET');
14571457
$routes = $this->getCollector();
14581458

14591459
$routes->group(
@@ -1471,15 +1471,15 @@ static function ($routes): void {
14711471

14721472
public function test404OverrideNot(): void
14731473
{
1474-
Services::request()->setMethod('get');
1474+
Services::request()->setMethod('GET');
14751475
$routes = $this->getCollector();
14761476

14771477
$this->assertNull($routes->get404Override());
14781478
}
14791479

14801480
public function test404OverrideString(): void
14811481
{
1482-
Services::request()->setMethod('get');
1482+
Services::request()->setMethod('GET');
14831483
$routes = $this->getCollector();
14841484

14851485
$routes->set404Override('Explode');
@@ -1488,7 +1488,7 @@ public function test404OverrideString(): void
14881488

14891489
public function test404OverrideCallable(): void
14901490
{
1491-
Services::request()->setMethod('get');
1491+
Services::request()->setMethod('GET');
14921492
$routes = $this->getCollector();
14931493

14941494
$routes->set404Override(static function (): void {
@@ -1499,7 +1499,7 @@ public function test404OverrideCallable(): void
14991499

15001500
public function testOffsetParameters(): void
15011501
{
1502-
Services::request()->setMethod('get');
1502+
Services::request()->setMethod('GET');
15031503
$routes = $this->getCollector();
15041504

15051505
$routes->get('users/(:num)', 'users/show/$1', ['offset' => 1]);
@@ -1515,7 +1515,7 @@ public function testOffsetParameters(): void
15151515
public function testRouteToWithSubdomainMatch(): void
15161516
{
15171517
$_SERVER['HTTP_HOST'] = 'doc.example.com';
1518-
Services::request()->setMethod('get');
1518+
Services::request()->setMethod('GET');
15191519

15201520
$routes = $this->getCollector();
15211521

@@ -1527,7 +1527,7 @@ public function testRouteToWithSubdomainMatch(): void
15271527
public function testRouteToWithSubdomainMismatch(): void
15281528
{
15291529
$_SERVER['HTTP_HOST'] = 'dev.example.com';
1530-
Services::request()->setMethod('get');
1530+
Services::request()->setMethod('GET');
15311531

15321532
$routes = $this->getCollector();
15331533

@@ -1539,7 +1539,7 @@ public function testRouteToWithSubdomainMismatch(): void
15391539
public function testRouteToWithSubdomainNot(): void
15401540
{
15411541
$_SERVER['HTTP_HOST'] = 'example.com';
1542-
Services::request()->setMethod('get');
1542+
Services::request()->setMethod('GET');
15431543

15441544
$routes = $this->getCollector();
15451545

@@ -1551,7 +1551,7 @@ public function testRouteToWithSubdomainNot(): void
15511551
public function testRouteToWithGenericSubdomainMatch(): void
15521552
{
15531553
$_SERVER['HTTP_HOST'] = 'doc.example.com';
1554-
Services::request()->setMethod('get');
1554+
Services::request()->setMethod('GET');
15551555

15561556
$routes = $this->getCollector();
15571557

@@ -1563,7 +1563,7 @@ public function testRouteToWithGenericSubdomainMatch(): void
15631563
public function testRouteToWithGenericSubdomainMismatch(): void
15641564
{
15651565
$_SERVER['HTTP_HOST'] = 'dev.example.com';
1566-
Services::request()->setMethod('get');
1566+
Services::request()->setMethod('GET');
15671567

15681568
$routes = $this->getCollector();
15691569

@@ -1575,7 +1575,7 @@ public function testRouteToWithGenericSubdomainMismatch(): void
15751575
public function testRouteToWithGenericSubdomainNot(): void
15761576
{
15771577
$_SERVER['HTTP_HOST'] = 'example.com';
1578-
Services::request()->setMethod('get');
1578+
Services::request()->setMethod('GET');
15791579

15801580
$routes = $this->getCollector();
15811581

@@ -1587,7 +1587,7 @@ public function testRouteToWithGenericSubdomainNot(): void
15871587
public function testRouteToWithoutSubdomainMatch(): void
15881588
{
15891589
$_SERVER['HTTP_HOST'] = 'doc.example.com';
1590-
Services::request()->setMethod('get');
1590+
Services::request()->setMethod('GET');
15911591

15921592
$routes = $this->getCollector();
15931593

@@ -1599,7 +1599,7 @@ public function testRouteToWithoutSubdomainMatch(): void
15991599
public function testRouteToWithoutSubdomainMismatch(): void
16001600
{
16011601
$_SERVER['HTTP_HOST'] = 'dev.example.com';
1602-
Services::request()->setMethod('get');
1602+
Services::request()->setMethod('GET');
16031603

16041604
$routes = $this->getCollector();
16051605

@@ -1611,7 +1611,7 @@ public function testRouteToWithoutSubdomainMismatch(): void
16111611
public function testRouteToWithoutSubdomainNot(): void
16121612
{
16131613
$_SERVER['HTTP_HOST'] = 'example.com';
1614-
Services::request()->setMethod('get');
1614+
Services::request()->setMethod('GET');
16151615

16161616
$routes = $this->getCollector();
16171617

@@ -1628,7 +1628,7 @@ public function testRouteToWithoutSubdomainNot(): void
16281628
public function testRouteOverwritingDifferentSubdomains(): void
16291629
{
16301630
$_SERVER['HTTP_HOST'] = 'doc.domain.com';
1631-
Services::request()->setMethod('get');
1631+
Services::request()->setMethod('GET');
16321632

16331633
$routes = $this->getCollector();
16341634
$router = new Router($routes, Services::request());
@@ -1649,7 +1649,7 @@ public function testRouteOverwritingDifferentSubdomains(): void
16491649
public function testRouteOverwritingTwoRules(): void
16501650
{
16511651
$_SERVER['HTTP_HOST'] = 'doc.domain.com';
1652-
Services::request()->setMethod('get');
1652+
Services::request()->setMethod('GET');
16531653

16541654
$routes = $this->getCollector();
16551655
$router = new Router($routes, Services::request());
@@ -1670,7 +1670,7 @@ public function testRouteOverwritingTwoRules(): void
16701670
public function testRouteOverwritingTwoRulesLastApplies(): void
16711671
{
16721672
$_SERVER['HTTP_HOST'] = 'doc.domain.com';
1673-
Services::request()->setMethod('get');
1673+
Services::request()->setMethod('GET');
16741674

16751675
$routes = $this->getCollector();
16761676
$router = new Router($routes, Services::request());
@@ -1690,7 +1690,7 @@ public function testRouteOverwritingTwoRulesLastApplies(): void
16901690
public function testRouteOverwritingMatchingSubdomain(): void
16911691
{
16921692
$_SERVER['HTTP_HOST'] = 'doc.domain.com';
1693-
Services::request()->setMethod('get');
1693+
Services::request()->setMethod('GET');
16941694

16951695
$routes = $this->getCollector();
16961696
$router = new Router($routes, Services::request());
@@ -1710,7 +1710,7 @@ public function testRouteOverwritingMatchingSubdomain(): void
17101710
public function testRouteOverwritingMatchingHost(): void
17111711
{
17121712
$_SERVER['HTTP_HOST'] = 'doc.domain.com';
1713-
Services::request()->setMethod('get');
1713+
Services::request()->setMethod('GET');
17141714

17151715
$routes = $this->getCollector();
17161716
$router = new Router($routes, Services::request());
@@ -1734,7 +1734,7 @@ public function testRouteOverwritingMatchingHost(): void
17341734
*/
17351735
public function testRouteDefaultNameSpace(): void
17361736
{
1737-
Services::request()->setMethod('get');
1737+
Services::request()->setMethod('GET');
17381738
$routes = $this->getCollector();
17391739
$router = new Router($routes, Services::request());
17401740

@@ -1748,7 +1748,7 @@ public function testRouteDefaultNameSpace(): void
17481748

17491749
public function testZeroAsURIPath(): void
17501750
{
1751-
Services::request()->setMethod('get');
1751+
Services::request()->setMethod('GET');
17521752
$routes = $this->getCollector();
17531753
$router = new Router($routes, Services::request());
17541754

@@ -1796,7 +1796,7 @@ public function testAutoRoutesControllerNameReturnsFQCN($namespace): void
17961796
*/
17971797
public function testRoutesControllerNameReturnsFQCN($namespace): void
17981798
{
1799-
Services::request()->setMethod('get');
1799+
Services::request()->setMethod('GET');
18001800
$routes = $this->getCollector();
18011801
$routes->setAutoRoute(false);
18021802
$routes->setDefaultNamespace($namespace);

tests/system/Router/RouterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected function setUp(): void
6565
$this->collection->map($routes);
6666

6767
$this->request = Services::request();
68-
$this->request->setMethod('get');
68+
$this->request->setMethod('GET');
6969
}
7070

7171
public function testEmptyURIMatchesRoot(): void

0 commit comments

Comments
 (0)