public function testCountDataItems() { $cache = new ezcCacheStorageFileArray($this->createTempDir('ezcCacheStorageFileTest'), array('extension' => '.c')); $data = array(array('attributes' => array('lang' => 'en', 'section' => 'articles'), 'content' => array('lang' => 'en', 'section' => 'articles')), array('attributes' => array('lang' => 'de', 'section' => 'articles'), 'content' => array('lang' => 'de', 'section' => 'articles')), array('attributes' => array('lang' => 'no', 'section' => 'articles'), 'content' => array('lang' => 'no', 'section' => 'articles'))); foreach ($data as $id => $dataArr) { $cache->store($id, $dataArr['content'], $dataArr['attributes']); } $this->assertEquals($cache->countDataItems(0), 1, 'Count data items failed with ID.'); $this->assertEquals($cache->countDataItems(null, array('lang' => 'no')), 1, 'Count data items failed with attribute <lang>.'); $this->assertEquals($cache->countDataItems(null, array('section' => 'articles')), 3, 'Count data items failed with attribute <articles>.'); $this->removeTempDir(); }