Skip to content

Commit 0fcbbc1

Browse files
committed
Adjusting Session To Use Session Manager - CS Fixes, Adding Faux Manager for Testing
1 parent 36adec1 commit 0fcbbc1

File tree

6 files changed

+22
-6
lines changed

6 files changed

+22
-6
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ DB_HOST=127.0.0.1
33
DB_NAME=phalcon
44
DB_USERNAME=root
55
DB_PASSWORD=password
6+
DB_PORT=3306
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Codeception\Lib\Connector\Phalcon4;
4+
5+
use Phalcon\Session\Manager;
6+
7+
class SessionManager extends Manager
8+
{
9+
/**
10+
* We have to override this as otherwise nothing working correctly in testing.
11+
*
12+
* @return bool
13+
*/
14+
public function exists(): bool
15+
{
16+
return true;
17+
}
18+
}

src/Codeception/Module/Phalcon4.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
use Codeception\Lib\Interfaces\PartedModule;
1313
use Codeception\TestInterface;
1414
use Codeception\Util\ReflectionHelper;
15+
use Exception;
1516
use PDOException;
1617
use Phalcon\Di;
1718
use Phalcon\Di\Injectable;
1819
use Phalcon\DiInterface;
1920
use Phalcon\Mvc\Model as PhalconModel;
2021
use Phalcon\Mvc\Router\RouteInterface;
2122
use Phalcon\Mvc\RouterInterface;
22-
use Phalcon\Session\Manager;
23+
use Codeception\Lib\Connector\Phalcon4\SessionManager;
2324
use Phalcon\Url;
2425

2526
/**
@@ -152,11 +153,10 @@ public function _before(TestInterface $test)
152153

153154
if ($this->di->has('session')) {
154155
/** @var Manager $manager */
155-
$manager = $this->di->get(Manager::class);
156+
$manager = $this->di->get(SessionManager::class);
156157
$manager->setAdapter(
157158
$this->di->get($this->config['session'])
158159
);
159-
$manager->start();
160160

161161
// Destroy existing sessions of previous tests
162162
$this->di['session'] = $manager;

tests/_support/AcceptanceTester.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
43
/**
54
* Inherited Methods
65
*

tests/_support/FunctionalTester.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
43
/**
54
* Inherited Methods
65
*

tests/_support/UnitTester.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
43
/**
54
* Inherited Methods
65
*

0 commit comments

Comments
 (0)