Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'cache_tests_cleanup' of https://github.com/marc-mabe/zf2
Browse files Browse the repository at this point in the history
…into hotfix/cache-tests

Conflicts:
	tests/Zend/Locale/Data/CldrTest.php
  • Loading branch information
Showing 1 changed file with 1 addition and 44 deletions.
45 changes: 1 addition & 44 deletions test/Helper/CurrencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,7 @@ public function setUp()
{
$this->clearRegistry();

$this->_cacheDir = sys_get_temp_dir() . '/zend_view_helper_currency';
$this->_removeRecursive($this->_cacheDir);
mkdir($this->_cacheDir);

$this->_cache = CacheFactory::factory(array(
'adapter' => array(
'name' => 'Filesystem',
'options' => array(
'ttl' => 120,
'cache_dir' => $this->_cacheDir,
)
),
'plugins' => array(
array(
'name' => 'serializer',
'options' => array(
'serializer' => 'php_serialize',
),
),
),
));

$this->_cache = CacheFactory::adapterFactory('memory', array('memory_limit' => 0));
Currency\Currency::setCache($this->_cache);

$this->helper = new Helper\Currency('de_AT');
Expand All @@ -103,31 +82,9 @@ public function tearDown()
{
unset($this->helper);
$this->_cache->clear(CacheAdapter::MATCH_ALL);
$this->_removeRecursive($this->_cacheDir);
$this->clearRegistry();
}

protected function _removeRecursive($dir)
{
if (file_exists($dir)) {
$dirIt = new \DirectoryIterator($dir);
foreach ($dirIt as $entry) {
$fname = $entry->getFilename();
if ($fname == '.' || $fname == '..') {
continue;
}

if ($entry->isFile()) {
unlink($entry->getPathname());
} else {
$this->_removeRecursive($entry->getPathname());
}
}

rmdir($dir);
}
}

public function testCurrencyObjectPassedToConstructor()
{
$curr = new Currency\Currency('de_AT');
Expand Down

0 comments on commit a893c8a

Please sign in to comment.