From 1efcc442362ed1326bae5b2e855d986eaefbff52 Mon Sep 17 00:00:00 2001 From: Phillip Davis Date: Fri, 13 Mar 2026 21:18:25 +0930 Subject: [PATCH] test: return the LDAP port number as a string The number is substituted into Behat Gherkin step text, as a textual number. We need to be able to use str_replace() with the LDAP port "number" as the replacement string. In PHP8 the parameters passed to str_replace() must be strings. In user_ldap acceptance tests we are getting: When the administrator sets the LDAP config "LDAPTestId" key "ldapPort" to "%ldap_port%" using the occ command # UserLdapGeneralContext::ldapConfigHasKeySetTo() Type error: str_replace(): Argument #2 ($replace) must be of type array|string, int given (Behat\Testwork\Call\Exception\FatalThrowableError) This change should fix the problem. --- tests/acceptance/features/bootstrap/FeatureContext.php | 6 +++--- tests/acceptance/features/bootstrap/Provisioning.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/features/bootstrap/FeatureContext.php b/tests/acceptance/features/bootstrap/FeatureContext.php index f43dfc75176d..e8cffbda580c 100644 --- a/tests/acceptance/features/bootstrap/FeatureContext.php +++ b/tests/acceptance/features/bootstrap/FeatureContext.php @@ -448,10 +448,10 @@ public function getLdapHostWithoutScheme():string { } /** - * @return integer + * @return string */ - public function getLdapPort():int { - return $this->ldapPort; + public function getLdapPortAsString(): string { + return (string)$this->ldapPort; } /** diff --git a/tests/acceptance/features/bootstrap/Provisioning.php b/tests/acceptance/features/bootstrap/Provisioning.php index 511c5adaa63a..540937fd6f73 100644 --- a/tests/acceptance/features/bootstrap/Provisioning.php +++ b/tests/acceptance/features/bootstrap/Provisioning.php @@ -821,7 +821,7 @@ public function setLdapSetting(string $configId, string $configKey, string $conf "code" => "%ldap_port%", "function" => [ $this, - "getLdapPort" + "getLdapPortAsString" ], "parameter" => [] ]