We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

Commit 316fd3e3 authored by Mike Pretzlaw's avatar Mike Pretzlaw

Container will flush an restore each fixture loader

parent be87c2f4
......@@ -61,4 +61,32 @@ class EcomDev_PHPUnit_Model_Fixture_Loader_Container
{
return isset($this->_loaders[$code]);
}
/**
* Flush all loader in this container.
*
* @return void
*/
public function flush()
{
foreach ($this->_loaders as $loader)
{
$loader->flush();
}
}
/**
* Restore all loader in this container.
*
* @return void
*/
public function restore()
{
foreach ($this->_loaders as $loader)
{
$loader->restore();
}
}
}
......@@ -79,6 +79,45 @@ class EcomDev_PHPUnitTest_Test_Model_Fixture_Loader_Container
);
}
/**
* Check if the methods are forwarded by the collection to it's elements.
*
* @dataProvider getMethods
*
* @param string $methodName
* @param array $args []
*
* @return void
*/
public function testFlushAndRestoreWillBeForwardedToEachLoader($methodName, $args)
{
$loaderSet = $this->_stubLoaders(2);
foreach ($loaderSet as $loader)
{
/** @var PHPUnit_Framework_MockObject_MockObject $loader */
$loader->expects($this->exactly(1))->method($methodName);
}
$this->_factory->$methodName();
}
/**
* Data provider for methods to check forwarding with.
*
* @see testFlushAndRestoreWillBeForwardedToEachLoader
*
* @return array
*/
public function getMethods()
{
return array(
array('flush', array()),
array('restore', array()),
);
}
/**
* Generates loaders for tests
*
......
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