Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class FileTest extends \PHPUnit_Framework_TestCase {
- private
- $cache,
- $virtualFileSystemPath,
- $vfs;
- public function setup()
- {
- $this->virtualFileSystemPath = 'vfs';
- $this->vfs = vfsStream::setup($this->virtualFileSystemPath);
- $this->cache = new Cache;
- }
- public function testSetUsesKeyAsFileNameToPersistCacheIn()
- {
- $file = vfsStream::url($this->virtualFileSystemPath . '/testFile');
- $this->cache->set($file, 'dummyValue');
- $this->assertTrue(
- $this->vfs->hasChild('testFile')
- );
- }
- public function testSetUsesValueAsFileContentToPersistCacheIn()
- {
- $file = vfsStream::url($this->virtualFileSystemPath . '/testFile');
- $this->cache->set($file, ['GET', '/']);
- $this->assertSame(
- "<?php return array (\n 0 => 'GET',\n 1 => '/',\n);",
- file_get_contents($file)
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement