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

Class: Testing_DocTest

Source Location: /Testing_DocTest-0.3.0/DocTest.php

Class Overview


DocTest.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2008 David JEAN LOUIS

Methods


Inherited Variables

Inherited Methods


Class Details

[line 47]
DocTest.


[ Top ]


Method Detail

accept   [line 144]

void accept( mixed $instance)

Method to allow DocTest to accept a custom finder, outputter, parser or runner instance.

  1.  class MyRunner implements Testing_DocTest_RunnerInterface {
  2.      function run(Testing_DocTest_TestCase $tb{
  3.          // do something here...
  4.      }
  5.  }
  6.  
  7.  try {
  8.      $goodRunner = new MyRunner();
  9.      $badRunner  = new stdclass();
  10.      $doctest    = new Testing_DocTest();
  11.      $doctest->accept($goodRunner);
  12.      echo "Ok !\n";
  13.      $doctest->accept($badRunner);
  14.  catch (Testing_DocTest_Exception $exc{
  15.      echo "Error !\n";
  16.  }
  17.  // expects:
  18.  // Ok !
  19.  // Error !

  • Throws: Testing_DocTest_Exception if wrong argument passed
  • Access: public

Parameters:

mixed   $instance   —  an instance implementing the finder, outputter, parser or runner interface.

[ Top ]

__construct (Constructor)   [line 93]

void __construct( [array $options = array()])

Constructor.

The $options array can have the following elements

  • quiet: tells the outputter to turn on quiet mode, only errors will be printed out (the default value is false);
  • no_colors: tells the outputter to not use colors when outputting results (the default value is false);
  • logfile: tells the outputter to write the results in a logfile instead of STDOUT;

  • Access: public

Parameters:

array   $options   —  an optional array of options

[ Top ]

run   [line 212]

void run( array $pathes)

Run the tests contained in the given pathes.

  1.  // flags: ELLIPSIS
  2.  $base    is_dir('@php_dir@'?
  3.      '@php_dir@/tests/Testing_DocTest' 'Testing';
  4.  $doctest = new Testing_DocTest(array('no_colors'=>true));
  5.  $doctest->run(array($base '/tests'));
  6.  // expects:
  7.  // [PASS]  file level test in file "[...]test1.php"
  8.  // [PASS]  my test for class Foo in file "[...]test1.php"
  9.  // [PASS]  my test for method Foo::testString in file "[...]test1.php"
  10.  // [PASS]  method Foo::testBool in file "[...]test1.php"
  11.  // [PASS]  method Foo::testInt in file "[...]test1.php"
  12.  // [PASS]  method Foo::testFloat in file "[...]test1.php"
  13.  // [PASS]  method Foo::testArray in file "[...]test1.php"
  14.  // [PASS]  method Foo::testObject in file "[...]test1.php"
  15.  // [PASS]  method Foo::testResource in file "[...]test1.php"
  16.  // [PASS]  method Foo::testException in file "[...]test1.php"
  17.  // [PASS]  method Foo::testNull in file "[...]test1.php"
  18.  // [PASS]  method Foo::testError in file "[...]test1.php"
  19.  // [PASS]  method Foo::testError in file "[...]test1.php"
  20.  // [PASS]  method Foo::testError in file "[...]test1.php"
  21.  // [PASS]  method Foo::testError in file "[...]test1.php"
  22.  // [PASS]  function testFlags in file "[...]test1.php"
  23.  // [PASS]  function testFlags in file "[...]test1.php"
  24.  // [SKIP]  function testFlags in file "[...]test1.php"
  25.  // [PASS]  function testFlags in file "[...]test1.php"
  26.  // [PASS]  function multiply in file "[...]test1.php"
  27.  // [PASS]  function testArray in file "[...]test1.php"
  28.  // [PASS]  function testArray in file "[...]test1.php"
  29.  // [PASS]  function testString in file "[...]test1.php"
  30.  // [PASS]  function testString in file "[...]test1.php"
  31.  //
  32.  // Total time    : [...] sec.
  33.  // Passed tests  : 23
  34.  // Skipped tests : 1
  35.  // Failed tests  : 0
  36.  //

  • Access: public

Parameters:

array   $pathes   —  an array of files and/or directories

[ Top ]


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