-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
222 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace Lucid\Mux\Tests\Matcher; | ||
|
||
use Lucid\Mux\Matcher\Context; | ||
use Lucid\Mux\Matcher\ContextInterface; | ||
use Lucid\Mux\Matcher\RequestMatcherInterface as Matcher; | ||
|
||
class ContextTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** @test */ | ||
public function contextWillReturnProperties() | ||
{ | ||
$ctx = new Context(Matcher::MATCH, 'index', '/', 'action', $vars = ['id' => 12]); | ||
$this->assertTrue($ctx->isMatch()); | ||
$this->assertEquals('/', $ctx->getPath()); | ||
$this->assertEquals('index', $ctx->getName()); | ||
$this->assertEquals('action', $ctx->getHandler()); | ||
$this->assertSame($vars, $ctx->getVars()); | ||
} | ||
|
||
/** @test */ | ||
public function itShouldBeInstantiable() | ||
{ | ||
$this->assertInstanceOf('Lucid\Mux\Matcher\ContextInterface', new Context(Matcher::NOMATCH, null, null, null)); | ||
} | ||
|
||
/** @test */ | ||
public function itShouldBeMatchFailure() | ||
{ | ||
$this->assertFalse((new Context(Matcher::NOMATCH, null, null, null))->isMatch()); | ||
} | ||
|
||
/** @test */ | ||
public function itShouldBeMethodFailure() | ||
{ | ||
$this->assertTrue(($ctx = new Context(Matcher::NOMATCH_METHOD, null, null, null))->isMethodMissmatch()); | ||
} | ||
|
||
/** @test */ | ||
public function itShouldBeHostFailure() | ||
{ | ||
$this->assertTrue(($ctx = new Context(Matcher::NOMATCH_HOST, null, null, null))->isHostMissmatch()); | ||
} | ||
|
||
/** @test */ | ||
public function itShouldBeSchemeFailure() | ||
{ | ||
$this->assertTrue(($ctx = new Context(Matcher::NOMATCH_SCHEME, null, null, null))->isSchemeMissmatch()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters