示例#1
0
 /**
  * Constraint for evaluation of module config node
  *
  * @param string $moduleName
  * @param string $type
  * @param mixed $expectedValue
  * @internal param string $nodePath
  */
 public function __construct($moduleName, $type, $expectedValue)
 {
     $this->_expectedValueValidation += array(self::TYPE_CODE_POOL => array(true, 'is_string', 'string'), self::TYPE_DEPENDS => array(true, 'is_string', 'string'), self::TYPE_EQUALS_VERSION => array(true, 'is_string', 'string'), self::TYPE_LESS_THAN_VERSION => array(true, 'is_string', 'string'), self::TYPE_GREATER_THAN_VERSION => array(true, 'is_string', 'string'));
     $this->_typesWithDiff[] = self::TYPE_CODE_POOL;
     $this->_typesWithDiff[] = self::TYPE_EQUALS_VERSION;
     $this->_typesWithDiff[] = self::TYPE_LESS_THAN_VERSION;
     $this->_typesWithDiff[] = self::TYPE_GREATER_THAN_VERSION;
     parent::__construct(sprintf(self::XML_PATH_MODULE_NODE, $moduleName), $type, $expectedValue);
     $this->_moduleName = $moduleName;
 }
 /**
  * Constraint for evaluation of table alias
  *
  * @param string $tableAlias
  * @param string $expectedTableName
  * @param string $type
  * @throws PHPUnit_Framework_Exception
  */
 public function __construct($tableAlias, $expectedTableName, $type = self::TYPE_TABLE_ALIAS)
 {
     if (!strpos($tableAlias, '/')) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'table alias', $tableAlias);
     }
     list($this->_tableAliasPrefix, $this->_tableAliasName) = explode('/', $tableAlias, 2);
     $this->_expectedValueValidation += array(self::TYPE_TABLE_ALIAS => array(true, 'is_string', 'string'));
     $this->_typesWithDiff[] = self::TYPE_TABLE_ALIAS;
     parent::__construct(self::XML_PATH_MODELS, $type, $expectedTableName);
 }
示例#3
0
 /**
  * Contraint for evaluation of config node
  *
  * @param string $nodePath
  * @param string $type
  * @param mixed $expectedValue
  */
 public function __construct($nodePath, $type, $expectedValue = null)
 {
     $this->_expectedValueValidation += array(self::TYPE_EQUALS_STRING => array(true, 'is_scalar', 'scalar'), self::TYPE_EQUALS_NUMBER => array(true, 'is_numeric', 'numeric'), self::TYPE_LESS_THAN => array(true, 'is_numeric', 'numeric'), self::TYPE_GREATER_THAN => array(true, 'is_numeric', 'numeric'), self::TYPE_CONTAIN_VALUE => array(true, 'is_scalar', 'scalar'), self::TYPE_HAS_CHILD => array(true, 'is_string', 'string'));
     $this->_typesWithDiff[] = self::TYPE_EQUALS_STRING;
     $this->_typesWithDiff[] = self::TYPE_EQUALS_BOOLEAN;
     $this->_typesWithDiff[] = self::TYPE_EQUALS_XML;
     $this->_typesWithDiff[] = self::TYPE_EQUALS_NUMBER;
     $this->_typesWithDiff[] = self::TYPE_LESS_THAN;
     $this->_typesWithDiff[] = self::TYPE_GREATER_THAN;
     parent::__construct($nodePath, $type, $expectedValue);
 }
示例#4
0
 /**
  * Constraint for evaluation of module config node
  *
  * @param string $area
  * @param string $route
  * @param string $type
  * @param mixed $expectedValue
  */
 public function __construct($area, $route, $type, $expectedValue)
 {
     $this->_area = $area;
     $this->_routeName = $route;
     $this->_expectedValueValidation += array(self::TYPE_MODULE => array(true, 'is_string', 'string'), self::TYPE_MODULE_ORDER => array(true, 'is_array', 'array'), self::TYPE_ROUTER => array(true, 'is_string', 'string'), self::TYPE_FRONT_NAME => array(true, 'is_string', 'string'));
     $this->_typesWithDiff[] = self::TYPE_MODULE;
     $this->_typesWithDiff[] = self::TYPE_MODULE_ORDER;
     $this->_typesWithDiff[] = self::TYPE_FRONT_NAME;
     $this->_typesWithDiff[] = self::TYPE_ROUTER;
     parent::__construct(sprintf(self::XML_PATH_ROUTE_NODE, $this->_area, $this->_routeName), $type, $expectedValue);
 }
示例#5
0
 /**
  * Configuration constraint for cheking the existance of
  * layout file in configuration and a particular theme as well
  *
  * @param string $area design area (frontend|adminhtml)
  * @param string $expectedFile layout file name that should be checked
  * @param string $type type of assertion
  * @param string|null $layoutUpdate additional check for layout update name for assertion of configuration
  * @param string|null $theme additional check for layout file existance in a particular theme
  * @param string|null $designPackage additional check for layout file existance in a particular theme
  */
 public function __construct($area, $expectedFile, $type, $layoutUpdate = null, $theme = null, $designPackage = null)
 {
     $this->_area = $area;
     $this->_layoutUpdate = $layoutUpdate;
     $this->_designPackage = $designPackage;
     $this->_theme = $theme;
     $this->_expectedValueValidation += array(self::TYPE_LAYOUT_FILE => array(true, 'is_string', 'string'), self::TYPE_LAYOUT_DEFINITION => array(true, 'is_string', 'string'));
     $this->_typesWithDiff[] = self::TYPE_LAYOUT_FILE;
     $this->_typesWithDiff[] = self::TYPE_LAYOUT_DEFINITION;
     $nodePath = sprintf(self::XML_PATH_LAYOUT, $area);
     parent::__construct($nodePath, $type, $expectedFile);
 }
示例#6
0
 /**
  * Constraint for evaluation of module config node
  *
  * @param string $moduleName
  * @param string $type
  * @param string $moduleDirectory
  * @param null|string $resourceName
  * @param null|string $expectedVersions
  * @throws PHPUnit_Framework_Exception
  * @internal param string $nodePath
  * @internal param mixed $expectedValue
  */
 public function __construct($moduleName, $type, $moduleDirectory, $resourceName = null, $expectedVersions = null)
 {
     $this->_typesWithDiff[] = self::TYPE_SCRIPT_SCHEME;
     $this->_typesWithDiff[] = self::TYPE_SCRIPT_DATA;
     parent::__construct(self::XML_PATH_RESOURCES_NODE, $type, $expectedVersions);
     $this->_moduleName = $moduleName;
     $this->_moduleDirectory = $moduleDirectory;
     $this->_resourceName = $resourceName;
     if (!is_dir($moduleDirectory)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'real directory', $moduleDirectory);
     }
 }
示例#7
0
 /**
  * Constraint for evaluation of module config node
  *
  * @param string $moduleName
  * @param string $type
  * @param string $moduleDirectory
  * @param mixed $expectedValue
  * @throws PHPUnit_Framework_Exception
  * @internal param string $nodePath
  */
 public function __construct($moduleName, $type, $moduleDirectory = null, $expectedValue = null)
 {
     $this->_expectedValueValidation += array(self::TYPE_SETUP_DEFINED => array(false, 'is_string', 'string'), self::TYPE_SETUP_SCHEME_EXISTS => array(false, 'is_string', 'string'), self::TYPE_SETUP_DATA_EXISTS => array(false, 'is_string', 'string'));
     $this->_typesWithDiff[] = self::TYPE_SETUP_DEFINED;
     $this->_typesWithDiff[] = self::TYPE_SETUP_SCHEME_EXISTS;
     $this->_typesWithDiff[] = self::TYPE_SETUP_DATA_EXISTS;
     parent::__construct(self::XML_PATH_RESOURCES_NODE, $type, $expectedValue);
     $this->_moduleName = $moduleName;
     $this->_moduleDirectory = $moduleDirectory;
     if (($this->_type === self::TYPE_SETUP_SCHEME_EXISTS || $this->_type === self::TYPE_SETUP_DATA_EXISTS) && !is_dir($moduleDirectory)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'real directory', $moduleDirectory);
     }
 }
 /**
  * Constraint for evaluation of grouped class alias (block, model, helper)
  *
  * @param string $group
  * @param string $classAlias
  * @param string $expectedClassName
  * @param string $type
  * @throws PHPUnit_Framework_Exception
  */
 public function __construct($group, $classAlias, $expectedClassName, $type = self::TYPE_CLASS_ALIAS)
 {
     if (!isset($this->_textByGroup[$group])) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(1, implode('|', array_keys($this->_textByGroup)), $group);
     }
     $this->_group = $group;
     if ($group === self::GROUP_HELPER && strpos($classAlias, '/') === false) {
         $classAlias .= '/data';
     }
     if (!strpos($classAlias, '/')) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'class/alias', $classAlias);
     }
     list($this->_classAliasPrefix, $this->_classAliasName) = explode('/', $classAlias, 2);
     $nodePath = sprintf(self::XML_PATH_CLASS_ALIAS, $group, $this->_classAliasPrefix);
     $this->_expectedValueValidation += array(self::TYPE_CLASS_ALIAS => array(true, 'is_string', 'string'));
     $this->_typesWithDiff[] = self::TYPE_CLASS_ALIAS;
     parent::__construct($nodePath, $type, $expectedClassName);
 }