-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename Resource to Provider, add more tests
- Loading branch information
Showing
12 changed files
with
115 additions
and
52 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
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,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Router\Tests\Provider; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Yiisoft\Router\Provider\FileRoutesProvider; | ||
|
||
use const _PHPStan_4dd92cd93\__; | ||
|
||
class FileResourceTest extends TestCase | ||
{ | ||
private array $routes = []; | ||
private string $file = __DIR__ . '/../Support/resources/routes.php'; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->routes = require $this->file; | ||
} | ||
|
||
public function testGetRoutes(): void | ||
{ | ||
$provider = new FileRoutesProvider($this->file); | ||
|
||
$this->assertEquals($this->routes, $provider->getRoutes()); | ||
} | ||
|
||
public function testGetRoutesWithNotExistFile(): void | ||
{ | ||
$file = __DIR__ . '/foo.php'; | ||
$this->expectException(\RuntimeException::class); | ||
$this->expectExceptionMessage('Failed to provide routes from "' . $file . '". File or directory not found.'); | ||
|
||
$provider = new FileRoutesProvider($file); | ||
$provider->getRoutes(); | ||
} | ||
|
||
public function testGetRoutesInDirectory(): void | ||
{ | ||
$provider = new FileRoutesProvider(dirname($this->file)); | ||
|
||
$this->assertEquals($this->routes, $provider->getRoutes()); | ||
} | ||
} |
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
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,8 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Yiisoft\Router\Group; | ||
use Yiisoft\Router\Route; | ||
|
||
return 'test'; |