-
Notifications
You must be signed in to change notification settings - Fork 3
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
Marko Kallio
committed
Jan 6, 2016
1 parent
1545f14
commit 1b9fd5d
Showing
10 changed files
with
97 additions
and
19 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,48 @@ | ||
<?php | ||
|
||
namespace makallio85\YamlRoute\Test; | ||
|
||
use makallio85\YamlRoute\Validator; | ||
|
||
/** | ||
* Class ValidatorTest | ||
* | ||
* @package makallio85\YamlRoute\Test | ||
*/ | ||
class ValidatorTest extends YamlRouteTest | ||
{ | ||
/** | ||
* @expectedException \makallio85\YamlRoute\Exception\ValidatorException | ||
*/ | ||
public function testEmptyRoute() | ||
{ | ||
Validator::run(['file' => 'foo.bar']); | ||
} | ||
|
||
/** | ||
* @expectedException \makallio85\YamlRoute\Exception\ValidatorException | ||
*/ | ||
public function testRoutePathMissing() | ||
{ | ||
$Validator = new Validator(); | ||
$this->_invokeMethod($Validator, '_checkRoute', ['foo', ['bar'], false]); | ||
} | ||
|
||
/** | ||
* @expectedException \makallio85\YamlRoute\Exception\ValidatorException | ||
*/ | ||
public function testActionPresentButControllerNot() | ||
{ | ||
$Validator = new Validator(); | ||
$this->_invokeMethod($Validator, '_checkRoute', ['foo', ['path' => 'bar', 'config' => ['action' => 'fizz']], false]); | ||
} | ||
|
||
/** | ||
* @expectedException \makallio85\YamlRoute\Exception\ValidatorException | ||
*/ | ||
public function testRouteConfigMissing() | ||
{ | ||
$Validator = new Validator(); | ||
$this->_invokeMethod($Validator, '_checkRoute', ['foo', ['path' => 'bar'], false]); | ||
} | ||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace makallio85\YamlRoute\Test; | ||
|
||
class YamlRouteTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Call protected/private method of a class. | ||
* | ||
* @param object &$object Instantiated object that we will run method on. | ||
* @param string $methodName Method name to call | ||
* @param array $parameters Array of parameters to pass into method. | ||
* | ||
* @return mixed Method return. | ||
*/ | ||
protected function _invokeMethod(&$object, $methodName, array $parameters = []) | ||
{ | ||
$reflection = new \ReflectionClass(get_class($object)); | ||
$method = $reflection->getMethod($methodName); | ||
$method->setAccessible(true); | ||
|
||
return $method->invokeArgs($object, $parameters); | ||
} | ||
|
||
public function testInit() {} | ||
} |
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
File renamed without changes.
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 @@ | ||
controller: Fizz |