/** * Loads expected data from test case annotations * * @see Mage_Test_Model_Test_Loadable_Interface::loadByTestCase() */ public function loadByTestCase(Mage_Test_Unit_Case $testCase) { $expectations = $testCase->getAnnotationByName('loadExpectation'); if (!$expectations) { $expectations[] = null; } $expectationData = array(); foreach ($expectations as $expectation) { if (empty($expectation)) { $expectation = null; } $expectationFile = $testCase->getYamlFilePath('expectations', $expectation); if (!$expectationFile) { $text = 'There was no expectation defined for current test case'; if ($expectation) { $text = sprintf('Cannot load expectation %s', $expectation); } throw new RuntimeException($text); } $expectationData = array_merge_recursive($expectationData, Spyc::YAMLLoad($expectationFile)); } $this->_loadedData = new Varien_Object($expectationData); return $this; }
/** * Loads fixture files from test case annotations * * @param Mage_Test_Unit_Case $testCase * @return Mage_Test_Model_Fixture */ public function loadByTestCase(Mage_Test_Unit_Case $testCase) { $fixtures = $testCase->getAnnotationByName('loadFixture', array('class', 'method')); $cacheOptions = $testCase->getAnnotationByName('cache', 'method'); $this->_parseCacheOptions($cacheOptions); $this->_loadFixtureFiles($fixtures, $testCase); return $this; }