Commit 02690886 authored by Mike Pretzlaw's avatar Mike Pretzlaw

Database Loader Stub and lazy loading in Db_Info

parent 871fb939
<?php
class EcomDev_PHPUnit_Model_Fixture_Loader_Database implements
EcomDev_PHPUnit_Model_Fixture_LoaderInterface
{
/**
* Flushes the data that was added before loading
*
* @return mixed
*/
public function flush()
{
// TODO: Implement flush() method.
}
/**
* This one should realize possibility to merge data with existing Magento data
*
* @param $data
*
* @return mixed
*/
public function merge($data)
{
// TODO: Implement merge() method.
}
/**
* Overrides the data in the system for specified data
*
* It should realize default functionality
* for a default fixture processors
*
* @param array $data
*
* @return $this
* @throws InvalidArgumentException
*/
public function override($data)
{
// TODO: Implement override() method.
}
/**
* Restores original data, that was modified by fixture flushing
*
* @return mixed
*/
public function restore()
{
// TODO: Implement restore() method.
}
}
...@@ -16,8 +16,9 @@ class EcomDev_PHPUnit_Model_Mysql4_Db_Info implements EcomDev_PHPUnit_Model_Mysq ...@@ -16,8 +16,9 @@ class EcomDev_PHPUnit_Model_Mysql4_Db_Info implements EcomDev_PHPUnit_Model_Mysq
*/ */
public function fetch() public function fetch()
{ {
// reset information if ($this->_information !== null) {
$this->reset(); return $this;
}
// iterate over each available table // iterate over each available table
$listTables = $this->getAdapter()->listTables(); $listTables = $this->getAdapter()->listTables();
...@@ -42,6 +43,8 @@ class EcomDev_PHPUnit_Model_Mysql4_Db_Info implements EcomDev_PHPUnit_Model_Mysq ...@@ -42,6 +43,8 @@ class EcomDev_PHPUnit_Model_Mysql4_Db_Info implements EcomDev_PHPUnit_Model_Mysq
$this->_information[$tableName] = $data; $this->_information[$tableName] = $data;
} }
return $this;
} }
...@@ -65,6 +68,8 @@ class EcomDev_PHPUnit_Model_Mysql4_Db_Info implements EcomDev_PHPUnit_Model_Mysq ...@@ -65,6 +68,8 @@ class EcomDev_PHPUnit_Model_Mysql4_Db_Info implements EcomDev_PHPUnit_Model_Mysq
*/ */
public function getTableDependencies($tableName) public function getTableDependencies($tableName)
{ {
$this->fetch();
if (isset($this->_information[$tableName]) if (isset($this->_information[$tableName])
&& $this->_information[$tableName] instanceof Varien_Object && $this->_information[$tableName] instanceof Varien_Object
) )
...@@ -83,7 +88,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Db_Info implements EcomDev_PHPUnit_Model_Mysq ...@@ -83,7 +88,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Db_Info implements EcomDev_PHPUnit_Model_Mysq
*/ */
public function reset() public function reset()
{ {
$this->_information = array(); $this->_information = null;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment