From c6ac4befcf54b30fbcc2f9b9536af889b4d1d8b7 Mon Sep 17 00:00:00 2001 From: Patrick Radtke <patrick@cirrusidentity.com> Date: Wed, 27 Mar 2019 14:35:49 -0600 Subject: [PATCH] Split TestableAuthorize into seperate file --- .../lib/Auth/Process/AuthorizeTest.php | 13 ------------ .../lib/Auth/Process/TestableAuthorize.php | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 tests/modules/authorize/lib/Auth/Process/TestableAuthorize.php diff --git a/tests/modules/authorize/lib/Auth/Process/AuthorizeTest.php b/tests/modules/authorize/lib/Auth/Process/AuthorizeTest.php index 62b8644bf..38f1342a5 100644 --- a/tests/modules/authorize/lib/Auth/Process/AuthorizeTest.php +++ b/tests/modules/authorize/lib/Auth/Process/AuthorizeTest.php @@ -6,7 +6,6 @@ namespace SimpleSAML\Test\Module\consent\Auth\Process; use PHPUnit\Framework\TestCase; -use SimpleSAML\Module\authorize\Auth\Process\Authorize; use SimpleSAML\Utils\Attributes; class AuthorizeTest extends TestCase @@ -161,15 +160,3 @@ class AuthorizeTest extends TestCase ]; } } -// phpcs:ignore -class TestableAuthorize extends Authorize -{ - /** - * Override the redirect behavior since its difficult to test - * @param array $request the state - */ - protected function unauthorized(&$request) - { - $request['NOT_AUTHORIZED'] = true; - } -} diff --git a/tests/modules/authorize/lib/Auth/Process/TestableAuthorize.php b/tests/modules/authorize/lib/Auth/Process/TestableAuthorize.php new file mode 100644 index 000000000..41562e566 --- /dev/null +++ b/tests/modules/authorize/lib/Auth/Process/TestableAuthorize.php @@ -0,0 +1,20 @@ +<?php +/** + * Subclass authorize filter to make it unit testable. + */ + +namespace SimpleSAML\Test\Module\consent\Auth\Process; + +use SimpleSAML\Module\authorize\Auth\Process\Authorize; + +class TestableAuthorize extends Authorize +{ + /** + * Override the redirect behavior since its difficult to test + * @param array $request the state + */ + protected function unauthorized(&$request) + { + $request['NOT_AUTHORIZED'] = true; + } +} -- GitLab