Skip to content

Commit

Permalink
Remove test dependency on APC
Browse files Browse the repository at this point in the history
Replace use of sfAPCCache by sfFileCache on unit test so that it runs without PHP dependencies nor code that is not being tested.
  • Loading branch information
mentalstring committed Dec 22, 2023
1 parent 4c3fb98 commit b2af1f7
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 b2af1f7

Please sign in to comment.