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

Class: PHPUnit_GUI_Gtk

Source Location: /PHPUnit-1.3.2/PHPUnit/GUI/Gtk.php

Class Overview


GTK GUI interface for PHPUnit.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 92]
GTK GUI interface for PHPUnit.

This class is a PHP port of junit.awtui.testrunner. Documentation for junit.awtui.testrunner can be found at http://junit.sourceforge.net

Due to the limitations of PHP4 and PHP-Gtk, this class can not duplicate all of the functionality of the JUnit GUI. Some of the things this class cannot do include:

  • Reloading the class for each run
  • Stopping the test in progress
To use simply intantiate the class and call main() $gtk =& new PHPUnit_GUI_Gtk; $gtk->main();

Once the window has finished loading, you can enter the name of a class that has been loaded (include/require some where in your code, or you can pass the name of the file containing the class.

You can also load classes using the SetupDecorator class. require_once 'PHPUnit/GUI/SetupDecorator.php'; require_once 'PHPUnit/GUI/Gtk.php'; $gui = new PHPUnit_GUI_SetupDecorator(new PHPUnit_GUI_Gtk()); $gui->getSuitesFromDir('/path/to/test','.*\.php$',array('index.php','sql.php')); $gui->show();



[ Top ]


Class Variables

$dumpArea =

[line 139]

The text area for reporting errors encountered when running tests.

Type:   object


[ Top ]

$gui =

[line 98]

The main gtk window

Type:   object


[ Top ]

$numberOfErrors =

[line 116]

The label that shows the number of errors that were encountered.

Type:   object


[ Top ]

$numberOfFailures =

[line 122]

The label that shows the number of failures that were encountered.

Type:   object


[ Top ]

$numberOfRuns =

[line 110]

The label that shows the number of tests that were run.

Type:   object


[ Top ]

$progress =

[line 145]

The progress bar indicator. Shows the percentage of passed tests.

Type:   object


[ Top ]

$reportArea =

[line 133]

The text area for reporting messages from successful

test runs. (not necessarily successful tests)


Type:   object


[ Top ]

$showPassed =

[line 151]

A checkbox for the user to indicate whether or not they would like to see results from all tests or just failures.

Type:   mixed


[ Top ]

$statusLine =

[line 127]

The label for reporting user messages.

Type:   object


[ Top ]

$suiteField =

[line 104]

The text entry that contains the name of the file that holds the test(s)/suite(s).

Type:   object


[ Top ]



Method Detail

PHPUnit_GUI_Gtk (Constructor)   [line 164]

void PHPUnit_GUI_Gtk( none 0)

Constructor.

The constructor checks for the gtk extension and loads it if needed. Then it creates the GUI. The GUI is not shown nor is the main gtk loop started until main() is called.

  • Access: public

Parameters:

none   0     

[ Top ]

about   [line 464]

void about( none 0)

Show a popup with information about the application.

The popup should show information about the version, the author, the license, where to get the latest version and a short description.

  • Access: public

Parameters:

none   0     

[ Top ]

addSuites   [line 666]

void addSuites( object $testSuite)

Add a suite to the tests.

This method is require by SetupDecorator. It adds a suite to the the current set of suites.

  • Access: public

Parameters:

object   $testSuite     The suite to add.

[ Top ]

loadTest   [line 519]

&object &loadTest( string &$file)

Load the test suite.

This method tries to load test suite based on the user info. If the user passes the name of a tests suite, it is instantiated and a new object is returned. If the user passes a file that contains a test suite, the class is instantiated and a new object is returned. If the user passes a file that contains a test case, the test case is passed to a new test suite and the new suite object is returned.

  • Return: The new test suite.
  • Access: public

Parameters:

string   &$file     The file that contains a test case/suite or the classname.

[ Top ]

main   [line 185]

void main( [boolean $showPassed = true])

Start the main gtk loop.

main() first sets the default state of the showPassed check box. Next all widgets that are part of the GUI are shown. Finally the main gtk loop is started.

  • Access: public

Parameters:

boolean   $showPassed     

[ Top ]

run   [line 618]

void run( none 0)

The main work of the application.

Load the test suite and then execute the tests.

  • Access: public

Parameters:

none   0     

[ Top ]

runTest   [line 559]

void runTest( none 0)

Run the test suite.

This method runs the test suite and updates the messages for the user. When finished it changes the status line to 'Test Complete'

  • Access: public

Parameters:

none   0     

[ Top ]

show   [line 651]

void show( [mixed $showPassed = true])

Alias for main()

[ Top ]


Documentation generated on Thu, 10 Nov 2005 05:02:21 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.