當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。