Test Failed
Pull Request — master (#2)
by Falk
01:43
created
spec/Suite/Router.spec.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         it("matches on methods", function() {
72 72
 
73 73
             $r = $this->router;
74
-            $r->bind('foo/bar', ['methods' => ['POST', 'PUT']], function () {});
74
+            $r->bind('foo/bar', ['methods' => ['POST', 'PUT']], function() {});
75 75
 
76 76
             $route = $r->route('foo/bar', 'POST');
77 77
             expect($route->getMethods())->toBe(['POST', 'PUT']);
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 
89 89
         it("matches on same path different methods", function() {
90 90
             $r = $this->router;
91
-            $r->bind('foo/bar', ['name' => 'foo', 'methods' => ['GET']], function () {});
92
-            $r->bind('foo/bar', ['name' => 'bar', 'methods' => ['PUT']], function () {});
91
+            $r->bind('foo/bar', ['name' => 'foo', 'methods' => ['GET']], function() {});
92
+            $r->bind('foo/bar', ['name' => 'bar', 'methods' => ['PUT']], function() {});
93 93
 
94 94
             $route = $r->route('foo/bar', 'PUT');
95 95
             expect($route->name)->toBe('bar');
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         it("supports lowercase method names", function() {
99 99
 
100 100
             $r = $this->router;
101
-            $r->bind('foo/bar', ['methods' => ['POST', 'PUT']], function () {});
101
+            $r->bind('foo/bar', ['methods' => ['POST', 'PUT']], function() {});
102 102
 
103 103
             $route = $r->route('foo/bar', 'post');
104 104
             expect($route->getMethods())->toBe(['POST', 'PUT']);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             $r->basePath('app');
146 146
 
147 147
             $r->group(['host' => 'www.{domain}.com', 'scheme' => 'https'], function($r) {
148
-                $r->bind('foo/{bar}', ['name' => 'foo'], function () {});
148
+                $r->bind('foo/{bar}', ['name' => 'foo'], function() {});
149 149
             });
150 150
 
151 151
             $link = $r->link('foo', [
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             $r = $this->router;
162 162
             $r->group('foo', ['name' => 'foz'], function($r) {
163 163
                 $r->group('bar', ['name' => 'baz'], function($r) {
164
-                    $r->bind('{var1}', ['name' => 'quz'], function () {});
164
+                    $r->bind('{var1}', ['name' => 'quz'], function() {});
165 165
                 });
166 166
             });
167 167
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
             $r = $this->router;
176 176
             $r->group('{locale:en|fr}', ['persist' => 'locale'], function($r) {
177
-                $r->bind('{controller}/{action}[/{id}]', ['name' => 'controller'], function () {});
177
+                $r->bind('{controller}/{action}[/{id}]', ['name' => 'controller'], function() {});
178 178
             });
179 179
 
180 180
             $r->route('fr/post/index');
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
             $r = $this->router;
201 201
             $r->group('{locale:en|fr}', ['persist' => 'locale'], function($r) {
202
-                $r->bind('{controller}/{action}[/{id}]', ['name' => 'controller'], function () {});
202
+                $r->bind('{controller}/{action}[/{id}]', ['name' => 'controller'], function() {});
203 203
             });
204 204
 
205 205
             $r->route('fr/post/index');
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         it("routes on a simple route", function() {
231 231
 
232 232
             $r = $this->router;
233
-            $r->bind('foo/bar', function () {});
233
+            $r->bind('foo/bar', function() {});
234 234
 
235 235
             $route = $r->route('foo/bar', 'GET');
236 236
             expect($this->export($route->request))->toEqual([
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         it("routes on a named route", function() {
251 251
 
252 252
             $r = $this->router;
253
-            $r->bind('foo/bar', ['name' => 'foo'], function () {});
253
+            $r->bind('foo/bar', ['name' => 'foo'], function() {});
254 254
 
255 255
             $route = $r->route('foo/bar', 'GET');
256 256
             expect($route->name)->toBe('foo');
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         it("supports empty as index route", function() {
266 266
 
267 267
             $r = $this->router;
268
-            $r->bind('', function () {});
268
+            $r->bind('', function() {});
269 269
 
270 270
             $route = $r->route('', 'GET');
271 271
             expect($this->export($route->request))->toEqual([
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         it("supports a slash as indes route", function() {
281 281
 
282 282
             $r = $this->router;
283
-            $r->bind('/', function () {});
283
+            $r->bind('/', function() {});
284 284
 
285 285
             $route = $r->route('', 'GET');
286 286
             expect($this->export($route->request))->toEqual([
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
             $r->get('foo/{var1:\d+}', ['host' => '{subdomain:foo}.{domain}.bar'], function() {});
423 423
 
424 424
             $route = $r->route('foo/25', 'GET', 'foo.biz.bar');
425
-            expect($route->params)->toBe([ 'subdomain' => 'foo', 'domain' => 'biz', 'var1' => '25']);
425
+            expect($route->params)->toBe(['subdomain' => 'foo', 'domain' => 'biz', 'var1' => '25']);
426 426
 
427 427
             try {
428 428
                 $route = $r->route('foo/bar', 'GET', 'foo.biz.bar');
@@ -450,13 +450,13 @@  discard block
 block discarded – undo
450 450
         it("supports RESTful routes", function() {
451 451
 
452 452
             $r = $this->router;
453
-            $r->get('foo/bar', function () {});
454
-            $r->head('foo/bar', function () {});
455
-            $r->post('foo/bar', function () {});
456
-            $r->put('foo/bar', function () {});
457
-            $r->patch('foo/bar', function () {});
458
-            $r->delete('foo/bar', function () {});
459
-            $r->options('foo/bar', function () {});
453
+            $r->get('foo/bar', function() {});
454
+            $r->head('foo/bar', function() {});
455
+            $r->post('foo/bar', function() {});
456
+            $r->put('foo/bar', function() {});
457
+            $r->patch('foo/bar', function() {});
458
+            $r->delete('foo/bar', function() {});
459
+            $r->options('foo/bar', function() {});
460 460
 
461 461
             $methods = ['OPTIONS', 'DELETE', 'PATCH', 'PUT', 'POST', 'HEAD', 'GET'];
462 462
 
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
         it("matches relationships based routes", function() {
487 487
 
488 488
             $r = $this->router;
489
-            $r->get('[/{relations:[^/]+/[^/:][^/]*}]*/comment[/{id:[^/:][^/]*}][/:{action}]', function () {});
489
+            $r->get('[/{relations:[^/]+/[^/:][^/]*}]*/comment[/{id:[^/:][^/]*}][/:{action}]', function() {});
490 490
 
491 491
             $route = $r->route('blog/1/post/22/comment/:show', 'GET');
492 492
             expect($route->params)->toBe([
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
         it("dispatches HEAD requests on matching GET routes if the HEAD routes are missing", function() {
504 504
 
505 505
             $r = $this->router;
506
-            $r->get('foo/bar', function () { return 'GET'; });
506
+            $r->get('foo/bar', function() { return 'GET'; });
507 507
 
508 508
             $route = $r->route('foo/bar', 'HEAD');
509 509
             expect($route->getMethods())->toBe(['GET']);
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 
515 515
             $r = $this->router;
516 516
 
517
-            $r->head('foo/bar', function () { return 'HEAD'; });
518
-            $r->get('foo/bar', function () { return 'GET'; });
517
+            $r->head('foo/bar', function() { return 'HEAD'; });
518
+            $r->get('foo/bar', function() { return 'GET'; });
519 519
 
520 520
             $route = $r->route('foo/bar', 'HEAD');
521 521
             expect($route->getMethods())->toBe(['GET', 'HEAD']);
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
         it("supports requests as a list of arguments", function() {
526 526
 
527 527
             $r = $this->router;
528
-            $r->bind('foo/bar', function () {});
528
+            $r->bind('foo/bar', function() {});
529 529
 
530 530
             $route = $r->route('foo/bar', 'GET');
531 531
             expect($this->export($route->request))->toEqual([
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
         it("supports requests as an object", function() {
541 541
             $r = $this->router;
542
-            $r->bind('foo/bar', function () {});
542
+            $r->bind('foo/bar', function() {});
543 543
 
544 544
             $request = Double::instance(['implements' => ServerRequestInterface::class]);
545 545
             $uri = Double::instance(['implements' => UriInterface::class]);
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
         it("supports requests as an array", function() {
560 560
 
561 561
             $r = $this->router;
562
-            $r->bind('foo/bar', function () {});
562
+            $r->bind('foo/bar', function() {});
563 563
 
564 564
             $route = $r->route(['path' =>'foo/bar'], 'GET');
565 565
             expect($this->export($route->request))->toEqual([
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 
608 608
                 $r = $this->router;
609 609
                 $r->group('foo', function($r) {
610
-                    $r->bind('{var1}', function () {});
610
+                    $r->bind('{var1}', function() {});
611 611
                 });
612 612
 
613 613
             });
@@ -620,9 +620,9 @@  discard block
 block discarded – undo
620 620
 
621 621
             });
622 622
 
623
-            it("throws an exception when the prefix does not match", function () {
623
+            it("throws an exception when the prefix does not match", function() {
624 624
 
625
-                $closure = function () {
625
+                $closure = function() {
626 626
                     $r = $this->router;
627 627
                     $route = $r->route('bar/foo', 'GET');
628 628
                 };
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 
638 638
                 $r = $this->router;
639 639
                 $r->group('foo', function($r) {
640
-                    $r->bind('[{var1}]', function () {});
640
+                    $r->bind('[{var1}]', function() {});
641 641
                 });
642 642
 
643 643
             });
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 
651 651
             });
652 652
 
653
-            it("throws an exception when the prefix does not match", function () {
653
+            it("throws an exception when the prefix does not match", function() {
654 654
 
655
-                $closure = function () {
655
+                $closure = function() {
656 656
                     $r = $this->router;
657 657
                     $route = $r->route('bar/foo', 'GET');
658 658
                 };
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                 $r = $this->router;
669 669
                 $r->group('foo', ['host' => 'foo.{domain}.bar'], function($r) {
670 670
                     $r->group('bar', function($r) {
671
-                        $r->bind('{var1}', function () {});
671
+                        $r->bind('{var1}', function() {});
672 672
                     });
673 673
                 });
674 674
 
@@ -685,9 +685,9 @@  discard block
 block discarded – undo
685 685
 
686 686
             });
687 687
 
688
-            it("throws an exception when the host does not match", function () {
688
+            it("throws an exception when the host does not match", function() {
689 689
 
690
-                $closure = function () {
690
+                $closure = function() {
691 691
                     $r = $this->router;
692 692
                     $route = $r->route('http://bar.hello.foo/foo/bar/baz', 'GET');
693 693
                 };
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
                 $r = $this->router;
704 704
                 $r->group('foo', ['scheme' => 'http'], function($r) {
705 705
                     $r->group('bar', function($r) {
706
-                        $r->bind('{var1}', function () {});
706
+                        $r->bind('{var1}', function() {});
707 707
                     });
708 708
                 });
709 709
 
@@ -719,9 +719,9 @@  discard block
 block discarded – undo
719 719
 
720 720
             });
721 721
 
722
-            it("throws an exception when route is not found", function () {
722
+            it("throws an exception when route is not found", function() {
723 723
 
724
-                $closure = function () {
724
+                $closure = function() {
725 725
                     $r = $this->router;
726 726
                     $route = $r->route('https://domain.com/foo/bar/baz', 'GET');
727 727
                 };
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
             $r = $this->router;
736 736
             $r->group('foo', ['namespace' => 'My'], function($r) {
737 737
                 $r->group('bar', ['namespace' => 'Name'], function($r) {
738
-                    $r->bind('{var1}', ['namespace' => 'Space'], function () {});
738
+                    $r->bind('{var1}', ['namespace' => 'Space'], function() {});
739 739
                 });
740 740
             });
741 741
 
@@ -764,10 +764,10 @@  discard block
 block discarded – undo
764 764
             $r = $this->router;
765 765
 
766 766
             $mw1 = function($request, $response, $next) {
767
-                return '1' . $next() . '1';
767
+                return '1'.$next().'1';
768 768
             };
769 769
             $mw2 = function($request, $response, $next) {
770
-                return '2' . $next() . '2';
770
+                return '2'.$next().'2';
771 771
             };
772 772
 
773 773
             $r->apply($mw1, $mw2);
@@ -794,9 +794,9 @@  discard block
 block discarded – undo
794 794
             $r = $this->router;
795 795
 
796 796
             $r->apply(function($request, $response, $next) {
797
-                return '1' . $next() . '1';
797
+                return '1'.$next().'1';
798 798
             })->apply(function($request, $response, $next) {
799
-                return '2' . $next() . '2';
799
+                return '2'.$next().'2';
800 800
             });
801 801
 
802 802
             $route = $r->bind('/foo/bar', function($route) {
@@ -815,19 +815,19 @@  discard block
 block discarded – undo
815 815
             $r = $this->router;
816 816
 
817 817
             $r->apply(function($request, $response, $next) {
818
-                return '1' . $next() . '1';
818
+                return '1'.$next().'1';
819 819
             });
820 820
 
821
-            $r->bind('foo/{foo}', ['name' => 'foo'], function () {
821
+            $r->bind('foo/{foo}', ['name' => 'foo'], function() {
822 822
                 return 'A';
823 823
             });
824 824
 
825 825
             $r->group('bar', function($r) {
826
-                $r->bind('{bar}', ['name' => 'bar'], function () {
826
+                $r->bind('{bar}', ['name' => 'bar'], function() {
827 827
                     return 'A';
828 828
                 });
829 829
             })->apply(function($request, $response, $next) {
830
-                return '2' . $next() . '2';
830
+                return '2'.$next().'2';
831 831
             });
832 832
 
833 833
             $route = $r->route('foo/foo');
Please login to merge, or discard this patch.