public function WriteSafeSessionHandlerTest::testOtherMethods in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Session/WriteSafeSessionHandlerTest.php \Drupal\Tests\Core\Session\WriteSafeSessionHandlerTest::testOtherMethods()
- 9 core/tests/Drupal/Tests/Core/Session/WriteSafeSessionHandlerTest.php \Drupal\Tests\Core\Session\WriteSafeSessionHandlerTest::testOtherMethods()
Tests that other invocations are passed unmodified to the wrapped handler.
@covers ::setSessionWritable @covers ::open @covers ::read @covers ::close @covers ::destroy @covers ::gc @dataProvider providerTestOtherMethods
File
- core/
tests/ Drupal/ Tests/ Core/ Session/ WriteSafeSessionHandlerTest.php, line 132
Class
Namespace
Drupal\Tests\Core\SessionCode
public function testOtherMethods($method, $expected_result, $args) {
$invocation = $this->wrappedSessionHandler
->expects($this
->exactly(2))
->method($method)
->will($this
->returnValue($expected_result));
// Set the parameter matcher.
call_user_func_array([
$invocation,
'with',
], $args);
// Test with writable session.
$this
->assertTrue($this->sessionHandler
->isSessionWritable());
$actual_result = call_user_func_array([
$this->sessionHandler,
$method,
], $args);
$this
->assertSame($expected_result, $actual_result);
// Test with non-writable session.
$this->sessionHandler
->setSessionWritable(FALSE);
$this
->assertFalse($this->sessionHandler
->isSessionWritable());
$actual_result = call_user_func_array([
$this->sessionHandler,
$method,
], $args);
$this
->assertSame($expected_result, $actual_result);
}