1212use Codeception \Lib \Interfaces \PartedModule ;
1313use Codeception \TestInterface ;
1414use Codeception \Util \ReflectionHelper ;
15+ use Exception ;
1516use PDOException ;
1617use Phalcon \Di ;
1718use Phalcon \Di \Injectable ;
1819use Phalcon \DiInterface ;
1920use Phalcon \Mvc \Model as PhalconModel ;
2021use Phalcon \Mvc \Router \RouteInterface ;
2122use Phalcon \Mvc \RouterInterface ;
23+ use Codeception \Lib \Connector \Phalcon4 \SessionManager ;
2224use Phalcon \Url ;
2325
2426/**
@@ -150,8 +152,14 @@ public function _before(TestInterface $test)
150152 Di::setDefault ($ this ->di );
151153
152154 if ($ this ->di ->has ('session ' )) {
155+ /** @var Manager $manager */
156+ $ manager = $ this ->di ->get (SessionManager::class);
157+ $ manager ->setAdapter (
158+ $ this ->di ->get ($ this ->config ['session ' ])
159+ );
160+
153161 // Destroy existing sessions of previous tests
154- $ this ->di ['session ' ] = $ this -> di -> get ( $ this -> config [ ' session ' ]) ;
162+ $ this ->di ['session ' ] = $ manager ;
155163 }
156164
157165 if ($ this ->di ->has ('cookies ' )) {
@@ -223,7 +231,7 @@ public function getApplication()
223231 public function haveInSession ($ key , $ val )
224232 {
225233 $ this ->di ->get ('session ' )->set ($ key , $ val );
226- $ this ->debugSection ('Session ' , json_encode ($ this ->di ['session ' ]->toArray ()));
234+ $ this ->debugSection ('Session ' , json_encode ($ this ->di ['session ' ]->getAdapter ()-> toArray ()));
227235 }
228236
229237 /**
@@ -242,7 +250,7 @@ public function haveInSession($key, $val)
242250 */
243251 public function seeInSession ($ key , $ value = null )
244252 {
245- $ this ->debugSection ('Session ' , json_encode ($ this ->di ['session ' ]->toArray ()));
253+ $ this ->debugSection ('Session ' , json_encode ($ this ->di ['session ' ]->getAdapter ()-> toArray ()));
246254
247255 if (is_array ($ key )) {
248256 $ this ->seeSessionHasValues ($ key );
0 commit comments