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


PHP PHPUnit_Util_Type类代码示例

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


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

示例1: toString

    public function toString()
    {
        return sprintf(
          'return user-specified value %s',

          PHPUnit_Util_Type::toString($this->value)
        );
    }
开发者ID:schwarer2006,项目名称:wikia,代码行数:8,代码来源:Return.php

示例2: toString

    public function toString()
    {
        return sprintf(
          'raise user-specified exception %s',

          PHPUnit_Util_Type::toString($this->exception)
        );
    }
开发者ID:schwarer2006,项目名称:wikia,代码行数:8,代码来源:Exception.php

示例3: invoke

 /**
  * @param PHPUnit_Framework_MockObject_Invocation $invocation
  * @return the invocation of the Entry with matching parameters.
  */
 public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
 {
     foreach ($this->return_map as $entry) {
         if ($entry->matches($invocation)) {
             return $entry->invoke($invocation);
         }
     }
     PHPUnit_Framework_Assert::fail(sprintf('No return value defined for %s', PHPUnit_Util_Type::toString($invocation->parameters)));
 }
开发者ID:nidalhajaj,项目名称:tubepress,代码行数:13,代码来源:ReturnMapping.php

示例4: toString

    /**
     * Returns a string describing the type difference between the expected
     * and the actual value.
     */
    public function toString()
    {
        return sprintf(
          '%s does not match expected type "%s".',

          PHPUnit_Util_Type::toString($this->actual),
          gettype($this->expected)
        );
    }
开发者ID:schwarer2006,项目名称:wikia,代码行数:13,代码来源:Type.php

示例5: getActualValue

 /**
  * For layout, actual value should be always set
  * (non-PHPdoc)
  * @see Mage_PHPUnit_Constraint_Abstract::getActualValue()
  */
 protected function getActualValue($other)
 {
     if ($this->_useActualValue) {
         if (is_array($this->_actualValue)) {
             return PHPUnit_Util_Type::toString($this->_actualValue);
         }
         return parent::getActualValue($other);
     }
     return '';
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:15,代码来源:Abstract.php

示例6: toString

    /**
     * Returns a string describing the difference between the expected and the
     * actual scalar value.
     */
    public function toString()
    {
        return sprintf(
          'Failed asserting that %s %s %s.',

          PHPUnit_Util_Type::toString($this->actual),
          $this->identical ? 'is identical to' : 'matches expected',
          PHPUnit_Util_Type::toString($this->expected)
        );
    }
开发者ID:schwarer2006,项目名称:wikia,代码行数:14,代码来源:Scalar.php

示例7: evaluateValid

 /**
  * Evaluate that string is valid JSON
  *
  * @param string $other
  * @return boolean
  */
 protected function evaluateValid($other)
 {
     try {
         $decodedJson = Zend_Json::decode($other);
         $this->setActualValue($decodedJson);
     } catch (Zend_Json_Exception $e) {
         $this->setActualValue(PHPUnit_Util_Type::shortenedString($other) . "\n" . $e->__toString());
         return false;
     }
     return true;
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:17,代码来源:Json.php

示例8: getActualValue

 /**
  * Returning user friendly actual value
  * (non-PHPdoc)
  * @see Mage_PHPUnit_Constraint_Abstract::getActualValue()
  */
 protected function getActualValue($other)
 {
     if ($this->_useActualValue) {
         if ($this->_actualValue instanceof Varien_Object) {
             $value = $this->_actualValue->debug();
         } else {
             $value = $this->_actualValue;
         }
         return PHPUnit_Util_Type::toString($value);
     }
     return '';
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:17,代码来源:Property.php

示例9: toString

 /**
  * {@inheritdoc}
  *
  * @todo Improve output using diff when expected and actual arguments of a
  *       command do not match.
  */
 public function toString()
 {
     $string = 'is a Redis command';
     if ($this->commandID) {
         $string .= " with ID '{$this->commandID}'";
     }
     if ($this->arguments) {
         $string .= " and the following arguments:\n\n";
         $string .= PHPUnit_Util_Type::export($this->arguments);
     }
     return $string;
 }
开发者ID:GeorgeBroadley,项目名称:caffeine-vendor,代码行数:18,代码来源:RedisCommandConstraint.php

示例10: fail

 public function fail($other, $description, \SebastianBergmann\Comparator\ComparisonFailure $comparisonFailure = NULL)
 {
     throw new PHPUnit_Framework_ExpectationFailedException(sprintf('%sFailed asserting that %s contains a query element that restricts the search to groups', !empty($description) ? $description . "\n" : '', PHPUnit_Util_Type::toString($other, TRUE)), NULL);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:4,代码来源:Restrictgroups.php

示例11: toString

 /**
  * Returns a string representation of the constraint.
  *
  * @return string
  */
 public function toString()
 {
     return 'is greater than ' . PHPUnit_Util_Type::toString($this->value);
 }
开发者ID:maximseshuk,项目名称:lz77-kit,代码行数:9,代码来源:GreaterThan.php

示例12: assertEquals

 /**
  * Asserts that two values are equal.
  *
  * @param  mixed $expected The first value to compare
  * @param  mixed $actual The second value to compare
  * @param  float $delta The allowed numerical distance between two values to
  *                      consider them equal
  * @param  bool  $canonicalize If set to TRUE, arrays are sorted before
  *                             comparison
  * @param  bool  $ignoreCase If set to TRUE, upper- and lowercasing is
  *                           ignored when comparing string values
  * @throws PHPUnit_Framework_ComparisonFailure Thrown when the comparison
  *                           fails. Contains information about the
  *                           specific errors that lead to the failure.
  */
 public function assertEquals($expected, $actual, $delta = 0, $canonicalize = FALSE, $ignoreCase = FALSE)
 {
     if (is_infinite($actual) && is_infinite($expected)) {
         return;
     }
     if ((is_infinite($actual) xor is_infinite($expected)) || (is_nan($actual) or is_nan($expected)) || abs($actual - $expected) > $delta) {
         throw new PHPUnit_Framework_ComparisonFailure($expected, $actual, '', '', FALSE, sprintf('Failed asserting that %s matches expected %s.', PHPUnit_Util_Type::export($actual), PHPUnit_Util_Type::export($expected)));
     }
 }
开发者ID:deepakb,项目名称:test-driven-development-example,代码行数:24,代码来源:Numeric.php

示例13: toString

 /**
  * Returns a string representation of the constraint.
  *
  * @return string
  */
 public function toString()
 {
     return 'has the key ' . PHPUnit_Util_Type::toString($this->key);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:9,代码来源:ArrayHasKey.php

示例14: shortenedString

 public static function shortenedString($string)
 {
     $string = preg_replace('#\\n|\\r\\n|\\r#', ' ', $string);
     if (strlen($string) > 14) {
         return PHPUnit_Util_Type::toString(substr($string, 0, 7) . '...' . substr($string, -7));
     } else {
         return PHPUnit_Util_Type::toString($string);
     }
 }
开发者ID:xiplias,项目名称:pails,代码行数:9,代码来源:Type.php

示例15: testNonBinaryStringExport

 /**
  * @dataProvider provideNonBinaryMultibyteStrings
  */
 public function testNonBinaryStringExport($value, $expectedLength)
 {
     $this->assertRegExp("~'.{{$expectedLength}}'\$~s", PHPUnit_Util_Type::export($value));
 }
开发者ID:dertin,项目名称:JShielder,代码行数:7,代码来源:TypeTest.php


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