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/');
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/');
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));
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'));
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'));