Ejemplo n.º 1
0
 /**
  * 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;
 }