Skip to content

Commit

Permalink
test: added more tests for System class
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Sep 22, 2024
1 parent a080d67 commit 227f21b
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions tests/phpMyFAQ/SystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,71 @@ public function testGetDocumentationUrl(): void

$this->assertEquals($expectedUrl, $actualUrl);
}

public function testGetGitHubIssuesUrl(): void
{
$expectedUrl = 'https://github.com/thorsten/phpMyFAQ/issues';
$actualUrl = System::getGitHubIssuesUrl();

$this->assertEquals($expectedUrl, $actualUrl);
}

public function testGetAvailableTemplates()
{
$system = new System();
$result = $system->getAvailableTemplates();

$this->assertIsArray($result);
$this->assertNotEmpty($result);
}

public function testGetSupportedSafeDatabases()
{
$system = new System();
$result = $system->getSupportedSafeDatabases();

$this->assertIsArray($result);
$this->assertNotEmpty($result);
}

public function testGetSystemUri(): void
{
$configuration = Configuration::getConfigurationInstance();
$configuration->set('main.referenceURL', 'https://example.com');
$system = new System();
$result = $system->getSystemUri($configuration);

$this->assertIsString($result);
$this->assertNotEmpty($result);
$this->assertStringContainsString('http', $result);
}

public function testCheckDatabase(): void
{
$system = new System();
$result = $system->checkDatabase();

$this->assertTrue($result);
}

public function testGetMissingExtensions(): void
{
$system = new System();
$result = $system->getMissingExtensions();

$this->assertEquals([], $result);
}

/**
* @throws \Exception
*/
public function testCreateHashes(): void
{
$system = new System();
$result = $system->createHashes();

$this->assertIsString($result);
$this->assertNotEmpty($result);
$this->assertStringContainsString('created', $result);
}
}

0 comments on commit 227f21b

Please sign in to comment.