Commit c6a03a8d authored by Ivan Chepurnyi's avatar Ivan Chepurnyi

Merge pull request #196 from fooman/fixture-array-merge

Fixture array merge
parents f277572c 66959262
......@@ -412,7 +412,7 @@ class EcomDev_PHPUnit_Model_Fixture
if (empty($this->_fixture)) {
$this->_fixture = $data;
} else {
$this->_fixture = array_merge_recursive($this->_fixture, $data);
$this->_fixture = array_replace_recursive($this->_fixture, $data);
}
return $this;
......
<?php
class EcomDev_PHPUnitTest_Test_Model_Fixture extends EcomDev_PHPUnit_Test_Case
{
/**
* @loadFixture testFixtureArrayMerge.yaml
*/
public function testFixtureArrayMerge()
{
require_once($this->_getVfsUrl('app/code/community/EcomDev/PHPUnit/Test/Model/ExampleClass.php'));
$testCase = new EcomDev_PHPUnitTest_Test_Model_ExampleClass();
$testCase->setName('testLoadFixtureOrder');
$this->getFixture()->loadForClass(get_class($testCase));
$this->getFixture()->loadByTestCase($testCase);
$this->getFixture()->apply();
}
protected function _getVfsUrl($path)
{
return $this->getFixture()->getVfs()->url($path);
}
}
vfs:
app:
code:
community:
EcomDev:
PHPUnit:
Test:
Model:
ExampleClass.php: |
<?php
/**
* @loadSharedFixture sharedClassFixture.yaml
* @loadFixture classFixture.yaml
*/
class EcomDev_PHPUnitTest_Test_Model_ExampleClass extends EcomDev_PHPUnit_Test_Case
{
/**
* @loadSharedFixture sharedMethodFixture.yaml
* @loadFixture methodFixture.yaml
*/
public function testLoadFixtureOrder()
{
}
}
fixtures:
classFixture.yaml: >
config:
default/sample/path: classFixtureValue
sharedClassFixture.yaml: >
config:
default/sample/path: sharedClassFixtureValue
sharedMethodFixture.yaml: >
config:
default/sample/path: sharedMethodFixtureValue
methodFixture.yaml: >
config:
default/sample/path: methodFixtureValue
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