/** * Constraint constructor * * @param string $nodePath * @param string $type * @param mixed $expectedValue * @throws PHPUnit_Framework_Exception */ public function __construct($nodePath, $type, $expectedValue = null) { if (empty($nodePath) || !is_string($nodePath)) { throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string', $type); } $this->_nodePath = $nodePath; parent::__construct($type, $expectedValue); }
/** * Constraint for checking JSON values * * * @param string $type * @param array $expectedValue expected json in array format * @param string $matchType */ public function __construct($type, $expectedValue = null, $matchType = self::MATCH_AND) { if ($expectedValue !== null && (empty($matchType) || !is_string($matchType))) { PHPUnit_Util_InvalidArgumentHelper::factory(3, 'string', $matchType); } $this->_expectedValueValidation += array(self::TYPE_MATCH => array(true, 'is_array', 'array')); $this->_typesWithDiff[] = self::TYPE_MATCH; parent::__construct($type, $expectedValue); $this->_matchType = $matchType; }
/** * Constraint for controller request assetions * * * @param string $type * @param string|null $expectedValue */ public function __construct($type, $expectedValue = null) { $this->_expectedValueValidation += array(self::TYPE_ROUTE => array(true, 'is_string', 'string'), self::TYPE_ROUTE_NAME => array(true, 'is_string', 'string'), self::TYPE_CONTROLLER_NAME => array(true, 'is_string', 'string'), self::TYPE_CONTROLLER_MODULE => array(true, 'is_string', 'string'), self::TYPE_ACTION_NAME => array(true, 'is_string', 'string'), self::TYPE_BEFORE_FORWARD_ROUTE => array(true, 'is_string', 'string')); $this->_typesWithDiff[] = self::TYPE_ROUTE; $this->_typesWithDiff[] = self::TYPE_ROUTE_NAME; $this->_typesWithDiff[] = self::TYPE_CONTROLLER_NAME; $this->_typesWithDiff[] = self::TYPE_CONTROLLER_MODULE; $this->_typesWithDiff[] = self::TYPE_ACTION_NAME; $this->_typesWithDiff[] = self::TYPE_BEFORE_FORWARD_ROUTE; parent::__construct($type, $expectedValue); }