@@ -53,7 +53,7 @@ private function getCleanRoutes(): RouteCollection
53
53
54
54
public function testRoutesCommand ()
55
55
{
56
- $ this -> getCleanRoutes ( );
56
+ Services:: injectMock ( ' routes ' , null );
57
57
58
58
command ('routes ' );
59
59
@@ -79,7 +79,7 @@ public function testRoutesCommand()
79
79
80
80
public function testRoutesCommandSortByHandler ()
81
81
{
82
- $ this -> getCleanRoutes ( );
82
+ Services:: injectMock ( ' routes ' , null );
83
83
84
84
command ('routes -h ' );
85
85
@@ -103,6 +103,62 @@ public function testRoutesCommandSortByHandler()
103
103
$ this ->assertStringContainsString ($ expected , $ this ->getBuffer ());
104
104
}
105
105
106
+ public function testRoutesCommandHostHostname ()
107
+ {
108
+ Services::injectMock ('routes ' , null );
109
+
110
+ command ('routes --host blog.example.com ' );
111
+
112
+ $ expected = <<<'EOL'
113
+ Host: blog.example.com
114
+ +---------+---------+---------------+----------------------------------------+----------------+---------------+
115
+ | Method | Route | Name | Handler | Before Filters | After Filters |
116
+ +---------+---------+---------------+----------------------------------------+----------------+---------------+
117
+ | GET | / | » | \App\Controllers\Blog::index | | toolbar |
118
+ | GET | closure | » | (Closure) | | toolbar |
119
+ | GET | all | » | \App\Controllers\AllDomain::index | | toolbar |
120
+ | GET | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
121
+ | HEAD | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
122
+ | POST | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
123
+ | PUT | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
124
+ | DELETE | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
125
+ | OPTIONS | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
126
+ | TRACE | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
127
+ | CONNECT | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
128
+ | CLI | testing | testing-index | \App\Controllers\TestController::index | | |
129
+ +---------+---------+---------------+----------------------------------------+----------------+---------------+
130
+ EOL;
131
+ $ this ->assertStringContainsString ($ expected , $ this ->getBuffer ());
132
+ }
133
+
134
+ public function testRoutesCommandHostSubdomain ()
135
+ {
136
+ Services::injectMock ('routes ' , null );
137
+
138
+ command ('routes --host sub.example.com ' );
139
+
140
+ $ expected = <<<'EOL'
141
+ Host: sub.example.com
142
+ +---------+---------+---------------+----------------------------------------+----------------+---------------+
143
+ | Method | Route | Name | Handler | Before Filters | After Filters |
144
+ +---------+---------+---------------+----------------------------------------+----------------+---------------+
145
+ | GET | / | » | \App\Controllers\Sub::index | | toolbar |
146
+ | GET | closure | » | (Closure) | | toolbar |
147
+ | GET | all | » | \App\Controllers\AllDomain::index | | toolbar |
148
+ | GET | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
149
+ | HEAD | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
150
+ | POST | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
151
+ | PUT | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
152
+ | DELETE | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
153
+ | OPTIONS | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
154
+ | TRACE | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
155
+ | CONNECT | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
156
+ | CLI | testing | testing-index | \App\Controllers\TestController::index | | |
157
+ +---------+---------+---------------+----------------------------------------+----------------+---------------+
158
+ EOL;
159
+ $ this ->assertStringContainsString ($ expected , $ this ->getBuffer ());
160
+ }
161
+
106
162
public function testRoutesCommandAutoRouteImproved ()
107
163
{
108
164
$ routes = $ this ->getCleanRoutes ();
@@ -139,6 +195,7 @@ public function testRoutesCommandAutoRouteImproved()
139
195
public function testRoutesCommandRouteLegacy ()
140
196
{
141
197
$ routes = $ this ->getCleanRoutes ();
198
+ $ routes ->loadRoutes ();
142
199
143
200
$ routes ->setAutoRoute (true );
144
201
$ namespace = 'Tests\Support\Controllers ' ;
0 commit comments