/** * Block property constraint * * @return boolean */ public function __construct($blockName, $propertyName, PHPUnit_Framework_Constraint $constraint, $type = self::TYPE_CONSTRAINT) { if (empty($blockName) || !is_string($blockName)) { throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string', $blockName); } if (empty($propertyName) || !is_string($propertyName)) { throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'string', $propertyName); } parent::__construct($type, $constraint); $this->_blockName = $blockName; $this->_propertyName = $propertyName; }
/** * Layout handle constraint * * @param string $handle layout handle name * @param string $type * @param string|null $position layout handle position */ public function __construct($handle, $type, $position = null) { if ($position !== null && !is_string($position)) { throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'string', $position); } $this->_position = $position; $this->_handle = $handle; $this->_expectedValueValidation += array(self::TYPE_LOADED => array(true, 'is_string', 'string'), self::TYPE_LOADED_AFTER => array(true, 'is_string', 'string'), self::TYPE_LOADED_BEFORE => array(true, 'is_string', 'string')); $this->_typesWithDiff[] = self::TYPE_LOADED; $this->_typesWithDiff[] = self::TYPE_LOADED_AFTER; $this->_typesWithDiff[] = self::TYPE_LOADED_BEFORE; parent::__construct($type, $this->_handle); }
/** * Constaint related to main layout block functionality * * @param string $blockName * @param string $type * @param string|null $expectedValue */ public function __construct($blockName, $type, $expectedValue = null) { if (empty($blockName) || !is_string($blockName)) { throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string', $blockName); } $this->_blockName = $blockName; $this->_expectedValueValidation += array(self::TYPE_TYPE => array(true, 'is_string', 'string'), self::TYPE_INSTANCE_OF => array(true, 'is_string', 'string'), self::TYPE_AFTER => array(true, 'is_string', 'string'), self::TYPE_BEFORE => array(true, 'is_string', 'string'), self::TYPE_PARENT_NAME => array(true, 'is_string', 'string'), self::TYPE_RENDERED_CONTENT => array(true)); $this->_typesWithDiff[] = self::TYPE_TYPE; $this->_typesWithDiff[] = self::TYPE_AFTER; $this->_typesWithDiff[] = self::TYPE_BEFORE; $this->_typesWithDiff[] = self::TYPE_PARENT_NAME; parent::__construct($type, $expectedValue); }
/** * Constaint related to main layout block action calls functionality * * @param string $blockName * @param string $method * @param string $type * @param int|null $invocationCount * @param array|null $parameters * @param string $searchType */ public function __construct($blockName, $method, $type, $invocationCount = null, array $arguments = null, $searchType = self::SEARCH_TYPE_AND) { if (empty($blockName) || !is_string($blockName)) { PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string', $blockName); } if (empty($method) || !is_string($method)) { throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'string', $method); } if (!is_string($searchType)) { throw PHPUnit_Util_InvalidArgumentHelper::factory(6, 'string', $searchType); } $this->_expectedValueValidation += array(self::TYPE_INVOKED_AT_LEAST => array(true, 'is_int', 'integer'), self::TYPE_INVOKED_EXACTLY => array(true, 'is_int', 'integer')); parent::__construct($type, $invocationCount); $this->_blockName = $blockName; $this->_method = $method; $this->_target = sprintf('%s::%s', $this->_blockName, $this->_method); $this->_arguments = $arguments; }
/** * Constraint for main layout functions * * @param string $type */ public function __construct($type = self::TYPE_LOADED) { parent::__construct($type); }