-
-
Notifications
You must be signed in to change notification settings - Fork 89
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 #1149: Container scope fixes
- Loading branch information
Showing
22 changed files
with
283 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spiral\Framework; | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
if (!\enum_exists(Spiral::class)) { | ||
enum Spiral: string { | ||
case HttpRequest = 'http-request'; | ||
} | ||
} |
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
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 Spiral\Tests\Router; | ||
|
||
use Spiral\Bootloader\Http\RouterBootloader; | ||
use Spiral\Nyholm\Bootloader\NyholmBootloader; | ||
use Spiral\Router\Route; | ||
use Spiral\Router\RouterInterface; | ||
use Spiral\Router\Target\Group; | ||
use Spiral\Testing\Attribute\TestScope; | ||
use Spiral\Tests\Router\Fixtures\TestController; | ||
use Spiral\Tests\Router\Stub\IdentityScopedMiddleware; | ||
|
||
class ContainerScopeTest extends \Spiral\Testing\TestCase | ||
{ | ||
public function defineBootloaders(): array | ||
{ | ||
return [ | ||
RouterBootloader::class, | ||
NyholmBootloader::class, | ||
]; | ||
} | ||
|
||
#[TestScope('http')] | ||
public function testRunOpenScopeSameTwice(): void | ||
{ | ||
$router = $this->getRouter(); | ||
|
||
$router->setRoute( | ||
'group', | ||
(new Route('/<controller>[/<action>[/<id>]]', new Group([ | ||
'test' => TestController::class, | ||
])))->withMiddleware(IdentityScopedMiddleware::class), | ||
); | ||
|
||
$this->fakeHttp()->get('/test/scopes')->assertBodySame('http-request, idenity, http, root'); | ||
$this->fakeHttp()->get('/test/scopes')->assertBodySame('http-request, idenity, http, root'); | ||
} | ||
|
||
private function getRouter(): RouterInterface | ||
{ | ||
return $this->getContainer()->get(RouterInterface::class); | ||
} | ||
} |
Oops, something went wrong.