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 authored and thePanz committed Jan 12, 2023
1 parent 9abeafd commit 59704bf
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 @@ -19,15 +19,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
{
Expand All @@ -40,7 +39,7 @@
}


$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 @@ -66,3 +65,7 @@

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

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

0 comments on commit 59704bf

Please sign in to comment.