Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/Codeception/Module/Symfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,10 @@ protected function debugResponse(mixed $url): void
return;
}

$this->debugCollector($profile, DataCollectorName::SECURITY->value);
$this->debugCollector($profile, DataCollectorName::MAILER->value);
$this->debugCollector($profile, DataCollectorName::NOTIFIER->value);
$this->debugCollector($profile, DataCollectorName::TIME->value);
$this->debugCollector($profile, DataCollectorName::SECURITY);
$this->debugCollector($profile, DataCollectorName::MAILER);
$this->debugCollector($profile, DataCollectorName::NOTIFIER);
$this->debugCollector($profile, DataCollectorName::TIME);
}

protected function doRebootClientKernel(): void
Expand Down Expand Up @@ -463,13 +463,13 @@ private function debugTimeData(TimeDataCollector $timeCollector): void
$this->debugSection('Time', sprintf('%.2f ms', $timeCollector->getDuration()));
}

private function debugCollector(Profile $profile, string $name): void
private function debugCollector(Profile $profile, DataCollectorName $name): void
{
if (!$profile->hasCollector($name)) {
if (!$profile->hasCollector($name->value)) {
return;
}

$collector = $profile->getCollector($name);
$collector = $profile->getCollector($name->value);
match (true) {
$collector instanceof SecurityDataCollector => $this->debugSecurityData($collector),
$collector instanceof MessageDataCollector => $this->debugMailerData($collector),
Expand Down
13 changes: 8 additions & 5 deletions src/Codeception/Module/Symfony/SessionAssertionsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

use function class_exists;
use function get_debug_type;
use function in_array;
use function is_int;
use function is_string;
use function serialize;
Expand Down Expand Up @@ -125,8 +124,9 @@ public function logoutProgrammatically(): void

$cookieJar = $this->getClient()->getCookieJar();
foreach ($cookieJar->all() as $cookie) {
if (in_array($cookie->getName(), ['MOCKSESSID', 'REMEMBERME', $sessionName], true)) {
$cookieJar->expire($cookie->getName());
$cookieName = $cookie->getName();
if ($cookieName === 'MOCKSESSID' || $cookieName === 'REMEMBERME' || $cookieName === $sessionName) {
$cookieJar->expire($cookieName);
}
}
$cookieJar->flushExpiredCookies();
Expand Down Expand Up @@ -164,15 +164,18 @@ public function seeInSession(string $attribute, mixed $value = null): void
*/
public function seeSessionHasValues(array $bindings): void
{
$session = $this->getCurrentSession();

foreach ($bindings as $key => $value) {
if (!is_int($key)) {
$this->seeInSession($key, $value);
$this->assertTrue($session->has($key), "No session attribute with name '{$key}'");
$this->assertSame($value, $session->get($key));
continue;
}
if (!is_string($value)) {
throw new InvalidArgumentException(sprintf('Attribute name must be string, %s given.', get_debug_type($value)));
}
$this->seeInSession($value);
$this->assertTrue($session->has($value), "No session attribute with name '{$value}'");
}
}

Expand Down