From 3f211b529a73cd8a3a15e4cfe5849adcf399da9a Mon Sep 17 00:00:00 2001 From: Bernie Hamlin Date: Tue, 13 Feb 2024 09:47:21 +1300 Subject: [PATCH] Don't use singleton for getForm When using Injector to create a singleton constructor arguments are ignored. This causes getForm to fail as SAMLLoginForm requires constructor arguments. --- src/Control/SAMLController.php | 2 +- tests/php/Control/SAMLControllerTest.php | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/php/Control/SAMLControllerTest.php diff --git a/src/Control/SAMLController.php b/src/Control/SAMLController.php index 77153c2..e6312a8 100644 --- a/src/Control/SAMLController.php +++ b/src/Control/SAMLController.php @@ -354,6 +354,6 @@ public function getLogger() */ public function getForm() { - return Injector::inst()->get(SAMLLoginForm::class, true, [$this, SAMLAuthenticator::class, 'LoginForm']); + return Injector::inst()->get(SAMLLoginForm::class, false, [$this, SAMLAuthenticator::class, 'LoginForm']); } } diff --git a/tests/php/Control/SAMLControllerTest.php b/tests/php/Control/SAMLControllerTest.php new file mode 100644 index 0000000..cbe879d --- /dev/null +++ b/tests/php/Control/SAMLControllerTest.php @@ -0,0 +1,18 @@ +getForm(); + + $this->assertNotNull($form); + } +}