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

Commit

Permalink
Merge branch 'master' of git://github.com/zendframework/zf2 into cach…
Browse files Browse the repository at this point in the history
…e_internals

Conflicts:
	library/Zend/Cache/Storage/Adapter/Filesystem.php
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
Zend\Db\Table\Select as DbTableSelect,
Zend\Filter\Filter,
Zend\Json\Json,
Zend\Stdlib\IteratorToArray,
Zend\Stdlib\ArrayUtils,
Zend\View;

/**
Expand Down Expand Up @@ -263,7 +263,7 @@ public static function getAdapterBroker()
public static function setConfig($config)
{
if ($config instanceof Traversable) {
$config = IteratorToArray::convert($config);
$config = ArrayUtils::iteratorToArray($config);
}
if (!is_array($config)) {
throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable');
Expand Down
31 changes: 10 additions & 21 deletions test/PaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,35 +77,21 @@ protected function setUp()
$this->_testCollection = range(1, 101);
$this->_paginator = Paginator\Paginator::factory($this->_testCollection);

$this->_config = new Config\Xml(__DIR__ . '/_files/config.xml');

$this->_cache = CacheFactory::factory(array(
'adapter' => array(
'name' => 'filesystem',
'options' => array(
'ttl' => 3600,
'cache_dir' => $this->_getTmpDir(),
),
),
'plugins' => array(
array(
'name' => 'serializer',
'options' => array(
'serializer' => 'php_serialize',
),
),
),
));
$this->_cache->clear(CacheAdapter::MATCH_ALL);
$this->_config = Config\Factory::fromFile(__DIR__ . '/_files/config.xml', true);

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

$this->_restorePaginatorDefaults();
}

protected function tearDown()
{
$this->_cache->clear(CacheAdapter::MATCH_ALL);
if ($this->_cache) {
$this->_cache->clear(CacheAdapter::MATCH_ALL);
$this->_cache = null;
}
$this->_dbConn = null;
$this->_testCollection = null;
$this->_paginator = null;
Expand All @@ -114,6 +100,9 @@ protected function tearDown()
protected function _getTmpDir()
{
$tmpDir = rtrim(sys_get_temp_dir(), '/\\') . DIRECTORY_SEPARATOR . 'zend_paginator';
if (!is_dir($tmpDir)) {
mkdir($tmpDir);
}
$this->cacheDir = $tmpDir;
return $tmpDir;
}
Expand Down

0 comments on commit ce665da

Please sign in to comment.