Skip to content

Commit

Permalink
Remove test dependency on APC
Browse files Browse the repository at this point in the history
Replace the use of sfAPCCache with sfFileCache in
sfCacheSessionStorageTest so that it doesn't depend on APC being
available.
  • Loading branch information
mentalstring committed Jan 1, 2024
1 parent 30966ee commit 058149b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions test/unit/storage/sfCacheSessionStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@

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

// setup cache
$temp = tempnam('/tmp/cache_dir', 'tmp');
unlink($temp);
mkdir($temp);

$plan = 8;
$t = new lime_test($plan);

if (!ini_get('apc.enable_cli')) {
$t->skip('APC must be enable on CLI to run these tests', $plan);

return;
}

// initialize the storage
try {
$storage = new sfCacheSessionStorage();
Expand All @@ -37,7 +36,7 @@
$t->pass('->__construct() throws an exception when not provided a cache option');
}

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

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

// shutdown the storage
$storage->shutdown();

// clean up cache
sfToolkit::clearDirectory($temp);
rmdir($temp);

0 comments on commit 058149b

Please sign in to comment.