Skip to content

Commit b8b9379

Browse files
committed
Symfony 6 Support: SessionAssertionsTrait
1 parent a0601ed commit b8b9379

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Codeception/Module/Symfony/SessionAssertionsTrait.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,12 @@ public function dontSeeInSession(string $attribute, $value = null): void
8282
{
8383
$session = $this->getCurrentSession();
8484

85-
if (null === $value) {
86-
if ($session->has($attribute)) {
87-
$this->fail("Session attribute with name '{$attribute}' does exist");
88-
}
89-
} else {
85+
if ($attributeExists = $session->has($attribute)) {
86+
$this->fail("Session attribute with name '{$attribute}' does exist");
87+
}
88+
$this->assertFalse($attributeExists);
89+
90+
if (null !== $value) {
9091
$this->assertNotSame($value, $session->get($attribute));
9192
}
9293
}
@@ -167,9 +168,10 @@ public function seeInSession(string $attribute, $value = null): void
167168
{
168169
$session = $this->getCurrentSession();
169170

170-
if (!$session->has($attribute)) {
171+
if (!$attributeExists = $session->has($attribute)) {
171172
$this->fail("No session attribute with name '{$attribute}'");
172173
}
174+
$this->assertTrue($attributeExists);
173175

174176
if (null !== $value) {
175177
$this->assertSame($value, $session->get($attribute));

0 commit comments

Comments
 (0)