From 6b0ae53eeebb78aa56ae409c54bb8c46be7b28a7 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 8222f4f..62f4f39 100644 --- a/src/Control/SAMLController.php +++ b/src/Control/SAMLController.php @@ -348,6 +348,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); + } +}