public function testFetchColWithEmptyTable()
 {
     $table = new \ReflectionProperty('Database\\AbstractTable', 'table');
     $table->setAccessible(true);
     $table->setValue($this->_table, 'test2');
     $this->_table->initialize();
     $this->assertSame(array(), $this->_table->fetchCol('col1'));
 }
Example #2
0
 /** {@inheritdoc} */
 public function initialize()
 {
     $this->_hydrator = new \Zend\Stdlib\Hydrator\ArraySerializable();
     $this->_hydrator->setNamingStrategy(new \Database\Hydrator\NamingStrategy\MapNamingStrategy(array('id' => 'Id', 'name' => 'Name', 'description' => 'Description', 'lastdate' => 'CreationDate', 'request' => 'DynamicMembersSql', 'create_time' => 'CacheCreationDate', 'revalidate_from' => 'CacheExpirationDate')));
     $dateTimeFormatter = new \Zend\Stdlib\Hydrator\Strategy\DateTimeFormatterStrategy($this->_serviceLocator->get('Database\\Nada')->timestampFormatPhp());
     $this->_hydrator->addStrategy('CreationDate', $dateTimeFormatter);
     $this->_hydrator->addStrategy('lastdate', $dateTimeFormatter);
     $cacheCreationDateStrategy = new \Database\Hydrator\Strategy\Groups\CacheDate();
     $this->_hydrator->addStrategy('CacheCreationDate', $cacheCreationDateStrategy);
     $this->_hydrator->addStrategy('create_time', $cacheCreationDateStrategy);
     $cacheExpirationDateStrategy = new \Database\Hydrator\Strategy\Groups\CacheDate($this->_serviceLocator->get('Model\\Config')->groupCacheExpirationInterval);
     $this->_hydrator->addStrategy('CacheExpirationDate', $cacheExpirationDateStrategy);
     $this->_hydrator->addStrategy('revalidate_from', $cacheExpirationDateStrategy);
     $this->resultSetPrototype = new \Zend\Db\ResultSet\HydratingResultSet($this->_hydrator, $this->_serviceLocator->get('Model\\Group\\Group'));
     return parent::initialize();
 }
Example #3
0
 /**
  * {@inheritdoc}
  * @codeCoverageIgnore
  */
 public function initialize()
 {
     $this->_hydrator = new \Database\Hydrator\Clients($this->_serviceLocator);
     $this->resultSetPrototype = new \Zend\Db\ResultSet\HydratingResultSet($this->_hydrator, $this->_serviceLocator->get('Model\\Client\\Client'));
     return parent::initialize();
 }