]> git.andy128k.dev Git - routeexpression.git/commitdiff
php 5.3 friendly
authorAndrey Kutejko <andy128k@gmail.com>
Fri, 2 Aug 2013 19:17:24 +0000 (22:17 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Fri, 2 Aug 2013 19:17:54 +0000 (22:17 +0300)
t/ExpressionTest.php

index c63470852e0ccefc50e9ec22b74e35038bce5ccb..ca9f086df2e66889c51ca97a8dd9a797f0af0a09 100644 (file)
@@ -20,7 +20,8 @@ class RouteExpressionTest extends PHPUnit_Framework_TestCase
 
     public function testOptional()
     {
-        $e = (new RouteExpression)->optional('/ru')->just('/story/');
+        $re = new RouteExpression;
+        $e = $re->optional('/ru')->just('/story/');
         $this->assertNotMatch($e, '/story');
         $this->assertMatch($e, '/story/', array(''));
         $this->assertNotMatch($e, '/en/story/');
@@ -30,7 +31,8 @@ class RouteExpressionTest extends PHPUnit_Framework_TestCase
 
     public function testOptionalAndSlug()
     {
-        $e = (new RouteExpression)->just('/')->optional('ru/')->just('story/')->slug()->just('/');
+        $re = new RouteExpression;
+        $e = $re->just('/')->optional('ru/')->just('story/')->slug()->just('/');
         $this->assertNotMatch($e, '/story/wrghsh');
         $this->assertMatch($e, '/story/srghwrghew/', array('', 'srghwrghew'));
         $this->assertNotMatch($e, '/en/story/wgwrgewrghwrgh/');
@@ -40,7 +42,8 @@ class RouteExpressionTest extends PHPUnit_Framework_TestCase
 
     public function testOptionalAndId()
     {
-        $e = (new RouteExpression)->just('/')->optional('ru/')->just('story/')->id()->just('/');
+        $re = new RouteExpression;
+        $e = $re->just('/')->optional('ru/')->just('story/')->id()->just('/');
         $this->assertNotMatch($e, '/story/23');
         $this->assertMatch($e, '/story/354/', array('', 354));
         $this->assertMatch($e, '/ru/story/44/', array('ru/', 44));
@@ -49,7 +52,8 @@ class RouteExpressionTest extends PHPUnit_Framework_TestCase
 
     public function testOneOf()
     {
-        $e = (new RouteExpression)->oneOf('/ru', '/en')->just('/story/');
+        $re = new RouteExpression;
+        $e = $re->oneOf('/ru', '/en')->just('/story/');
         $this->assertNotMatch($e, '/story/');
         $this->assertMatch($e, '/ru/story/', array('/ru'));
         $this->assertMatch($e, '/en/story/', array('/en'));
@@ -58,7 +62,8 @@ class RouteExpressionTest extends PHPUnit_Framework_TestCase
 
     public function testOneOfWithEmptyCase()
     {
-        $e = (new RouteExpression)->oneOf('/ru', '/en', '')->just('/story/');
+        $re = new RouteExpression;
+        $e = $re->oneOf('/ru', '/en', '')->just('/story/');
         $this->assertMatch($e, '/story/', array(''));
         $this->assertMatch($e, '/ru/story/', array('/ru'));
         $this->assertMatch($e, '/en/story/', array('/en'));