(style): Remove section comment headers from installer tests

This commit is contained in:
Jake Barnby
2026-03-10 19:42:19 +13:00
parent c4c2534f9a
commit d19f14b60f
3 changed files with 0 additions and 107 deletions
@@ -7,7 +7,6 @@ use PHPUnit\Framework\TestCase;
class ConfigTest extends TestCase
{
// --- Constructor ---
public function testDefaultValues(): void
{
@@ -51,8 +50,6 @@ class ConfigTest extends TestCase
$this->assertEquals('80', $config->getDefaultHttpPort());
}
// --- apply ---
public function testApplyAllFields(): void
{
$config = new Config();
@@ -117,8 +114,6 @@ class ConfigTest extends TestCase
$this->assertEquals('updated', $config->getOrganization());
}
// --- toArray ---
public function testToArrayRoundTrip(): void
{
$config = new Config();
@@ -165,8 +160,6 @@ class ConfigTest extends TestCase
$this->assertEquals($original->toArray(), $rebuilt->toArray());
}
// --- Setters and Getters ---
public function testSetAndGetDefaultHttpPort(): void
{
$config = new Config();
@@ -251,8 +244,6 @@ class ConfigTest extends TestCase
$this->assertEquals($vars, $config->getVars());
}
// --- JSON serialization ---
public function testJsonRoundTrip(): void
{
$config = new Config([
@@ -271,8 +262,6 @@ class ConfigTest extends TestCase
$this->assertEquals($config->toArray(), $rebuilt->toArray());
}
// --- Constructor edge cases ---
public function testConstructorWithEmptyArray(): void
{
$config = new Config([]);
@@ -296,8 +285,6 @@ class ConfigTest extends TestCase
$this->assertEmpty($config->getVars());
}
// --- apply edge cases ---
public function testApplyWithEmptyArray(): void
{
$config = new Config(['defaultHttpPort' => '1234']);
@@ -410,8 +397,6 @@ class ConfigTest extends TestCase
$this->assertEquals('3000', $config->getDefaultHttpPort());
}
// --- toArray edge cases ---
public function testToArrayContainsAllExpectedKeys(): void
{
$config = new Config();
@@ -453,8 +438,6 @@ class ConfigTest extends TestCase
$this->assertNull($array['lockedDatabase']);
}
// --- Multiple apply calls ---
public function testMultipleApplyCallsAccumulate(): void
{
$config = new Config();
@@ -482,8 +465,6 @@ class ConfigTest extends TestCase
$this->assertEquals('3333', $config->getDefaultHttpPort());
}
// --- Vars replacement (not merge) ---
public function testSetVarsReplacesNotMerges(): void
{
$config = new Config();
@@ -68,8 +68,6 @@ class StateTest extends TestCase
$this->progressFiles[] = $this->state->progressFilePath($installId);
}
// --- sanitizeInstallId ---
public function testSanitizeInstallIdWithValidId(): void
{
$this->assertEquals('abc123', $this->state->sanitizeInstallId('abc123'));
@@ -102,8 +100,6 @@ class StateTest extends TestCase
$this->assertEquals('', $this->state->sanitizeInstallId(null));
}
// --- hashSensitiveValue ---
public function testHashSensitiveValueProducesConsistentHash(): void
{
$hash1 = $this->state->hashSensitiveValue('secret');
@@ -138,8 +134,6 @@ class StateTest extends TestCase
$this->assertMatchesRegularExpression('/^[a-f0-9]{64}$/', $hash);
}
// --- isValidPort ---
public function testIsValidPortWithValidPorts(): void
{
$this->assertTrue($this->state->isValidPort('1'));
@@ -167,8 +161,6 @@ class StateTest extends TestCase
$this->assertFalse($this->state->isValidPort(0));
}
// --- isValidEmailAddress ---
public function testIsValidEmailAddressWithValidEmails(): void
{
$this->assertTrue($this->state->isValidEmailAddress('user@example.com'));
@@ -184,8 +176,6 @@ class StateTest extends TestCase
$this->assertFalse($this->state->isValidEmailAddress('user@'));
}
// --- isValidPassword ---
public function testIsValidPasswordWithValidPasswords(): void
{
$this->assertTrue($this->state->isValidPassword('12345678'));
@@ -201,8 +191,6 @@ class StateTest extends TestCase
$this->assertFalse($this->state->isValidPassword(' ')); // 8 spaces, no non-whitespace
}
// --- isValidSecretKey ---
public function testIsValidSecretKeyWithValidKeys(): void
{
$this->assertTrue($this->state->isValidSecretKey('a'));
@@ -216,8 +204,6 @@ class StateTest extends TestCase
$this->assertFalse($this->state->isValidSecretKey(str_repeat('x', 65)));
}
// --- isValidAccountName ---
public function testIsValidAccountNameWithValidNames(): void
{
$this->assertTrue($this->state->isValidAccountName('John'));
@@ -230,8 +216,6 @@ class StateTest extends TestCase
$this->assertFalse($this->state->isValidAccountName(' '));
}
// --- isValidAppDomainInput ---
public function testIsValidAppDomainInputWithValidDomains(): void
{
$this->assertTrue($this->state->isValidAppDomainInput('localhost'));
@@ -263,8 +247,6 @@ class StateTest extends TestCase
$this->assertFalse($this->state->isValidAppDomainInput('host:port:extra'));
}
// --- isValidDatabaseAdapter ---
public function testIsValidDatabaseAdapterWithValidAdapters(): void
{
$this->assertTrue($this->state->isValidDatabaseAdapter('mongodb'));
@@ -281,8 +263,6 @@ class StateTest extends TestCase
$this->assertFalse($this->state->isValidDatabaseAdapter('MongoDB')); // case sensitive
}
// --- progressFilePath ---
public function testProgressFilePathFormat(): void
{
$path = $this->state->progressFilePath('test123');
@@ -290,8 +270,6 @@ class StateTest extends TestCase
$this->assertStringStartsWith(sys_get_temp_dir(), $path);
}
// --- readProgressFile / writeProgressFile ---
public function testReadProgressFileReturnsDefaultForMissing(): void
{
$data = $this->state->readProgressFile('nonexistent-id-' . uniqid());
@@ -417,8 +395,6 @@ class StateTest extends TestCase
@unlink($this->state->progressFilePath($installId));
}
// --- buildConfig ---
public function testBuildConfigReturnsConfigInstance(): void
{
// Clear env to avoid interference
@@ -464,8 +440,6 @@ class StateTest extends TestCase
putenv('APPWRITE_INSTALLER_CONFIG');
}
// --- sanitizeInstallId edge cases ---
public function testSanitizeInstallIdWithOnlySpecialChars(): void
{
$this->assertEquals('', $this->state->sanitizeInstallId('!@#$%^&*()'));
@@ -501,8 +475,6 @@ class StateTest extends TestCase
$this->assertEquals('AbCdEf', $this->state->sanitizeInstallId('AbCdEf'));
}
// --- isValidPort edge cases ---
public function testIsValidPortBoundaryValues(): void
{
$this->assertTrue($this->state->isValidPort('1'));
@@ -539,8 +511,6 @@ class StateTest extends TestCase
$this->assertFalse($this->state->isValidPort('100000'));
}
// --- isValidPassword edge cases ---
public function testIsValidPasswordExactly8Chars(): void
{
$this->assertTrue($this->state->isValidPassword('12345678'));
@@ -559,8 +529,6 @@ class StateTest extends TestCase
$this->assertTrue($this->state->isValidPassword(' a ')); // has non-whitespace
}
// --- isValidSecretKey edge cases ---
public function testIsValidSecretKeyExactly64Chars(): void
{
$this->assertTrue($this->state->isValidSecretKey(str_repeat('a', 64)));
@@ -573,8 +541,6 @@ class StateTest extends TestCase
$this->assertTrue($this->state->isValidSecretKey(' '));
}
// --- isValidAppDomainInput edge cases ---
public function testIsValidAppDomainInputWithEmptyPort(): void
{
// "host:" splits to ['host', ''] - empty port with null check
@@ -615,8 +581,6 @@ class StateTest extends TestCase
$this->assertFalse($this->state->isValidAppDomainInput('[::1]:70000'));
}
// --- isValidDatabaseAdapter edge cases ---
public function testIsValidDatabaseAdapterWithWhitespace(): void
{
$this->assertFalse($this->state->isValidDatabaseAdapter(' mongodb'));
@@ -632,8 +596,6 @@ class StateTest extends TestCase
$this->assertFalse($this->state->isValidDatabaseAdapter('MONGODB'));
}
// --- readProgressFile edge cases ---
public function testReadProgressFileWithCorruptedJson(): void
{
$installId = 'test-corrupt-' . uniqid();
@@ -673,8 +635,6 @@ class StateTest extends TestCase
$this->assertEmpty($data['steps']);
}
// --- writeProgressFile edge cases ---
public function testWriteProgressFileOverwritesExistingStep(): void
{
$installId = 'test-overwrite-' . uniqid();
@@ -795,8 +755,6 @@ class StateTest extends TestCase
$this->assertEquals($startedAt, $data['startedAt']);
}
// --- Global lock: reserveGlobalLock / updateGlobalLock ---
public function testReserveGlobalLockFirstLockSucceeds(): void
{
@unlink(Server::INSTALLER_LOCK_FILE);
@@ -912,8 +870,6 @@ class StateTest extends TestCase
$this->assertEquals(Server::STATUS_IN_PROGRESS, $lock['status']);
}
// --- applyEnvConfig ---
public function testApplyEnvConfigWithConfigObject(): void
{
putenv('APPWRITE_INSTALLER_CONFIG');
@@ -966,8 +922,6 @@ class StateTest extends TestCase
$this->assertTrue($rebuilt->isUpgrade());
}
// --- buildConfig edge cases ---
public function testBuildConfigWithInvalidEnvJson(): void
{
putenv('APPWRITE_INSTALLER_CONFIG=not-valid-json');
@@ -1041,8 +995,6 @@ class StateTest extends TestCase
$this->assertEquals('80', $config->getDefaultHttpPort());
}
// --- hashSensitiveValue edge cases ---
public function testHashSensitiveValueWithNewlines(): void
{
// Newlines are not stripped by trim but surrounding whitespace is
@@ -1059,8 +1011,6 @@ class StateTest extends TestCase
$this->assertEquals('', $this->state->hashSensitiveValue("\n"));
}
// --- isValidEmailAddress edge cases ---
public function testIsValidEmailAddressWithUnicodeLocal(): void
{
// PHP's FILTER_VALIDATE_EMAIL does not support internationalized emails
@@ -1078,8 +1028,6 @@ class StateTest extends TestCase
$this->assertFalse($this->state->isValidEmailAddress('user@ example.com'));
}
// --- isValidAccountName edge cases ---
public function testIsValidAccountNameWithOnlyTabs(): void
{
$this->assertFalse($this->state->isValidAccountName("\t\t"));
@@ -1090,8 +1038,6 @@ class StateTest extends TestCase
$this->assertTrue($this->state->isValidAccountName(" a "));
}
// --- progressFilePath edge cases ---
public function testProgressFilePathWithSpecialCharsInId(): void
{
// The ID would normally be sanitized before this call, but the method itself
@@ -1106,8 +1052,6 @@ class StateTest extends TestCase
$this->assertStringContainsString('appwrite-install-.json', $path);
}
// --- writeProgressFile with non-error status doesn't set error key ---
public function testWriteProgressFileCompletedDoesNotSetError(): void
{
$installId = 'test-noerror-' . uniqid();
@@ -1140,8 +1084,6 @@ class StateTest extends TestCase
$this->assertArrayNotHasKey('error', $data);
}
// --- writeProgressFile with no step or empty payload ---
public function testWriteProgressFileWithNoStep(): void
{
$installId = 'test-nostep-' . uniqid();
@@ -1160,8 +1102,6 @@ class StateTest extends TestCase
$this->assertArrayHasKey('updatedAt', $data);
}
// --- Full lifecycle: lock -> progress -> complete ---
public function testFullInstallationLifecycle(): void
{
@unlink(Server::INSTALLER_LOCK_FILE);
@@ -19,8 +19,6 @@ class AppDomainTest extends TestCase
$this->validator = null;
}
// --- Metadata ---
public function testDescription(): void
{
$this->assertNotEmpty($this->validator->getDescription());
@@ -37,8 +35,6 @@ class AppDomainTest extends TestCase
$this->assertEquals($this->validator::TYPE_STRING, $this->validator->getType());
}
// --- Non-string types ---
public function testRejectsNonStringTypes(): void
{
$this->assertFalse($this->validator->isValid(null));
@@ -50,8 +46,6 @@ class AppDomainTest extends TestCase
$this->assertFalse($this->validator->isValid(new \stdClass()));
}
// --- Empty / whitespace ---
public function testRejectsEmptyString(): void
{
$this->assertFalse($this->validator->isValid(''));
@@ -64,8 +58,6 @@ class AppDomainTest extends TestCase
$this->assertFalse($this->validator->isValid("\n"));
}
// --- Localhost ---
public function testAcceptsLocalhost(): void
{
$this->assertTrue($this->validator->isValid('localhost'));
@@ -80,8 +72,6 @@ class AppDomainTest extends TestCase
$this->assertTrue($this->validator->isValid('localhost:65535'));
}
// --- Valid domains ---
public function testAcceptsValidDomains(): void
{
$this->assertTrue($this->validator->isValid('example.com'));
@@ -98,8 +88,6 @@ class AppDomainTest extends TestCase
$this->assertTrue($this->validator->isValid('sub.example.com:3000'));
}
// --- Valid IPv4 ---
public function testAcceptsIPv4Addresses(): void
{
$this->assertTrue($this->validator->isValid('127.0.0.1'));
@@ -116,8 +104,6 @@ class AppDomainTest extends TestCase
$this->assertTrue($this->validator->isValid('10.0.0.1:3000'));
}
// --- Valid IPv6 bracket notation ---
public function testAcceptsIPv6BracketNotation(): void
{
$this->assertTrue($this->validator->isValid('[::1]'));
@@ -128,8 +114,6 @@ class AppDomainTest extends TestCase
$this->assertFalse($this->validator->isValid('[fe80::1%25eth0]'));
}
// --- Invalid domains ---
public function testRejectsInvalidDomains(): void
{
$this->assertFalse($this->validator->isValid('-invalid.com'));
@@ -137,8 +121,6 @@ class AppDomainTest extends TestCase
$this->assertFalse($this->validator->isValid('.example.com'));
}
// --- Invalid port ---
public function testRejectsInvalidPorts(): void
{
$this->assertFalse($this->validator->isValid('localhost:0'));
@@ -148,8 +130,6 @@ class AppDomainTest extends TestCase
$this->assertFalse($this->validator->isValid('localhost:-1'));
}
// --- Multiple colons without brackets ---
public function testRejectsMultipleColonsWithoutBrackets(): void
{
$this->assertFalse($this->validator->isValid('::1'));
@@ -157,8 +137,6 @@ class AppDomainTest extends TestCase
$this->assertFalse($this->validator->isValid('a:b:c'));
}
// --- Malformed IPv6 brackets ---
public function testRejectsMalformedIPv6Brackets(): void
{
$this->assertFalse($this->validator->isValid('['));
@@ -168,8 +146,6 @@ class AppDomainTest extends TestCase
$this->assertFalse($this->validator->isValid('[invalid'));
}
// --- Port boundary values ---
public function testPortBoundaryValues(): void
{
$this->assertTrue($this->validator->isValid('localhost:1'));
@@ -178,16 +154,12 @@ class AppDomainTest extends TestCase
$this->assertFalse($this->validator->isValid('localhost:65536'));
}
// --- Trimming ---
public function testTrimsWhitespace(): void
{
$this->assertTrue($this->validator->isValid(' localhost '));
$this->assertTrue($this->validator->isValid(' example.com '));
}
// --- Empty port segment ---
public function testAcceptsEmptyPortSegment(): void
{
// 'localhost:' splits into host='localhost', port='' — empty port is skipped