recreate project
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Support;
|
||||
|
||||
use CodeIgniter\Test\CIUnitTestCase;
|
||||
|
||||
class BaseWebTestCase extends CIUnitTestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
// Start session if not already started
|
||||
if (!session()->isStarted()) {
|
||||
session()->start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set session role and user ID
|
||||
*
|
||||
* @param string $role e.g., 'administrator', 'teacher', 'parent', etc.
|
||||
* @param int $userId Default to 1
|
||||
*/
|
||||
protected function setSessionRole(string $role, int $userId = 1): void
|
||||
{
|
||||
session()->set([
|
||||
'role' => strtolower($role),
|
||||
'user_id' => $userId,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user