Newer
Older
<?php

Yassine Doghri
committed
declare(strict_types=1);
namespace Tests\Support;
use CodeIgniter\Session\Handlers\ArrayHandler;

Yassine Doghri
committed
use CodeIgniter\Session\SessionInterface;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\Mock\MockSession;

Yassine Doghri
committed
use Config\Services;
/**
* @phpstan-ignore-next-line
*/
class SessionTestCase extends CIUnitTestCase
{

Yassine Doghri
committed
/**

Yassine Doghri
committed
* @var SessionInterface

Yassine Doghri
committed
*/
protected $session;
protected function setUp(): void

Yassine Doghri
committed
{
parent::setUp();

Yassine Doghri
committed
$this->mockSession();
}

Yassine Doghri
committed
/**
* Pre-loads the mock session driver into $this->session.
*
* @var string
*/
protected function mockSession(): void

Yassine Doghri
committed
{
$config = config('App');
$this->session = new MockSession(new ArrayHandler($config, '0.0.0.0'), $config,);

Yassine Doghri
committed
Services::injectMock('session', $this->session);

Yassine Doghri
committed
}