From: Andrey Kutejko Date: Fri, 2 Aug 2013 19:17:24 +0000 (+0300) Subject: php 5.3 friendly X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=a45a4568c7ca3238977b6c951a54f0c2acd11ab9;p=routeexpression.git php 5.3 friendly --- diff --git a/t/ExpressionTest.php b/t/ExpressionTest.php index c634708..ca9f086 100644 --- a/t/ExpressionTest.php +++ b/t/ExpressionTest.php @@ -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'));