From 2dd88281bf845548142022a6631923712892fc66 Mon Sep 17 00:00:00 2001 From: Tavo Nieves J Date: Wed, 9 Dec 2020 21:33:43 -0500 Subject: [PATCH] Added seeSessionHasValues function --- src/Codeception/Module/Symfony.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Codeception/Module/Symfony.php b/src/Codeception/Module/Symfony.php index c228fe78..52eb7e0b 100644 --- a/src/Codeception/Module/Symfony.php +++ b/src/Codeception/Module/Symfony.php @@ -890,6 +890,29 @@ public function logout() $cookieJar->flushExpiredCookies(); } + /** + * Assert that the session has a given list of values. + * + * ``` php + * seeSessionHasValues(['key1', 'key2']); + * $I->seeSessionHasValues(['key1' => 'value1', 'key2' => 'value2']); + * ``` + * + * @param array $bindings + * @return void + */ + public function seeSessionHasValues(array $bindings) + { + foreach ($bindings as $key => $value) { + if (is_int($key)) { + $this->seeInSession($value); + } else { + $this->seeInSession($key, $value); + } + } + } + /** * Assert that a session attribute exists. *