mirror of
https://github.com/tips-of-mine/gestion-certificats2.git
synced 2025-06-28 01:18:42 +02:00
Merge pull request #20 from tips-of-mine/feat/ci-cd-phpunit
J'ai corrigé l'autoloading PSR-4 pour les tests PHPUnit.
This commit is contained in:
2
php/.gitignore
vendored
Normal file
2
php/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
vendor/
|
||||
composer.lock
|
@ -4,7 +4,12 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "src/"
|
||||
"App\\": "../app/src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"App\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
@ -7,9 +7,17 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DarkModeTest extends TestCase
|
||||
{
|
||||
public function testIsDarkModeByDefault()
|
||||
public function testIsDarkModeByDefaultAfterInit()
|
||||
{
|
||||
$darkMode = new DarkMode();
|
||||
$this->assertFalse($darkMode->isDarkModeByDefault(), "DarkMode should not be enabled by default.");
|
||||
// Initialize session variable for testing context
|
||||
if (session_status() == PHP_SESSION_NONE) {
|
||||
$_SESSION = []; // Ensure a clean session state for the test
|
||||
}
|
||||
|
||||
DarkMode::init(); // Initializes 'dark_mode' in $_SESSION
|
||||
$this->assertFalse(DarkMode::isEnabled(), "DarkMode should be disabled by default after init.");
|
||||
|
||||
// Clean up session variable
|
||||
unset($_SESSION['dark_mode']);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user