Skip to content

Commit 4cabf7f

Browse files
committed
fix: corrected build failures on GitHub
1 parent 35ae28b commit 4cabf7f

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

tests/phpMyFAQ/Controller/Administration/Api/LdapControllerTest.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44

55
namespace phpMyFAQ\Controller\Administration\Api;
66

7+
final class LdapControllerTestRuntime
8+
{
9+
public static ?bool $ldapExtensionLoaded = null;
10+
}
11+
12+
function extension_loaded(string $extension): bool
13+
{
14+
if ($extension === 'ldap' && LdapControllerTestRuntime::$ldapExtensionLoaded !== null) {
15+
return LdapControllerTestRuntime::$ldapExtensionLoaded;
16+
}
17+
18+
return \extension_loaded($extension);
19+
}
20+
721
use phpMyFAQ\Configuration;
822
use phpMyFAQ\Core\Exception;
923
use phpMyFAQ\Database;
@@ -38,6 +52,7 @@ final class LdapControllerTest extends TestCase
3852
protected function setUp(): void
3953
{
4054
parent::setUp();
55+
LdapControllerTestRuntime::$ldapExtensionLoaded = null;
4156

4257
Strings::init();
4358

@@ -75,6 +90,8 @@ protected function setUp(): void
7590

7691
protected function tearDown(): void
7792
{
93+
LdapControllerTestRuntime::$ldapExtensionLoaded = null;
94+
7895
$configurationReflection = new \ReflectionClass(Configuration::class);
7996
$configurationProperty = $configurationReflection->getProperty('configuration');
8097
$configurationProperty->setValue(null, $this->previousConfiguration);
@@ -188,9 +205,7 @@ public function testConfigurationStripsPasswords(): void
188205

189206
public function testHealthcheckReturnsUnavailableWhenExtensionMissing(): void
190207
{
191-
if (extension_loaded('ldap')) {
192-
self::markTestSkipped('LDAP extension is loaded; cannot test missing extension path.');
193-
}
208+
LdapControllerTestRuntime::$ldapExtensionLoaded = false;
194209

195210
$controller = $this->createController();
196211
$controller->setContainer($this->createAuthenticatedContainer());

tests/phpMyFAQ/Export/Pdf/WrapperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ public function testCheckBase64ImageWithValidJpegData(): void
448448

449449
public function testImageMethodWithValidPath(): void
450450
{
451-
$fixture = '/Users/thorsten/htdocs/phpMyFAQ/tests/content/user/images/image with spaces.jpg';
451+
$fixture = PMF_CONTENT_DIR . '/user/images/image with spaces.jpg';
452452
$targetFile = PMF_ROOT_DIR . '/content/user/images/wrapper image test.jpg';
453453
try {
454454
self::assertTrue(copy($fixture, $targetFile));

0 commit comments

Comments
 (0)