Skip to content

Commit 70ae730

Browse files
Adding dontSeeInSession() (#64)
1 parent 771bfb9 commit 70ae730

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/Codeception/Module/Symfony.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,33 @@ public function seeInSession(string $attrib, $value = null)
916916
}
917917
}
918918

919+
/**
920+
* Assert that a session attribute does not exist, or is not equal to the passed value.
921+
*
922+
* ```php
923+
* <?php
924+
* $I->dontSeeInSession('attribute');
925+
* $I->dontSeeInSession('attribute', 'value');
926+
* ```
927+
*
928+
* @param string $attribute
929+
* @param mixed|null $value
930+
* @return void
931+
*/
932+
public function dontSeeInSession(string $attribute, $value = null)
933+
{
934+
$session = $this->grabService('session');
935+
936+
if (null === $value) {
937+
if ($session->has($attribute)) {
938+
$this->fail("Session attribute with name '$attribute' does exist");
939+
}
940+
}
941+
else {
942+
$this->assertNotEquals($value, $session->get($attribute));
943+
}
944+
}
945+
919946
/**
920947
* Opens web page by action name
921948
*

0 commit comments

Comments
 (0)