@@ -17,11 +17,12 @@ class RouteTest extends \PHPUnit_Framework_TestCase
17
17
{
18
18
public function testConstructor ()
19
19
{
20
- $ route = new Route ('/{foo} ' , array ('foo ' => 'bar ' ), array ('foo ' => '\d+ ' ), array ('foo ' => 'bar ' ));
20
+ $ route = new Route ('/{foo} ' , array ('foo ' => 'bar ' ), array ('foo ' => '\d+ ' ), array ('foo ' => 'bar ' ), ' {locale}.example.com ' );
21
21
$ this ->assertEquals ('/{foo} ' , $ route ->getPattern (), '__construct() takes a pattern as its first argument ' );
22
22
$ this ->assertEquals (array ('foo ' => 'bar ' ), $ route ->getDefaults (), '__construct() takes defaults as its second argument ' );
23
23
$ this ->assertEquals (array ('foo ' => '\d+ ' ), $ route ->getRequirements (), '__construct() takes requirements as its third argument ' );
24
24
$ this ->assertEquals ('bar ' , $ route ->getOption ('foo ' ), '__construct() takes options as its fourth argument ' );
25
+ $ this ->assertEquals ('{locale}.example.com ' , $ route ->getHostnamePattern (), '__construct() takes a hostname pattern as its fifth argument ' );
25
26
}
26
27
27
28
public function testPattern ()
@@ -121,6 +122,13 @@ public function getInvalidRequirements()
121
122
);
122
123
}
123
124
125
+ public function testHostnamePattern ()
126
+ {
127
+ $ route = new Route ('/ ' );
128
+ $ route ->setHostnamePattern ('{locale}.example.net ' );
129
+ $ this ->assertEquals ('{locale}.example.net ' , $ route ->getHostnamePattern (), '->setHostnamePattern() sets the hostname pattern ' );
130
+ }
131
+
124
132
public function testCompile ()
125
133
{
126
134
$ route = new Route ('/{foo} ' );
0 commit comments