You are here

public function PdoSessionHandlerTest::testReadingRequiresExactlySameId in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php \Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest::testReadingRequiresExactlySameId()

File

vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php, line 185

Class

PdoSessionHandlerTest

Namespace

Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler

Code

public function testReadingRequiresExactlySameId() {
  $storage = new PdoSessionHandler($this
    ->getMemorySqlitePdo());
  $storage
    ->open('', 'sid');
  $storage
    ->write('id', 'data');
  $storage
    ->write('test', 'data');
  $storage
    ->write('space ', 'data');
  $storage
    ->close();
  $storage
    ->open('', 'sid');
  $readDataCaseSensitive = $storage
    ->read('ID');
  $readDataNoCharFolding = $storage
    ->read('tést');
  $readDataKeepSpace = $storage
    ->read('space ');
  $readDataExtraSpace = $storage
    ->read('space  ');
  $storage
    ->close();
  $this
    ->assertSame('', $readDataCaseSensitive, 'Retrieval by ID should be case-sensitive (collation setting)');
  $this
    ->assertSame('', $readDataNoCharFolding, 'Retrieval by ID should not do character folding (collation setting)');
  $this
    ->assertSame('data', $readDataKeepSpace, 'Retrieval by ID requires spaces as-is');
  $this
    ->assertSame('', $readDataExtraSpace, 'Retrieval by ID requires spaces as-is');
}