Testing_DocTest
[ class tree: Testing_DocTest ] [ index: Testing_DocTest ] [ all elements ]

Class: Testing_DocTest_Runner_Default

Source Location: /Testing_DocTest-0.6.0/Testing/DocTest/Runner/Default.php

Class Overview


DocTest Runner default class.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2008 David JEAN LOUIS

Methods


Inherited Variables

Inherited Methods


Class Details

[line 95]
DocTest Runner default class.

  1.  require_once 'Testing/DocTest.php';
  2.  require_once 'Testing/DocTest/TestCase.php';
  3.  
  4.  $test = new Testing_DocTest_TestCase();
  5.  $test->code          = 'echo "Foobar!";';
  6.  $test->expectedValue = '  foobar !';
  7.  
  8.  $r->run($test);
  9.  var_dump($test->state === Testing_DocTest_TestCase::STATE_PASSED);
  10.  
  11.  $test->flags |= Testing_DocTest::FLAG_NORMALIZE_WHITESPACE;
  12.  $r->run($test);
  13.  var_dump($test->state === Testing_DocTest_TestCase::STATE_PASSED);
  14.  
  15.  $test->flags |= Testing_DocTest::FLAG_CASE_INSENSITIVE;
  16.  $r->run($test);
  17.  var_dump($test->state === Testing_DocTest_TestCase::STATE_PASSED);
  18.  
  19.  $test->expectedValue = '  f[...]bar !';
  20.  $test->flags |= Testing_DocTest::FLAG_ELLIPSIS;
  21.  $r->run($test);
  22.  var_dump($test->state === Testing_DocTest_TestCase::STATE_PASSED);
  23.  
  24.  $test->flags |= Testing_DocTest::FLAG_SKIP;
  25.  $r->run($test);
  26.  var_dump($test->state === Testing_DocTest_TestCase::STATE_SKIPPED);
  27.  
  28.  // expects:
  29.  // bool(false)
  30.  // bool(false)
  31.  // bool(true)
  32.  // bool(true)
  33.  // bool(true)

  1.  // flags: ELLIPSIS
  2.  require_once 'Testing/DocTest.php';
  3.  require_once 'Testing/DocTest/TestCase.php';
  4.  
  5.  $test                = new Testing_DocTest_TestCase();
  6.  $test->code          = 'echo nonExistantFunc();';
  7.  $test->expectedValue = 'foo';
  8.  $runner              = new Testing_DocTest_Runner_Default();
  9.  $runner->run($test);
  10.  var_dump($test->actualValue);
  11.  // expects:
  12.  // string([...]) "[...]Fatal error: Call to undefined function [...]"



[ Top ]


Method Detail

run   [line 110]

void run( Testing_DocTest_TestCase $testCase)

Run the test provided by comparing the expected result with the actual result returned by the test code.

Each test is run in its own php process.

  • Throws: Testing_DocTest_Exception
  • Access: public

Parameters:

object   $testCase   —  Testing_DocTest_TestCase instance to run

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:52:26 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.