PHP Classes

File: tests/Utils/Cache/FileCacheTest.php

Recommend this page to a friend!
  Classes of Koala Yeung   Widgetfy   tests/Utils/Cache/FileCacheTest.php   Download  
File: tests/Utils/Cache/FileCacheTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: Widgetfy
Generate HTML to embed video content of given URL
Author: By
Last change: Update of tests/Utils/Cache/FileCacheTest.php
Date: 2 months ago
Size: 1,651 bytes
 

Contents

Class file image Download
<?php

/**
 * Unit test for Phata\Widgetfy\Utils\Cache\FileCache
 *
 * Licence:
 *
 * This file is part of Widgetfy.
 *
 * Widgetfy is free software: you can redistribute
 * it and/or modify it under the terms of the GNU
 * Lesser General Public License as published by the
 * Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * Widgetfy is distributed in the hope that it will
 * be useful, but WITHOUT ANY WARRANTY; without even
 * the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser
 * General Public Licensefor more details.
 *
 * You should have received a copy of the GNU Lesser
 * General Public License along with Widgetfy. If
 * not, see <http://www.gnu.org/licenses/lgpl.html>.
 *
 * Description:
 *
 * This file is a unit test for
 * - Phata\Widgetfy\Utils\Cache\FileCache
 *
 * @package Widgetfy
 * @author Koala Yeung <koalay@gmail.com>
 * @copyright 2014 Koala Yeung
 * @licence http://www.gnu.org/licenses/lgpl.html
 * @link http://github.com/Phata/Widgetfy
 */

use Phata\Widgetfy\Utils\Cache\FileCache as FileCache;
use
PHPUnit\Framework\TestCase;

class
FileCacheTest extends TestCase {

    public function
testFile() {
       
$c = new FileCache;
       
$group = 'test';
       
$key = 'testFile';
       
$value = md5(time() . rand()); // random value
       
$cache_fullpath = $c->fullpath($c->filename($group, $key));

       
$c->set($group, $key, $value);
       
$value2 = $c->get($group, $key);

       
$this->assertTrue(file_exists($cache_fullpath));
       
$this->assertEquals($value, $value2);
    }

}