Skip to content

Commit 095c188

Browse files
BassterNaktibalda
authored andcommitted
[Symfony] updated extractRawRoles()to support Symfony >= 3.3 (#4309)
* Symfony::extractRawRoles() failed on security collector from Symfony >= 3.3. When extracting roles from security collector, you can simply utilize the getValue method of Data class, when it exists.
1 parent ad04ee4 commit 095c188

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/Codeception/Module/Symfony.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,14 @@ protected function debugResponse($url)
521521
*/
522522
private function extractRawRoles(Data $data)
523523
{
524-
$raw = $data->getRawData();
524+
if ($this->dataRevealsValue($data)) {
525+
$roles = $data->getValue();
526+
} else {
527+
$raw = $data->getRawData();
528+
$roles = isset($raw[1]) ? $raw[1] : [];
529+
}
525530

526-
return isset($raw[1]) ? $raw[1] : [];
531+
return $roles;
527532
}
528533

529534
/**
@@ -573,4 +578,16 @@ public function rebootClientKernel()
573578
$this->client->rebootKernel();
574579
}
575580
}
581+
582+
/**
583+
* Public API from Data changed from Symfony 3.2 to 3.3.
584+
*
585+
* @param \Symfony\Component\VarDumper\Cloner\Data $data
586+
*
587+
* @return bool
588+
*/
589+
private function dataRevealsValue(Data $data)
590+
{
591+
return method_exists($data, 'getValue');
592+
}
576593
}

0 commit comments

Comments
 (0)