-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
24 changed files
with
376 additions
and
246 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 |
---|---|---|
|
@@ -21,3 +21,4 @@ autoload.php | |
/.phpcs.xml | ||
/.phpcs-cache | ||
/vendor-bin/tools/vendor/ | ||
/var/db/todo.sqlite3 |
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
18 changes: 18 additions & 0 deletions
18
src/Infrastructure/Authentication/FakeIdentityRepository.php
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,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Cw\LearnBear\Infrastructure\Authentication; | ||
|
||
use Cw\LearnBear\AppSpi\IdentityRepositoryInterface; | ||
|
||
class FakeIdentityRepository implements IdentityRepositoryInterface | ||
{ | ||
/** | ||
* 照合結果が必ず「照合成功」を示すようにメソッドを設定 | ||
*/ | ||
public function findByUserNameAndPassword(string $username, string $password): ?string | ||
{ | ||
return 'pass_unconditionally'; | ||
} | ||
} |
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,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Cw\LearnBear\Infrastructure\Authentication; | ||
|
||
use Cw\LearnBear\AppSpi\SessionHandlerInterface; | ||
|
||
class FakeSession implements SessionHandlerInterface | ||
{ | ||
private ?string $message = null; | ||
|
||
public function setAuth(string $uuid): void | ||
{ | ||
$this->message = $uuid; // これはただのダミー処理。なんなら何もしなくても構わない。 | ||
} | ||
|
||
public function isNotAuthorized(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function clearAuth(): void | ||
{ | ||
} | ||
|
||
public function setFlashMessage(string $message, string $key): void | ||
{ | ||
$this->message = empty($key) | ||
? SessionHandlerInterface::DUMMY_MESSAGE | ||
: $message; | ||
} | ||
|
||
public function getFlashMessage(string $key): ?string | ||
{ | ||
return $this->message ?? SessionHandlerInterface::DUMMY_MESSAGE; | ||
} | ||
|
||
public function destroy(): void | ||
{ | ||
} | ||
} |
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,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Cw\LearnBear\Module; | ||
|
||
use BEAR\Resource\JsonRenderer; | ||
use BEAR\Resource\RenderInterface; | ||
use Cw\LearnBear\AppSpi\IdentityRepositoryInterface; | ||
use Cw\LearnBear\AppSpi\SessionHandlerInterface; | ||
use Cw\LearnBear\Infrastructure\Authentication\FakeIdentityRepository; | ||
use Cw\LearnBear\Infrastructure\Authentication\FakeSession; | ||
use Ray\Di\AbstractModule; | ||
|
||
class AppFakeBinderModule extends AbstractModule | ||
{ | ||
protected function configure(): void | ||
{ | ||
// appコンテキストにおいては、Pageリソースの TwigErrorPageModule への依存を標準レンダラーでフェイクする | ||
$this->bind(RenderInterface::class)->annotatedWith('error_page')->to(JsonRenderer::class); | ||
|
||
// appコンテキストにおいては、Pageリソースが「認証機能を備えていない」のと同じ振る舞いをするように、下記2つをフェイクで置き換える | ||
$this->bind(SessionHandlerInterface::class)->to(FakeSession::class); | ||
$this->bind(IdentityRepositoryInterface::class)->to(FakeIdentityRepository::class); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Cw\LearnBear\Module; | ||
|
||
use Cw\LearnBear\Infrastructure\Form\TodoForm; | ||
use Ray\Di\AbstractModule; | ||
use Ray\WebFormModule\FormInterface; | ||
|
||
class FormModule extends AbstractModule | ||
{ | ||
protected function configure(): void | ||
{ | ||
$this->bind(TodoForm::class); | ||
$this->bind(FormInterface::class)->annotatedWith('todo_form')->to(TodoForm::class); | ||
} | ||
} |
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
Oops, something went wrong.