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


PHP SimpleDumper类代码示例

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


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

示例1: assert_attr_read_only

 function assert_attr_read_only($obj, $attr_name, $test_value, $msg = null)
 {
     if (is_null($msg)) {
         $msg = 'Exepected %s not to change but [got: %s] after setting [to: %s] [from: %s]';
     }
     $old_value = @$obj->{$attr_name};
     $this->expectError();
     $obj->{$attr_name} = $test_value;
     $new_value = @$obj->{$attr_name};
     $dumper = new SimpleDumper();
     $msg = sprintf($msg, get_class($obj) . '::$' . $attr_name, $dumper->describeValue($new_value), $dumper->describeValue($test_value), $dumper->describeValue($old_value));
     $this->assertEqual($old_value, $new_value, $msg);
 }
开发者ID:a-ludi,项目名称:community-service-manager,代码行数:13,代码来源:test-person.php

示例2: getExpectationLine

 /**
  *    Uses a stack trace to find the line of an assertion.
  *    @param array $stack      Stack frames top most first. Only
  *                             needed if not using the PHP
  *                             backtrace function.
  *    @return string           Location of first expect*
  *                             method embedded in format string.
  *    @access public
  *    @static
  */
 function getExpectationLine($stack = false)
 {
     if ($stack === false) {
         $stack = SimpleTestCompatibility::getStackTrace();
     }
     return SimpleDumper::getFormattedAssertionLine($stack);
 }
开发者ID:sebs,项目名称:simpletest,代码行数:17,代码来源:mock_objects.php

示例3: testDescribeObject

 public function testDescribeObject()
 {
     $dumper = new SimpleDumper();
     $this->assertPattern('/object/i', $dumper->describeValue(new DumperDummy()));
     $this->assertPattern('/DumperDummy/i', $dumper->describeValue(new DumperDummy()));
 }
开发者ID:Clansuite,项目名称:Clansuite,代码行数:6,代码来源:dumper_test.php

示例4: dump

 function dump($variable, $message = false)
 {
     $formatted = SimpleDumper::dump($variable);
     if ($message) {
         $formatted = $message . "\n" . $formatted;
     }
     $this->_runner->paintFormattedMessage($formatted);
     return $variable;
 }
开发者ID:BackupTheBerlios,项目名称:phpbase-svn,代码行数:9,代码来源:simple_test.php

示例5: renderArguments

 /**
  *    Renders the argument list as a string for
  *    messages.
  *    @param array $args    Incoming arguments.
  *    @return string        Simple description of type and value.
  */
 protected function renderArguments($args)
 {
     $descriptions = array();
     if (is_array($args)) {
         foreach ($args as $arg) {
             $dumper = new SimpleDumper();
             $descriptions[] = $dumper->describeValue($arg);
         }
     }
     return implode(', ', $descriptions);
 }
开发者ID:Boris-de,项目名称:videodb,代码行数:17,代码来源:mock_objects.php

示例6: getFormattedAssertionLine

 /**
  *    Extracts the last assertion that was not within
  *    Simpletest itself. The name must start with "assert".
  *    @param array $stack      List of stack frames.
  *    @access public
  *    @static
  */
 function getFormattedAssertionLine($stack)
 {
     foreach ($stack as $frame) {
         if (isset($frame['file'])) {
             if (strpos($frame['file'], SIMPLE_TEST) !== false) {
                 if (dirname($frame['file']) . '/' == SIMPLE_TEST) {
                     continue;
                 }
             }
         }
         if (SimpleDumper::_stackFrameIsAnAssertion($frame)) {
             return ' at [' . $frame['file'] . ' line ' . $frame['line'] . ']';
         }
     }
     return '';
 }
开发者ID:sergrin,项目名称:crawlers-il,代码行数:23,代码来源:dumper.php

示例7: assertCopy

 /**
  *    Will trigger a pass if both parameters refer
  *    to different variables. Fail otherwise. The objects
  *    have to be identical references though.
  *    This will fail under E_STRICT with objects. Use
  *    assertClone() for this.
  *    @param mixed $first           Object reference to check.
  *    @param mixed $second          Hopefully not the same object.
  *    @param string $message        Message to display.
  *    @return boolean               True on pass
  *    @access public
  */
 function assertCopy(&$first, &$second, $message = "%s")
 {
     $dumper = new SimpleDumper();
     $message = sprintf($message, "[" . $dumper->describeValue($first) . "] and [" . $dumper->describeValue($second) . "] should not be the same object");
     return $this->assertFalse(SimpleTestCompatibility::isReference($first, $second), $message);
 }
开发者ID:sebs,项目名称:simpletest,代码行数:18,代码来源:unit_tester.php

示例8: assertNotSame

 /**
  * Inverted identity test.
  *
  * @param $first          First object handle.
  * @param $second         Hopefully a different handle.
  * @param $message        Message to display.
  */
 public function assertNotSame($first, $second, $message = '%s')
 {
     $dumper = new SimpleDumper();
     $message = sprintf($message, '[' . $dumper->describeValue($first) . '] and [' . $dumper->describeValue($second) . '] should not be the same object');
     return $this->assert(new falseExpectation(), SimpleTestCompatibility::isReference($first, $second), $message);
 }
开发者ID:guicara,项目名称:simpletest,代码行数:13,代码来源:pear_test_case.php

示例9: contain

 function contain($subject, $target, $message = '%s')
 {
     $dumper = new SimpleDumper();
     $message = "[ {$dumper->describeValue($subject)}] should contain [{$dumper->describeValue($target)}]";
     if (is_array($subject) && is_array($target)) {
         return $this->be_true(array_intersect($target, $subject) == $target, $message);
     } elseif (is_array($subject)) {
         return $this->be_true(in_array($target, $subject), $message);
     } elseif (is_string($subject)) {
         return $this->be_true(strpos($target, $subject) !== false, $message);
     }
 }
开发者ID:herlambang,项目名称:h2o-php,代码行数:12,代码来源:spec.php

示例10: assertNotEmpty

 /**
  * Will be true if the value is not empty.
  *
  * @param  mixed  $value   Supposedly not empty value.
  * @param  string $message Message to display.
  *
  * @return boolean True on pass.
  *
  * @access public
  */
 public function assertNotEmpty($value, $message = '%s')
 {
     $dumper = new SimpleDumper();
     $message = sprintf($message, '[' . $dumper->describeValue($value) . '] should not be empty');
     return $this->assertFalse(empty($value), $message);
 }
开发者ID:ivantcholakov,项目名称:Bonfire,代码行数:16,代码来源:run.php

示例11: dump

 public static function dump($data)
 {
     echo '<pre style="white-space: pre;padding:10px;font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif;margin-bottom:10px;background-color:#eee">';
     SimpleDumper::dump($data);
     echo '</pre>';
 }
开发者ID:telemetrik,项目名称:dumper,代码行数:6,代码来源:HtmlDumper.php

示例12: assertNotNull

 function assertNotNull($value, $message = '%s')
 {
     $dumper = new SimpleDumper();
     $message = sprintf($message, '[' . $dumper->describeValue($value) . '] should not be null');
     return $this->assertTrue(isset($value), $message);
 }
开发者ID:RussellDias,项目名称:konstrukt,代码行数:6,代码来源:test.php

示例13: assertNotEmpty

 /**
  *    Will be true if the value is not empty.
  *    @param mixed $value           Supposedly set value.
  *    @param string $message        Message to display.
  *    @return boolean               True on pass.
  *    @access public
  */
 function assertNotEmpty($value, $message = "%s")
 {
     $dumper = new SimpleDumper();
     $message = sprintf($message, "[" . $dumper->describeValue($value) . "] should not be null");
     return $this->assertTrue(!empty($value), $message);
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:13,代码来源:DalUnitTestCase.php

示例14: describeDifference

 /**
  *    Creates a human readable description of the
  *    difference between two variables. Uses a
  *    dynamic call.
  *    @param mixed $first        First variable.
  *    @param mixed $second       Value to compare with.
  *    @param boolean $identical  If true then type anomolies count.
  *    @return string             Description of difference.
  *    @access public
  */
 function describeDifference($first, $second, $identical = false)
 {
     $difference = parent::describeDifference($first, $second, $identical);
     $difference = htmlentities($difference, ENT_COMPAT, 'UTF-8');
     if ($this->getType($first) == 'String') {
         $diff = $this->describeStringDifferenceAsADiff($first, $second, $identical);
         if ($diff) {
             $difference .= PHP_EOL . PHP_EOL;
             $difference .= '<fieldset><legend>Unified diff</legend>';
             $difference .= '<div class="diff">' . $diff . '</div>';
             $difference .= '</fieldset>';
         }
     }
     return $difference;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:25,代码来源:TestsPluginReporter.class.php


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