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


PHP PHPUnit_Util_Type::shortenedExport方法代码示例

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


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

示例1: testShortenedExport

 /**
  * @dataProvider shortenedExportProvider
  */
 public function testShortenedExport($value, $expected)
 {
     $this->assertSame($expected, self::trimnl(PHPUnit_Util_Type::shortenedExport($value)));
 }
开发者ID:dertin,项目名称:JShielder,代码行数:7,代码来源:TypeTest.php

示例2: 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 (gettype($expected) != gettype($actual)) {
         throw new PHPUnit_Framework_ComparisonFailure($expected, $actual, '', '', FALSE, sprintf('%s does not match expected type "%s".', PHPUnit_Util_Type::shortenedExport($actual), gettype($expected)));
     }
 }
开发者ID:deepakb,项目名称:test-driven-development-example,代码行数:21,代码来源:Type.php

示例3: failureDescription

 /**
  * Returns the description of the failure
  *
  * The beginning of failure messages is "Failed asserting that" in most
  * cases. This method should return the second part of that sentence.
  *
  * @param  mixed $other Evaluated value or object.
  * @return string
  */
 protected function failureDescription($other)
 {
     return sprintf('%s is an instance of class "%s"', PHPUnit_Util_Type::shortenedExport($other), $this->className);
 }
开发者ID:qube81,项目名称:old-phpunit,代码行数:13,代码来源:IsInstanceOf.php

示例4: 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, array &$processed = array())
 {
     if ($canonicalize) {
         sort($expected);
         sort($actual);
     }
     $remaining = $actual;
     $expString = $actString = "Array (\n";
     $equal = TRUE;
     foreach ($expected as $key => $value) {
         unset($remaining[$key]);
         if (!array_key_exists($key, $actual)) {
             $expString .= sprintf("    %s => %s\n", PHPUnit_Util_Type::export($key), PHPUnit_Util_Type::shortenedExport($value));
             $equal = FALSE;
             continue;
         }
         try {
             $this->factory->getComparatorFor($value, $actual[$key])->assertEquals($value, $actual[$key], $delta, $canonicalize, $ignoreCase, $processed);
             $expString .= sprintf("    %s => %s\n", PHPUnit_Util_Type::export($key), PHPUnit_Util_Type::shortenedExport($value));
             $actString .= sprintf("    %s => %s\n", PHPUnit_Util_Type::export($key), PHPUnit_Util_Type::shortenedExport($actual[$key]));
         } catch (PHPUnit_Framework_ComparisonFailure $e) {
             $expString .= sprintf("    %s => %s\n", PHPUnit_Util_Type::export($key), $e->getExpectedAsString() ? $this->indent($e->getExpectedAsString()) : PHPUnit_Util_Type::shortenedExport($e->getExpected()));
             $actString .= sprintf("    %s => %s\n", PHPUnit_Util_Type::export($key), $e->getActualAsString() ? $this->indent($e->getActualAsString()) : PHPUnit_Util_Type::shortenedExport($e->getActual()));
             $equal = FALSE;
         }
     }
     foreach ($remaining as $key => $value) {
         $actString .= sprintf("    %s => %s\n", PHPUnit_Util_Type::export($key), PHPUnit_Util_Type::shortenedExport($value));
         $equal = FALSE;
     }
     $expString .= ')';
     $actString .= ')';
     if (!$equal) {
         throw new PHPUnit_Framework_ComparisonFailure($expected, $actual, $expString, $actString, FALSE, 'Failed asserting that two arrays are equal.');
     }
 }
开发者ID:DieguinhoHR,项目名称:kratos_store,代码行数:51,代码来源:Array.php

示例5: failureDescription

 /**
  * Returns the description of the failure
  *
  * The beginning of failure messages is "Failed asserting that" in most
  * cases. This method should return the second part of that sentence.
  *
  * @param  mixed $other Evaluated value or object.
  * @return string
  */
 protected function failureDescription($other)
 {
     json_decode($other);
     $error = PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider::determineJsonError(json_last_error());
     return sprintf('%s is valid JSON (%s)', PHPUnit_Util_Type::shortenedExport($other), $error);
 }
开发者ID:jeanCarloMachado,项目名称:challenges,代码行数:15,代码来源:IsJson.php


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