当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Util_InvalidArgumentHelper类代码示例

本文整理汇总了PHP中PHPUnit_Util_InvalidArgumentHelper的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_InvalidArgumentHelper类的具体用法?PHP PHPUnit_Util_InvalidArgumentHelper怎么用?PHP PHPUnit_Util_InvalidArgumentHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PHPUnit_Util_InvalidArgumentHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: extendsOrImplements

 /**
  * Creates and returns an ExtendsOrImplements constraint.
  *
  * @param string[] $parentsAndInterfaces
  *
  * @return ExtendsOrImplements
  * @throws \PHPUnit_Framework_Exception
  */
 public static function extendsOrImplements($parentsAndInterfaces)
 {
     if (!is_array($parentsAndInterfaces)) {
         throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'array or ArrayAccess');
     }
     return new ExtendsOrImplements($parentsAndInterfaces);
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:15,代码来源:AssertInheritanceTrait.php

示例2: __construct

 /**
  * @param  array|ArrayAccess           $value
  * @throws PHPUnit_Framework_Exception
  */
 public function __construct($value)
 {
     if (!(is_array($value) || $value instanceof ArrayAccess)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'array or ArrayAccess');
     }
     $this->value = $value;
 }
开发者ID:blast007,项目名称:bzion,代码行数:11,代码来源:ArraysHaveEqualValuesConstraint.php

示例3: evaluate

 /**
  * @param \PHP\Manipulator\Tokenfinder\Result $other
  * @param  string $description Additional information about the test
  * @param  bool $returnResult Whether to return a result or throw an exception
  * @return boolean
  */
 public function evaluate($other, $description = '', $returnResult = FALSE)
 {
     if (!$other instanceof Result) {
         throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'PHP\\Manipulator\\Tokenfinder\\Result');
     }
     $expectedResultTokens = $this->_expectedResult->getTokens();
     $actualResultTokens = $other->getTokens();
     if (count($expectedResultTokens) != count($actualResultTokens)) {
         $this->_cause = 'length';
         if ($returnResult) {
             return FALSE;
         }
         $this->fail($other, $description);
     }
     foreach ($expectedResultTokens as $key => $token) {
         if ($token !== $actualResultTokens[$key]) {
             $this->_cause = 'missmatch of token: ' . $key;
             if ($returnResult) {
                 return FALSE;
             }
             $this->fail($other, $description);
         }
     }
     return true;
 }
开发者ID:robo47,项目名称:php-manipulator,代码行数:31,代码来源:ResultsMatch.php

示例4: setUseStderrRedirection

 /**
  * Defines if should use STDERR redirection or not.
  *
  * Then $stderrRedirection is TRUE, STDERR is redirected to STDOUT.
  *
  * @throws PHPUnit_Framework_Exception
  *
  * @param bool $stderrRedirection
  */
 public function setUseStderrRedirection($stderrRedirection)
 {
     if (!is_bool($stderrRedirection)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'boolean');
     }
     $this->stderrRedirection = $stderrRedirection;
 }
开发者ID:phecho,项目名称:phpunit,代码行数:16,代码来源:PHP.php

示例5: matches

 /** Checks the status code.
  *
  * @param Test_Browser $browser
  *
  * @throws InvalidArgumentException
  * @return bool
  */
 protected function matches($browser)
 {
     if (!$browser instanceof Test_Browser) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(0, 'Test_Browser');
     }
     return $this->_equal === in_array($browser->getResponse()->getStatusCode(), $this->_expected);
 }
开发者ID:todofixthis,项目名称:sfJwtPhpUnitPlugin,代码行数:14,代码来源:StatusCodeEquals.class.php

示例6: matches

 /** Checks the status code.
  *
  * @param sfForm $form
  *
  * @return bool
  */
 protected function matches($form)
 {
     if (!$form instanceof sfForm) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(0, 'Test_Browser');
     }
     return $form->isValid() == $this->_expected;
 }
开发者ID:todofixthis,项目名称:sfJwtPhpUnitPlugin,代码行数:13,代码来源:FormIsValid.class.php

示例7: defaultAttributesValues

 /**
  * Creates and returns an DefaultAttributesValues constraint.
  *
  * @param array $defaultAttributes
  *
  * @return DefaultAttributesValues
  * @throws \PHPUnit_Framework_Exception
  */
 public static function defaultAttributesValues($defaultAttributes)
 {
     if (!is_array($defaultAttributes)) {
         throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'array or ArrayAccess');
     }
     return new DefaultAttributesValues($defaultAttributes);
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:15,代码来源:AssertDefaultAttributesValuesTrait.php

示例8: __construct

 /**
  * Creates configuration constraint for config object
  *
  * @param Varien_Simplexml_Config $config
  */
 public function __construct($constraint)
 {
     if (!$constraint instanceof Mage_PHPUnit_Constraint_Config_Interface) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'Mage_PHPUnit_Constraint_Config_Interface');
     }
     $this->constraint = $constraint;
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:12,代码来源:Config.php

示例9: setOs

 public function setOs($os)
 {
     if (!is_string($os)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
     }
     $this->os = $os;
 }
开发者ID:scottdixon,项目名称:sausage,代码行数:7,代码来源:SeleniumRCDriver.php

示例10: usesTraits

 /**
  * Creates and returns an UsesTraits constraint.
  *
  * @param string[] $traits
  *
  * @return UsesTraits
  * @throws \PHPUnit_Framework_Exception
  */
 public static function usesTraits($traits)
 {
     if (!is_array($traits)) {
         throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'array or ArrayAccess');
     }
     return new UsesTraits($traits);
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:15,代码来源:AssertUsesTraitsTrait.php

示例11: __construct

 /**
  * Constraint for testing observer
  * event definitions in configuration
  *
  * @param string $area
  * @param string $eventName
  * @param string $observerClassAlias
  * @param string $observerMethod
  * @param string|null $observerName
  */
 public function __construct($area, $eventName, $observerClassAlias, $observerMethod, $type = self::TYPE_DEFINDED, $observerName = null)
 {
     if (empty($area) || !is_string($area)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string', $area);
     }
     if (empty($eventName) || !is_string($eventName)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'string', $eventName);
     }
     if (empty($observerClassAlias) || !is_string($observerClassAlias)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'string', $observerClassAlias);
     }
     if (empty($observerMethod) || !is_string($observerMethod)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(4, 'string', $observerMethod);
     }
     if ($observerName !== null && !is_string($observerName)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(6, 'string', $observerName);
     }
     $this->_area = $area;
     $this->_eventName = $eventName;
     $this->_observerClassAlias = $observerClassAlias;
     $this->_observerMethod = $observerMethod;
     $this->_observerName = $observerName;
     $expectedValue = $this->_observerClassAlias . '::' . $this->_observerMethod;
     $nodePath = sprintf(self::XML_PATH_EVENTS, $this->_area, $this->_eventName);
     parent::__construct($nodePath, $type, $expectedValue);
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:36,代码来源:EventObserver.php

示例12: regExp

 public static function regExp($pattern)
 {
     if (!is_string($pattern)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
     }
     return new PHPUnit_Framework_Constraint_PCREMatch($pattern);
 }
开发者ID:HaliteChallenge,项目名称:Halite,代码行数:7,代码来源:SwiftMailerTestCase.php

示例13: evaluate

 /**
  * @param \PHP\Manipulator\Token $other
  * @param  string $description Additional information about the test
  * @param  bool $returnResult Whether to return a result or throw an exception
  * @return boolean
  */
 public function evaluate($other, $description = '', $returnResult = FALSE)
 {
     if (!$other instanceof Token) {
         throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'PHP\\Manipulator\\Token');
     }
     $expectedToken = $this->_expectedToken;
     $equal = $this->_getEqualsConstraint($expectedToken->getValue());
     if (!$equal->evaluate($other->getValue(), $description, true)) {
         $this->_difference = 'values';
         if ($returnResult) {
             return FALSE;
         }
         $this->fail($other, $description);
     }
     $equal = $this->_getEqualsConstraint($expectedToken->getType());
     if (!$equal->evaluate($other->getType(), $description, true)) {
         $this->_difference = 'types';
         if ($returnResult) {
             return FALSE;
         }
         $this->fail($other, $description);
     }
     if (true === $this->_strict) {
         $equal = $this->_getEqualsConstraint($expectedToken->getLinenumber());
         if (!$equal->evaluate($other->getLinenumber(), $description, true)) {
             $this->_difference = 'linenumber';
             if ($returnResult) {
                 return FALSE;
             }
             $this->fail($other, $description);
         }
     }
     return true;
 }
开发者ID:robo47,项目名称:php-manipulator,代码行数:40,代码来源:TokensMatch.php

示例14: evaluate

 /**
  * @param \PHP\Manipulator\TokenContainer $other
  * @param  string $description Additional information about the test
  * @param  bool $returnResult Whether to return a result or throw an exception
  * @return boolean
  */
 public function evaluate($other, $description = '', $returnResult = FALSE)
 {
     if (!$other instanceof TokenContainer) {
         throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'PHP\\Manipulator\\TokenContainer');
     }
     $expectedIterator = $this->_expectedContainer->getIterator();
     $actualIterator = $other->getIterator();
     $i = 0;
     while ($expectedIterator->valid() && $actualIterator->valid()) {
         $expectedToken = $expectedIterator->current();
         /* @var $expectedToken PHP\Manipulator\Token */
         $actualToken = $actualIterator->current();
         /* @var $actualToken PHP\Manipulator\Token */
         if (!$actualToken->equals($expectedToken, $this->_strict)) {
             if ($returnResult) {
                 return FALSE;
             }
             $this->fail($other, $description);
         }
         $i++;
         $expectedIterator->next();
         $actualIterator->next();
     }
     if ($expectedIterator->valid() || $actualIterator->valid()) {
         if ($returnResult) {
             return FALSE;
         }
         $this->fail($other, $description);
     }
     return true;
 }
开发者ID:robo47,项目名称:php-manipulator,代码行数:37,代码来源:TokenContainerMatch.php

示例15: __construct

 /**
  * 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);
 }
开发者ID:tiagosampaio,项目名称:EcomDev_PHPUnit,代码行数:16,代码来源:AbstractConfig.php


注:本文中的PHPUnit_Util_InvalidArgumentHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。