Advertisement
Guest User

Untitled

a guest
Mar 20th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. <?php
  2. class FileTest extends \PHPUnit_Framework_TestCase {
  3.  
  4.   private
  5.     $cache,
  6.     $virtualFileSystemPath,
  7.     $vfs;
  8.  
  9.  
  10.   public function setup()
  11.   {
  12.     $this->virtualFileSystemPath = 'vfs';
  13.     $this->vfs = vfsStream::setup($this->virtualFileSystemPath);
  14.     $this->cache = new Cache;
  15.   }
  16.  
  17.   public function testSetUsesKeyAsFileNameToPersistCacheIn()
  18.   {
  19.     $file = vfsStream::url($this->virtualFileSystemPath . '/testFile');
  20.     $this->cache->set($file, 'dummyValue');
  21.     $this->assertTrue(
  22.       $this->vfs->hasChild('testFile')
  23.     );
  24.   }
  25.  
  26.   public function testSetUsesValueAsFileContentToPersistCacheIn()
  27.   {
  28.     $file = vfsStream::url($this->virtualFileSystemPath . '/testFile');
  29.     $this->cache->set($file, ['GET', '/']);
  30.     $this->assertSame(
  31.       "<?php return array (\n  0 => 'GET',\n  1 => '/',\n);",
  32.       file_get_contents($file)
  33.     );
  34.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement