Skip to content

Commit 0c77ff7

Browse files
committed
Remove test dependency on APC
Replace use of sfAPCCache by sfFileCache on unit test so that it runs without PHP dependencies nor code that is not being tested.
1 parent 5b5cc32 commit 0c77ff7

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

test/unit/storage/sfCacheSessionStorageTest.php

+10-7
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@
2020

2121
sfConfig::set('sf_symfony_lib_dir', realpath($_test_dir.'/../lib'));
2222

23+
// setup cache
24+
$temp = tempnam('/tmp/cache_dir', 'tmp');
25+
unlink($temp);
26+
mkdir($temp);
27+
2328
$plan = 8;
2429
$t = new lime_test($plan);
2530

26-
if (!ini_get('apc.enable_cli')) {
27-
$t->skip('APC must be enable on CLI to run these tests', $plan);
28-
29-
return;
30-
}
31-
3231
// initialize the storage
3332
try {
3433
$storage = new sfCacheSessionStorage();
@@ -37,7 +36,7 @@
3736
$t->pass('->__construct() throws an exception when not provided a cache option');
3837
}
3938

40-
$storage = new sfCacheSessionStorage(array('cache' => array('class' => 'sfAPCCache', 'param' => array())));
39+
$storage = new sfCacheSessionStorage(array('cache' => array('class' => 'sfFileCache', 'param' => array('cache_dir' => $temp))));
4140
$t->ok($storage instanceof sfStorage, '->__construct() is an instance of sfStorage');
4241

4342
$storage->write('test', 123);
@@ -63,3 +62,7 @@
6362

6463
// shutdown the storage
6564
$storage->shutdown();
65+
66+
// clean up cache
67+
sfToolkit::clearDirectory($temp);
68+
rmdir($temp);

0 commit comments

Comments
 (0)