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