public function FileCacheTest::testFilenameCollision in Plug 7
File
- lib/
doctrine/ cache/ tests/ Doctrine/ Tests/ Common/ Cache/ FileCacheTest.php, line 62
Class
- FileCacheTest
- @group DCOM-101
Namespace
Doctrine\Tests\Common\CacheCode
public function testFilenameCollision() {
$data = array(
'key:0' => 'key-0',
'key\\0' => 'key-0',
'key/0' => 'key-0',
'key<0' => 'key-0',
'key>0' => 'key-0',
'key"0' => 'key-0',
'key*0' => 'key-0',
'key?0' => 'key-0',
'key|0' => 'key-0',
'key-0' => 'key__0',
'keyä0' => 'key--0',
);
$paths = array();
$cache = $this->driver;
$method = new \ReflectionMethod($cache, 'getFilename');
$method
->setAccessible(true);
foreach ($data as $key => $expected) {
$path = $method
->invoke($cache, $key);
$actual = pathinfo($path, PATHINFO_FILENAME);
$this
->assertNotContains($path, $paths);
$this
->assertEquals($expected, $actual);
$paths[] = $path;
}
}