public function FileCacheTest::testFilenameShouldCreateThePathWithFourSubDirectories in Plug 7
File
- lib/
doctrine/ cache/ tests/ Doctrine/ Tests/ Common/ Cache/ FileCacheTest.php, line 95
Class
- FileCacheTest
- @group DCOM-101
Namespace
Doctrine\Tests\Common\CacheCode
public function testFilenameShouldCreateThePathWithFourSubDirectories() {
$cache = $this->driver;
$method = new \ReflectionMethod($cache, 'getFilename');
$key = 'item-key';
$expectedDir = array(
'84',
'e0',
'e2',
'e8',
'93',
'fe',
'bb',
'73',
'7a',
'0f',
'ee',
'0c',
'89',
'd5',
'3f',
'4b',
'b7',
'fc',
'b4',
'4c',
'57',
'cd',
'f3',
'd3',
'2c',
'e7',
'36',
'3f',
'5d',
'59',
'77',
'60',
);
$expectedDir = implode(DIRECTORY_SEPARATOR, $expectedDir);
$method
->setAccessible(true);
$path = $method
->invoke($cache, $key);
$filename = pathinfo($path, PATHINFO_FILENAME);
$dirname = pathinfo($path, PATHINFO_DIRNAME);
$this
->assertEquals('item__key', $filename);
$this
->assertEquals(DIRECTORY_SEPARATOR . $expectedDir, $dirname);
$this
->assertEquals(DIRECTORY_SEPARATOR . $expectedDir . DIRECTORY_SEPARATOR . 'item__key', $path);
}