Skip to content

Commit 5a34bed

Browse files
author
mateusz.prazmowski
committed
Fixes #3608 - [PHPUnit_Framework_Exception] implode(): Invalid arguments passed
1 parent 250d461 commit 5a34bed

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/Codeception/Module/Symfony.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Codeception\Lib\Interfaces\PartedModule;
1010
use Symfony\Component\Finder\Finder;
1111
use 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.
@@ -474,10 +475,16 @@ protected function debugResponse($url)
474475
if ($profile = $this->getProfile()) {
475476
if ($profile->hasCollector('security')) {
476477
if ($profile->getCollector('security')->isAuthenticated()) {
478+
$roles = $profile->getCollector('security')->getRoles();
479+
480+
if ($roles instanceof Data) {
481+
$roles = $this->extractRawRoles($roles);
482+
}
483+
477484
$this->debugSection(
478485
'User',
479486
$profile->getCollector('security')->getUser()
480-
. ' [' . implode(',', $profile->getCollector('security')->getRoles()) . ']'
487+
. ' [' . implode(',', $roles) . ']'
481488
);
482489
} else {
483490
$this->debugSection('User', 'Anonymous');
@@ -495,6 +502,17 @@ protected function debugResponse($url)
495502
}
496503
}
497504

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+
498516
/**
499517
* Returns a list of recognized domain names.
500518
*

0 commit comments

Comments
 (0)