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 7db1bed0 authored by Ivan Chepurnyi's avatar Ivan Chepurnyi

Merge pull request #197 from fooman/load-shared-class-fixtures-before-methods2

Load shared class fixtures before methods
parents c6a03a8d 0f1e60a6
......@@ -301,7 +301,7 @@ class EcomDev_PHPUnit_Model_Fixture
public function loadByTestCase(PHPUnit_Framework_TestCase $testCase)
{
$fixtures = EcomDev_PHPUnit_Test_Case_Util::getAnnotationByNameFromClass(
get_class($testCase), 'loadFixture', array('class', 'method'), $testCase->getName(false)
get_class($testCase), 'loadFixture', array('method', 'class'), $testCase->getName(false)
);
$this->_loadFixtureFiles($fixtures, $testCase);
......
<?php
/**
* @loadSharedFixture testFixtureArrayMerge.yaml
*/
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'));
......@@ -17,6 +16,18 @@ class EcomDev_PHPUnitTest_Test_Model_Fixture extends EcomDev_PHPUnit_Test_Case
$this->getFixture()->apply();
}
public function testLoadClassBeforeMethodFixtures()
{
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();
$this->assertEquals('methodFixtureValue', Mage::getStoreConfig('sample/path'));
}
protected function _getVfsUrl($path)
{
return $this->getFixture()->getVfs()->url($path);
......
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