From af290059d10319e76d1e7d78b592cab99c26d91a Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Fri, 22 May 2020 11:02:56 +0200 Subject: Process session filters through Slim controllers Including: - visibility - links per page - untagged only --- tests/security/SessionManagerTest.php | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'tests/security') diff --git a/tests/security/SessionManagerTest.php b/tests/security/SessionManagerTest.php index f264505e..d9db775e 100644 --- a/tests/security/SessionManagerTest.php +++ b/tests/security/SessionManagerTest.php @@ -269,4 +269,61 @@ class SessionManagerTest extends TestCase $this->session['ip'] = 'ip_id_one'; $this->assertTrue($this->sessionManager->hasClientIpChanged('ip_id_two')); } + + /** + * Test creating an entry in the session array + */ + public function testSetSessionParameterCreate(): void + { + $this->sessionManager->setSessionParameter('abc', 'def'); + + static::assertSame('def', $this->session['abc']); + } + + /** + * Test updating an entry in the session array + */ + public function testSetSessionParameterUpdate(): void + { + $this->session['abc'] = 'ghi'; + + $this->sessionManager->setSessionParameter('abc', 'def'); + + static::assertSame('def', $this->session['abc']); + } + + /** + * Test updating an entry in the session array with null value + */ + public function testSetSessionParameterUpdateNull(): void + { + $this->session['abc'] = 'ghi'; + + $this->sessionManager->setSessionParameter('abc', null); + + static::assertArrayHasKey('abc', $this->session); + static::assertNull($this->session['abc']); + } + + /** + * Test deleting an existing entry in the session array + */ + public function testDeleteSessionParameter(): void + { + $this->session['abc'] = 'def'; + + $this->sessionManager->deleteSessionParameter('abc'); + + static::assertArrayNotHasKey('abc', $this->session); + } + + /** + * Test deleting a non existent entry in the session array + */ + public function testDeleteSessionParameterNotExisting(): void + { + $this->sessionManager->deleteSessionParameter('abc'); + + static::assertArrayNotHasKey('abc', $this->session); + } } -- cgit v1.2.3