generated from yiisoft/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into add-rector
- Loading branch information
Showing
9 changed files
with
168 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
on: | ||
pull_request: | ||
push: | ||
- pull_request | ||
- push | ||
|
||
name: backwards compatibility | ||
|
||
jobs: | ||
roave_bc_check: | ||
name: Roave BC Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: fetch tags | ||
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
- name: Roave BC Check | ||
uses: docker://nyholm/roave-bc-check-ga | ||
roave_bc_check: | ||
uses: yiisoft/actions/.github/workflows/bc.yml@master | ||
with: | ||
os: >- | ||
['ubuntu-latest'] | ||
php: >- | ||
['8.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
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
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
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,55 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Csrf\Tests; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Yiisoft\Csrf\CsrfTokenInterface; | ||
use Yiisoft\Csrf\Hmac\HmacCsrfToken; | ||
use Yiisoft\Csrf\MaskedCsrfToken; | ||
use Yiisoft\Csrf\Synchronizer\SynchronizerCsrfToken; | ||
use Yiisoft\Di\Container; | ||
use Yiisoft\Di\ContainerConfig; | ||
use Yiisoft\Session\NullSession; | ||
use Yiisoft\Session\SessionInterface; | ||
|
||
final class ConfigTest extends TestCase | ||
{ | ||
public function testBase(): void | ||
{ | ||
$container = $this->createContainer(); | ||
|
||
$csrfToken = $container->get(CsrfTokenInterface::class); | ||
$synchronizerCsrfToken = $container->get(SynchronizerCsrfToken::class); | ||
$hmacCsrfToken = $container->get(HmacCsrfToken::class); | ||
|
||
$this->assertInstanceOf(MaskedCsrfToken::class, $csrfToken); | ||
$this->assertInstanceOf(SynchronizerCsrfToken::class, $synchronizerCsrfToken); | ||
$this->assertInstanceOf(HmacCsrfToken::class, $hmacCsrfToken); | ||
} | ||
|
||
private function createContainer(?array $params = null): Container | ||
{ | ||
return new Container( | ||
ContainerConfig::create()->withDefinitions( | ||
$this->getDiConfig($params) | ||
+ | ||
[SessionInterface::class => NullSession::class] | ||
) | ||
); | ||
} | ||
|
||
private function getDiConfig(?array $params = null): array | ||
{ | ||
if ($params === null) { | ||
$params = $this->getParams(); | ||
} | ||
return require dirname(__DIR__) . '/config/di-web.php'; | ||
} | ||
|
||
private function getParams(): array | ||
{ | ||
return require dirname(__DIR__) . '/config/params.php'; | ||
} | ||
} |