Skip to content

Commit 59704bf

Browse files
mentalstringthePanz
authored andcommitted
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 9abeafd commit 59704bf

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

test/unit/storage/sfCacheSessionStorageTest.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@
1919

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

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

25-
if (!ini_get('apc.enable_cli'))
26-
{
27-
$t->skip('APC must be enable on CLI to run these tests', $plan);
28-
return;
29-
}
30-
3130
// initialize the storage
3231
try
3332
{
@@ -40,7 +39,7 @@
4039
}
4140

4241

43-
$storage = new sfCacheSessionStorage(array('cache' => array('class' => 'sfAPCCache', 'param' => array())));
42+
$storage = new sfCacheSessionStorage(array('cache' => array('class' => 'sfFileCache', 'param' => array('cache_dir' => $temp))));
4443
$t->ok($storage instanceof sfStorage, '->__construct() is an instance of sfStorage');
4544

4645
$storage->write('test', 123);
@@ -66,3 +65,7 @@
6665

6766
// shutdown the storage
6867
$storage->shutdown();
68+
69+
// clean up cache
70+
sfToolkit::clearDirectory($temp);
71+
rmdir($temp);

0 commit comments

Comments
 (0)