diff --git a/app/Check/Consumers/Client/Conf/AllowRedirects.php b/app/Check/Consumers/Client/Conf/AllowRedirects.php new file mode 100644 index 0000000..f428551 --- /dev/null +++ b/app/Check/Consumers/Client/Conf/AllowRedirects.php @@ -0,0 +1,33 @@ +isAllowed = $isAllowed; + } + + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'allow_redirects' => $this->isAllowed, + ]; + } + + + public static function create(bool $isAllowed): self + { + return new self($isAllowed); + } + +} diff --git a/app/Check/Consumers/Client/Conf/AllowRedirectsArray.php b/app/Check/Consumers/Client/Conf/AllowRedirectsArray.php new file mode 100644 index 0000000..f277e9f --- /dev/null +++ b/app/Check/Consumers/Client/Conf/AllowRedirectsArray.php @@ -0,0 +1,33 @@ + + */ + private array $conf; + + + /** + * @param array $conf + */ + public function __construct(array $conf) + { + $this->conf = $conf; + } + + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'allow_redirects' => $this->conf, + ]; + } + +} diff --git a/app/Check/Consumers/Client/Conf/AllowRedirectsInterface.php b/app/Check/Consumers/Client/Conf/AllowRedirectsInterface.php new file mode 100644 index 0000000..03a2783 --- /dev/null +++ b/app/Check/Consumers/Client/Conf/AllowRedirectsInterface.php @@ -0,0 +1,13 @@ + + */ + public function toArray(): array; + +} diff --git a/tests/phpunit/Check/Consumers/Client/Conf/AllowRedirectsArrayTest.php b/tests/phpunit/Check/Consumers/Client/Conf/AllowRedirectsArrayTest.php new file mode 100644 index 0000000..0cccb50 --- /dev/null +++ b/tests/phpunit/Check/Consumers/Client/Conf/AllowRedirectsArrayTest.php @@ -0,0 +1,35 @@ +assertSame([ + 'allow_redirects' => $conf, + ], $allowRedirects->toArray()); + } + + + public function dataProvider(): array + { + return [ + [ + 'conf' => [ + 'max' => 10, + 'strict' => true, + 'referer' => true, + 'protocols' => ['https'], + 'track_redirects' => true + ], + ], + ]; + } + +} diff --git a/tests/phpunit/Check/Consumers/Client/Conf/AllowRedirectsTest.php b/tests/phpunit/Check/Consumers/Client/Conf/AllowRedirectsTest.php new file mode 100644 index 0000000..3e4dcb5 --- /dev/null +++ b/tests/phpunit/Check/Consumers/Client/Conf/AllowRedirectsTest.php @@ -0,0 +1,32 @@ +assertSame([ + 'allow_redirects' => $isAllowed, + ], $allowRedirects->toArray()); + } + + + public function dataProvider(): array + { + return [ + [ + 'isAllowed' => TRUE, + ], + [ + 'isAllowed' => FALSE, + ], + ]; + } + +}