Skip to content

Commit

Permalink
Add missing test file
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed May 4, 2012
1 parent a5da2c5 commit f0bcf8e
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tests/CacheKit/FileSystemCacheTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

class FileSystemCacheTest extends PHPUnit_Framework_TestCase
{

function testSerializer()
{
$serializer = new SerializerKit\Serializer('json');
$cache = new CacheKit\FileSystemCache(array(
'expiry' => 30,
'cache_dir' => 'cache',
'serializer' => $serializer,
));
$cache->clear();

$url = 'foo_bar';
$html = 'test content';
$cache->set( $url , $html );
$html2 = $cache->get( $url );

is( $html , $html2 );

$cache->remove( $url );

ok( null === $cache->get( $url ) );

$cache->clear();

ok( null === $cache->get( $url ) );
}

function test()
{
$cache = new CacheKit\FileSystemCache(array(
'expiry' => 30,
'cache_dir' => 'cache',
));

$url = 'http://google.com';
$cache->set( $url , $html = file_get_contents($url) );
$html2 = $cache->get( $url );

is( $html , $html2 );
$cache->remove( $url );
ok( null === $cache->get( $url ) );

$cache->clear();
}
}

0 comments on commit f0bcf8e

Please sign in to comment.