-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from bearsunday/tests
more test coverage
- Loading branch information
Showing
17 changed files
with
230 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ composer.lock | |
vendor | ||
build | ||
preload.php | ||
|
||
tests/stdout.log |
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,15 @@ | ||
<?php | ||
|
||
namespace BEAR\Package\Context; | ||
|
||
use BEAR\Sunday\Annotation\DefaultSchemeHost; | ||
use Ray\Di\Injector; | ||
|
||
class ApiModuleTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testModule() | ||
{ | ||
$scheme = (new Injector(new ApiModule))->getInstance('', DefaultSchemeHost::class); | ||
$this->assertSame('app://self', $scheme); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
namespace BEAR\Package\Context; | ||
|
||
use BEAR\Package\Provide\Representation\HalRenderer; | ||
use BEAR\Package\Provide\Router\WebRouterModule; | ||
use BEAR\Resource\RenderInterface; | ||
use BEAR\Sunday\Module\Annotation\DoctrineAnnotationModule; | ||
use BEAR\Sunday\Provide\Router\RouterModule; | ||
use Ray\Di\Injector; | ||
|
||
class HalModuleTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testModule() | ||
{ | ||
$renderer = (new Injector(new HalModule(new RouterModule(new DoctrineAnnotationModule))))->getInstance(RenderInterface::class); | ||
$this->assertInstanceOf(HalRenderer::class, $renderer); | ||
} | ||
} |
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,36 @@ | ||
<?php | ||
|
||
namespace Provide\Router; | ||
|
||
use Aura\Router\RouterFactory; | ||
use BEAR\Package\Provide\Router\AuraRouter; | ||
use BEAR\Package\Provide\Router\HttpMethodParams; | ||
use BEAR\Package\Provide\Router\RouterCollection; | ||
use BEAR\Sunday\Provide\Router\WebRouter; | ||
|
||
class RouterCollectionTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testMatch() | ||
{ | ||
$routerAdapter = (new RouterFactory)->newInstance(); | ||
$auraRouter = new AuraRouter($routerAdapter, 'page://self', new HttpMethodParams); | ||
$webRouter = new WebRouter('page://self', new HttpMethodParams); | ||
$routerCollection = new RouterCollection([$auraRouter, $webRouter]); | ||
$routerAdapter | ||
->addPost(null, '/blog/{id}') | ||
->addValues(['path' => '/blog']); | ||
$globals = [ | ||
'_POST' => ['title' => 'hello'] | ||
]; | ||
$server = [ | ||
'REQUEST_METHOD' => 'POST', | ||
'REQUEST_URI' => 'http://localhost/blog/PC6001?query=value#fragment' | ||
]; | ||
|
||
$request = $routerCollection->match($globals, $server); | ||
$this->assertSame('post', $request->method); | ||
$this->assertSame('page://self/blog', $request->path); | ||
$this->assertSame(['id' => 'PC6001', 'title' => 'hello'], $request->query); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
{"name": "BEAR.Sunday v1.0", "age": 0} |
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 @@ | ||
name=kuma |
Oops, something went wrong.