PHP Classes
elePHPant
Icontem

File: tests/unit/Storage/FileStorageTest.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Daniel Martinez  >  Forker PHP  >  tests/unit/Storage/FileStorageTest.php  >  Download  
File: tests/unit/Storage/FileStorageTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: Forker PHP
Split tasks into multiple forked processes
Author: By
Last change: Changing indentation
Date: 8 months ago
Size: 994 bytes
 

Contents

Class file image Download
<?php

use Forker\Storage\FileStorage;

use
org\bovigo\vfs\vfsStream;

require_once
'BaseStorageTest.php';

class
FileStorageTest extends BaseStorageTest
{

    private
$folder_to_store;

    public function
setUp()
    {
       
$this->folder_to_store = vfsStream::setup('myTasksDir');
       
parent::setUp();
    }

    protected function
getSystemStorage()
    {
        return new
FileStorage(
           
vfsStream::url('myTasksDir/')
        );
    }

   
/**
     * Useful if we want to store several values for each key
     */
   
public function testWeCanAddValuesToAStoredKey()
    {
       
$value1 = 'value1';
       
$value2 = 'value2';
       
$value3 = 'value3';

       
$expectedValue = array($value1, $value2, $value3);

       
$this->storageSystem->store('foo', $value1);
       
$this->storageSystem->store('foo', $value2);
       
$this->storageSystem->store('foo', $value3);

       
$this->assertEquals($expectedValue, $this->storageSystem->get('foo') );
    }

}