Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3dd7553

Browse files
Merge branch 'tests-internal-domains' into codeception-2.1
2 parents 341aa19 + 0687148 commit 3dd7553

File tree

3 files changed

+75
-3
lines changed

3 files changed

+75
-3
lines changed

‎app/Http/Controllers/HomeController.php‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,36 @@ public function validation(Request $request)
109109
return 'Validation success';
110110
}
111111

112+
/**
113+
* @return string
114+
*/
115+
public function domain()
116+
{
117+
return 'Domain route';
118+
}
119+
120+
/**
121+
* @return string
122+
*/
123+
public function subdomain()
124+
{
125+
return 'Subdomain route';
126+
}
127+
128+
/**
129+
* @return string
130+
*/
131+
public function wildcard()
132+
{
133+
return 'Wildcard route';
134+
}
135+
136+
/**
137+
* @return string
138+
*/
139+
public function multipleWildcards()
140+
{
141+
return 'Multiple wildcards route';
142+
}
143+
112144
}

‎app/Http/routes.php‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
|
1212
*/
1313

14+
Route::get('', ['domain' => 'example.com', 'as' => 'domain', 'uses' => 'HomeController@domain']);
15+
Route::get('', ['domain' => 'subdomain.example.com', 'as' => 'subdomain', 'uses' => 'HomeController@subdomain']);
16+
Route::get('', ['domain' => '{w}.example.com', 'as' => 'wildcard', 'uses' => 'HomeController@wildcard']);
17+
Route::get('', ['domain' => '{w1}.{w2}.example.com', 'as' => 'multiple-wildcards', 'uses' => 'HomeController@multipleWildcards']);
18+
1419
Route::get('', ['as' => 'homepage', 'uses' => 'HomeController@index']);
1520
Route::get('flash', 'HomeController@flash');
1621
Route::get('back', 'HomeController@back');
@@ -31,6 +36,3 @@
3136
'password' => 'Auth\PasswordController',
3237
]);
3338

34-
Route::get('domain-route', ['domain' => 'example.com', 'as' => 'domain', 'uses' => function() {
35-
return 'Domain route';
36-
}]);
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
class InternalDomainsCest
4+
{
5+
6+
public function testExternalDomainThrowsException(FunctionalTester $I)
7+
{
8+
try {
9+
$I->amOnPage('https://www.google.com');
10+
$I->fail('Visiting an external URL should throw an ExternalUrlException');
11+
} catch (\Codeception\Exception\ExternalUrlException $ignored) {}
12+
}
13+
14+
public function testWithDomain(FunctionalTester $I)
15+
{
16+
$I->amOnPage('http://example.com');
17+
$I->see('Domain route');
18+
}
19+
20+
public function testWithSubdomain(FunctionalTester $I)
21+
{
22+
$I->amOnPage('http://subdomain.example.com');
23+
$I->see('Subdomain route');
24+
}
25+
26+
public function testWithWildcardInDomain(FunctionalTester $I)
27+
{
28+
$I->amOnPage('http://wildcard.example.com');
29+
$I->see('Wildcard route');
30+
}
31+
32+
public function testWithMultipleWildcardsInDomain(FunctionalTester $I)
33+
{
34+
$I->amOnPage('http://wild.card.example.com');
35+
$I->see('Multiple wildcards route');
36+
}
37+
38+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /