protected function setUp() { $options = array(); $options['area'] = current(TestUtil::getAnnotationByNameFromClass(__CLASS__, 'area', 'method', $this->getName(false))); $options['package'] = current(TestUtil::getAnnotationByNameFromClass(__CLASS__, 'package', 'method', $this->getName(false))); $options['theme'] = current(TestUtil::getAnnotationByNameFromClass(__CLASS__, 'theme', 'method', $this->getName(false))); $options['store_id'] = current(TestUtil::getAnnotationByNameFromClass(__CLASS__, 'storeId', 'method', $this->getName(false))); $this->source = new EcomDev_LayoutCompiler_Model_Layout_Source_Database($options); }
/** * Loads expected data from test case annotations * * @see EcomDev_PHPUnit_Model_Test_LoadableInterface::loadByTestCase() */ public function loadByTestCase(PHPUnit_Framework_TestCase $testCase) { $expectations = EcomDev_PHPUnit_Test_Case_Util::getAnnotationByNameFromClass(get_class($testCase), 'loadExpectation', array('class', 'method'), $testCase->getName(false)); if (!$expectations) { $expectations[] = $testCase->getName(false); } $expectationData = array(); foreach ($expectations as $expectation) { if (empty($expectation)) { $expectation = $testCase->getName(false); } $expectationFile = EcomDev_PHPUnit_Test_Case_Util::getYamlLoader(get_class($testCase))->resolveFilePath(get_class($testCase), EcomDev_PHPUnit_Model_Yaml_Loader::TYPE_EXPECTATION, $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, EcomDev_PHPUnit_Test_Case_Util::getYamlLoader()->load($expectationFile)); } $this->_loadedData = new Varien_Object($expectationData); return $this; }
/** * Loads fixture files from test class annotations * * @param string $className * @return EcomDev_PHPUnit_Model_Fixture */ public function loadForClass($className) { $fixtures = EcomDev_PHPUnit_Test_Case_Util::getAnnotationByNameFromClass($className, 'loadSharedFixture', 'class'); $this->_loadFixtureFiles($fixtures, $className); return $this; }
protected function setUp() { $className = current(EcomDev_PHPUnit_Test_Case_Util::getAnnotationByNameFromClass(__CLASS__, 'className', 'method', $this->getName(false))); $this->parser = new EcomDev_LayoutCompiler_Model_Compiler_Parser_Action($className); }
/** * Retrieves annotation by its name from different sources (class, method) based on meta information * * @param string $className * @param string $name annotation name * @param array|string $sources * @param string $testName test method name * @return array * @deprecated since 0.3.0 */ public static function getAnnotationByNameFromClass($className, $name, $sources = 'class', $testName = '') { return TestUtil::getAnnotationByNameFromClass($className, $name, $sources, $testName); }