99use Codeception \Lib \Interfaces \PartedModule ;
1010use Symfony \Component \Finder \Finder ;
1111use Symfony \Component \DependencyInjection \ContainerInterface ;
12+ use Symfony \Component \VarDumper \Cloner \Data ;
1213
1314/**
1415 * This module uses Symfony Crawler and HttpKernel to emulate requests and test response.
@@ -202,6 +203,9 @@ public function _getEntityManager()
202203 if ($ this ->_getContainer ()->has ('doctrine.orm.default_entity_manager ' )) {
203204 $ this ->persistService ('doctrine.orm.default_entity_manager ' , true );
204205 }
206+ if ($ this ->_getContainer ()->has ('doctrine.dbal.backend_connection ' )) {
207+ $ this ->persistService ('doctrine.dbal.backend_connection ' , true );
208+ }
205209 }
206210 return $ this ->permanentServices [$ this ->config ['em_service ' ]];
207211 }
@@ -471,10 +475,16 @@ protected function debugResponse($url)
471475 if ($ profile = $ this ->getProfile ()) {
472476 if ($ profile ->hasCollector ('security ' )) {
473477 if ($ profile ->getCollector ('security ' )->isAuthenticated ()) {
478+ $ roles = $ profile ->getCollector ('security ' )->getRoles ();
479+
480+ if ($ roles instanceof Data) {
481+ $ roles = $ this ->extractRawRoles ($ roles );
482+ }
483+
474484 $ this ->debugSection (
475485 'User ' ,
476486 $ profile ->getCollector ('security ' )->getUser ()
477- . ' [ ' . implode (', ' , $ profile -> getCollector ( ' security ' )-> getRoles () ) . '] '
487+ . ' [ ' . implode (', ' , $ roles ) . '] '
478488 );
479489 } else {
480490 $ this ->debugSection ('User ' , 'Anonymous ' );
@@ -492,6 +502,17 @@ protected function debugResponse($url)
492502 }
493503 }
494504
505+ /**
506+ * @param Data $data
507+ * @return array
508+ */
509+ private function extractRawRoles (Data $ data )
510+ {
511+ $ raw = $ data ->getRawData ();
512+
513+ return isset ($ raw [1 ]) ? $ raw [1 ] : [];
514+ }
515+
495516 /**
496517 * Returns a list of recognized domain names.
497518 *
0 commit comments