Commit 4417a0e5 authored by Ivan Chepurnyi's avatar Ivan Chepurnyi

Merge pull request #9 from colinmollenhour/patch-6

Fix lots of minor bugs, vardocs and typos.
parents 9dec4527 777100eb
...@@ -154,7 +154,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App ...@@ -154,7 +154,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_events', new self::$_eventCollectionClass); EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_events', new self::$_eventCollectionClass);
EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_registry', array()); EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_registry', array());
// All unit tests will be runned in admin scope, to get rid of frontend restrictions // All unit tests will be run in admin scope, to get rid of frontend restrictions
Mage::app()->initTest(); Mage::app()->initTest();
} }
...@@ -192,7 +192,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App ...@@ -192,7 +192,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
// Clean cache before the whole suite is running // Clean cache before the whole suite is running
$this->getCache()->clean(); $this->getCache()->clean();
// Init modules runs install proccess for table structures, // Init modules runs install process for table structures,
// It is required for setting up proper setup script // It is required for setting up proper setup script
$this->_initModules(); $this->_initModules();
...@@ -366,7 +366,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App ...@@ -366,7 +366,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
/** /**
* Returns class name from configuration path, * Returns class name from configuration path,
* If $interface is specified, then it additionaly checks it for implementation * If $interface is specified, then it additionally checks it for implementation
* *
* *
* @param string $configPath * @param string $configPath
...@@ -508,7 +508,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App ...@@ -508,7 +508,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
/** /**
* Overriden for disabling events * Overriden for disabling events
* fire during fixutre loading * fire during fixture loading
* *
* (non-PHPdoc) * (non-PHPdoc)
* @see Mage_Core_Model_App::dispatchEvent() * @see Mage_Core_Model_App::dispatchEvent()
......
...@@ -30,6 +30,11 @@ class EcomDev_PHPUnit_Model_Design_Package ...@@ -30,6 +30,11 @@ class EcomDev_PHPUnit_Model_Design_Package
$this->setPackageName($designPackage); $this->setPackageName($designPackage);
$this->setTheme($theme); $this->setTheme($theme);
$params = array(
'_area' => $area,
'_package' => $designPackage,
'_theme' => $theme,
);
$actualFileName = $this->getLayoutFilename($fileName, $params); $actualFileName = $this->getLayoutFilename($fileName, $params);
if ($theme !== null || $designPackage !== null) { if ($theme !== null || $designPackage !== null) {
......
...@@ -308,7 +308,7 @@ class EcomDev_PHPUnit_Model_Fixture ...@@ -308,7 +308,7 @@ class EcomDev_PHPUnit_Model_Fixture
/** /**
* Loads fixture files * Loads fixture files
* *
* @param string $fixtures * @param array $fixtures
* @param string|EcomDev_PHPUnit_Test_Case $classOrInstance * @param string|EcomDev_PHPUnit_Test_Case $classOrInstance
* @return EcomDev_PHPUnit_Model_Fixture * @return EcomDev_PHPUnit_Model_Fixture
*/ */
...@@ -631,7 +631,7 @@ class EcomDev_PHPUnit_Model_Fixture ...@@ -631,7 +631,7 @@ class EcomDev_PHPUnit_Model_Fixture
/** /**
* Applies fixture EAV values * Applies fixture EAV values
* *
* @param array $configuration * @param array $entities
* @return EcomDev_PHPUnit_Model_Fixture * @return EcomDev_PHPUnit_Model_Fixture
*/ */
protected function _applyEav($entities) protected function _applyEav($entities)
...@@ -761,7 +761,6 @@ class EcomDev_PHPUnit_Model_Fixture ...@@ -761,7 +761,6 @@ class EcomDev_PHPUnit_Model_Fixture
* Validate scope data * Validate scope data
* *
* @param array $types * @param array $types
* @param array $modelByType
* @return EcomDev_PHPUnit_Model_Fixture * @return EcomDev_PHPUnit_Model_Fixture
*/ */
protected function _validateScope($types) protected function _validateScope($types)
...@@ -772,8 +771,6 @@ class EcomDev_PHPUnit_Model_Fixture ...@@ -772,8 +771,6 @@ class EcomDev_PHPUnit_Model_Fixture
} }
foreach ($rows as $rowNumber => $row) { foreach ($rows as $rowNumber => $row) {
$scopeModel = Mage::getModel($modelByType[$type]);
if (!isset($row[$type . '_id'])) { if (!isset($row[$type . '_id'])) {
throw new RuntimeException(sprintf('Missing primary key for "%s" scope entity at #%d row', $type, $rowNumber + 1)); throw new RuntimeException(sprintf('Missing primary key for "%s" scope entity at #%d row', $type, $rowNumber + 1));
} }
......
...@@ -37,7 +37,7 @@ interface EcomDev_PHPUnit_Model_Fixture_Interface extends EcomDev_PHPUnit_Model_ ...@@ -37,7 +37,7 @@ interface EcomDev_PHPUnit_Model_Fixture_Interface extends EcomDev_PHPUnit_Model_
public function setOptions(array $options); public function setOptions(array $options);
/** /**
* Sets storage for fixutures * Sets storage for fixtures
* *
* @param Varien_Object $storage * @param Varien_Object $storage
* @return EcomDev_PHPUnit_Model_Fixture_Interface * @return EcomDev_PHPUnit_Model_Fixture_Interface
......
...@@ -148,7 +148,7 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev ...@@ -148,7 +148,7 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
throw new RuntimeException('Entity Id should be specified in EAV fixture'); throw new RuntimeException('Entity Id should be specified in EAV fixture');
} }
// Fullfil neccessary information // Fulfill necessary information
$row['entity_type_id'] = $entityTypeModel->getEntityTypeId(); $row['entity_type_id'] = $entityTypeModel->getEntityTypeId();
if (!isset($row['attribute_set_id'])) { if (!isset($row['attribute_set_id'])) {
$row['attribute_set_id'] = $entityTypeModel->getDefaultAttributeSetId(); $row['attribute_set_id'] = $entityTypeModel->getDefaultAttributeSetId();
......
...@@ -31,7 +31,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Product extends EcomDev_P ...@@ -31,7 +31,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Product extends EcomDev_P
/** /**
* Ovveriden to fix issue with flat tables existance mark * Overridden to fix issue with flat tables existance mark
* (non-PHPdoc) * (non-PHPdoc)
* @see EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract::loadEntity() * @see EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract::loadEntity()
*/ */
...@@ -48,7 +48,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Product extends EcomDev_P ...@@ -48,7 +48,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Product extends EcomDev_P
} }
/** /**
* Overriden to add easy fixture loading for websites and categories associations * Overridden to add easy fixture loading for websites and categories associations
* (non-PHPdoc) * (non-PHPdoc)
* @see EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract::_getCustomTableRecords() * @see EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract::_getCustomTableRecords()
*/ */
......
...@@ -691,6 +691,7 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase ...@@ -691,6 +691,7 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
* *
* @param string $type * @param string $type
* @param string $configPath * @param string $configPath
* @return string
*/ */
protected static function getLoadableClassAlias($type, $configPath) protected static function getLoadableClassAlias($type, $configPath)
{ {
......
...@@ -40,6 +40,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -40,6 +40,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
* @param string $nodePath * @param string $nodePath
* @param string $type * @param string $type
* @param mixed $expectedValue * @param mixed $expectedValue
* @return EcomDev_PHPUnit_Constraint_Config
*/ */
public static function configNode($nodePath, $type, $expectedValue = null) public static function configNode($nodePath, $type, $expectedValue = null)
{ {
...@@ -54,6 +55,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -54,6 +55,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
* @param string $moduleName * @param string $moduleName
* @param string $type * @param string $type
* @param string|null $expectedValue * @param string|null $expectedValue
* @return EcomDev_PHPUnit_Constraint_Config
*/ */
public static function configModule($moduleName, $type, $expectedValue = null) public static function configModule($moduleName, $type, $expectedValue = null)
{ {
...@@ -65,9 +67,11 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -65,9 +67,11 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
/** /**
* A new constraint for checking module node * A new constraint for checking module node
* *
* @param string $moduleName * @param string $group
* @param string $classAlias
* @param string $expectedClassName
* @param string $type * @param string $type
* @param string|null $expectedValue * @return EcomDev_PHPUnit_Constraint_Config
*/ */
public static function configClassAlias($group, $classAlias, $expectedClassName, public static function configClassAlias($group, $classAlias, $expectedClassName,
$type = EcomDev_PHPUnit_Constraint_Config_ClassAlias::TYPE_CLASS_ALIAS) $type = EcomDev_PHPUnit_Constraint_Config_ClassAlias::TYPE_CLASS_ALIAS)
...@@ -86,6 +90,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -86,6 +90,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
* @param string|null $layoutUpdate * @param string|null $layoutUpdate
* @param string|null $theme * @param string|null $theme
* @param string|null $designPackage * @param string|null $designPackage
* @return EcomDev_PHPUnit_Constraint_Config
*/ */
public static function configLayout($area, $expectedFile, $type, $layoutUpdate = null, $theme = null, $designPackage = null) public static function configLayout($area, $expectedFile, $type, $layoutUpdate = null, $theme = null, $designPackage = null)
{ {
...@@ -106,7 +111,9 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -106,7 +111,9 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
* @param string $eventName * @param string $eventName
* @param string $observerClassAlias * @param string $observerClassAlias
* @param string $observerMethod * @param string $observerMethod
* @param string $type
* @param string|null $observerName * @param string|null $observerName
* @return EcomDev_PHPUnit_Constraint_Config
*/ */
public static function configEventObserver($area, $eventName, $observerClassAlias, $observerMethod, public static function configEventObserver($area, $eventName, $observerClassAlias, $observerMethod,
$type = EcomDev_PHPUnit_Constraint_Config_EventObserver::TYPE_DEFINDED, $observerName = null) $type = EcomDev_PHPUnit_Constraint_Config_EventObserver::TYPE_DEFINDED, $observerName = null)
...@@ -304,6 +311,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -304,6 +311,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
* *
* @param string $nodePath * @param string $nodePath
* @param decimal $expectedValue * @param decimal $expectedValue
* @param string $message
*/ */
public static function assertConfigNodeLessThanOrEquals($nodePath, $expectedValue, $message = '') public static function assertConfigNodeLessThanOrEquals($nodePath, $expectedValue, $message = '')
{ {
...@@ -344,6 +352,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -344,6 +352,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
* *
* @param string $nodePath * @param string $nodePath
* @param decimal $expectedValue * @param decimal $expectedValue
* @param string $message
*/ */
public static function assertConfigNodeGreaterThanOrEquals($nodePath, $expectedValue, $message = '') public static function assertConfigNodeGreaterThanOrEquals($nodePath, $expectedValue, $message = '')
{ {
...@@ -640,6 +649,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -640,6 +649,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
* @param string $group * @param string $group
* @param string $classAlias * @param string $classAlias
* @param string $expectedClassName * @param string $expectedClassName
* @param string $message
*/ */
public static function assertGroupedClassAlias($group, $classAlias, $expectedClassName, $message = '') public static function assertGroupedClassAlias($group, $classAlias, $expectedClassName, $message = '')
{ {
...@@ -655,6 +665,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -655,6 +665,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
* @param string $group * @param string $group
* @param string $classAlias * @param string $classAlias
* @param string $expectedClassName * @param string $expectedClassName
* @param string $message
*/ */
public static function assertGroupedClassAliasNot($group, $classAlias, $expectedClassName, $message = '') public static function assertGroupedClassAliasNot($group, $classAlias, $expectedClassName, $message = '')
{ {
...@@ -678,7 +689,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -678,7 +689,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
self::assertGroupedClassAlias( self::assertGroupedClassAlias(
EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_BLOCK, EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_BLOCK,
$classAlias, $classAlias,
$expectedClassName $expectedClassName,
$message
); );
} }
...@@ -694,7 +706,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -694,7 +706,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
self::assertGroupedClassAliasNot( self::assertGroupedClassAliasNot(
EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_BLOCK, EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_BLOCK,
$classAlias, $classAlias,
$expectedClassName $expectedClassName,
$message
); );
} }
...@@ -710,7 +723,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -710,7 +723,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
self::assertGroupedClassAlias( self::assertGroupedClassAlias(
EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_MODEL, EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_MODEL,
$classAlias, $classAlias,
$expectedClassName $expectedClassName,
$message
); );
} }
...@@ -726,7 +740,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -726,7 +740,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
self::assertGroupedClassAliasNot( self::assertGroupedClassAliasNot(
EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_MODEL, EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_MODEL,
$classAlias, $classAlias,
$expectedClassName $expectedClassName,
$message
); );
} }
...@@ -744,7 +759,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -744,7 +759,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
self::assertGroupedClassAlias( self::assertGroupedClassAlias(
EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_MODEL, EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_MODEL,
$classAlias, $classAlias,
$expectedClassName $expectedClassName,
$message
); );
} }
...@@ -762,7 +778,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -762,7 +778,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
self::assertGroupedClassAliasNot( self::assertGroupedClassAliasNot(
EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_MODEL, EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_MODEL,
$classAlias, $classAlias,
$expectedClassName $expectedClassName,
$message
); );
} }
...@@ -778,7 +795,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -778,7 +795,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
self::assertGroupedClassAlias( self::assertGroupedClassAlias(
EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_HELPER, EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_HELPER,
$classAlias, $classAlias,
$expectedClassName $expectedClassName,
$message
); );
} }
...@@ -794,7 +812,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas ...@@ -794,7 +812,8 @@ abstract class EcomDev_PHPUnit_Test_Case_Config extends EcomDev_PHPUnit_Test_Cas
self::assertGroupedClassAliasNot( self::assertGroupedClassAliasNot(
EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_HELPER, EcomDev_PHPUnit_Constraint_Config_ClassAlias::GROUP_HELPER,
$classAlias, $classAlias,
$expectedClassName $expectedClassName,
$message
); );
} }
......
...@@ -431,7 +431,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Controller extends EcomDev_PHPUnit_Test ...@@ -431,7 +431,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Controller extends EcomDev_PHPUnit_Test
{ {
self::assertRequestNot( self::assertRequestNot(
EcomDev_PHPUnit_Constraint_Controller_Request::TYPE_BEFORE_FORWARD_ROUTE, EcomDev_PHPUnit_Constraint_Controller_Request::TYPE_BEFORE_FORWARD_ROUTE,
$expectedActionName, $message $expectedBeforeForwardedRoute, $message
); );
} }
......
...@@ -38,7 +38,6 @@ class EcomDev_PHPUnit_Test_Suite_Group extends PHPUnit_Framework_TestSuite ...@@ -38,7 +38,6 @@ class EcomDev_PHPUnit_Test_Suite_Group extends PHPUnit_Framework_TestSuite
* *
* (non-PHPdoc) * (non-PHPdoc)
* @see PHPUnit_Framework_TestSuite::__construct() * @see PHPUnit_Framework_TestSuite::__construct()
* @param array $groups
*/ */
public function __construct($theClass = '', $groups = array()) public function __construct($theClass = '', $groups = array())
{ {
......
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