[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/test/PHPUnit/GUI/ -> Gtk.php (sommaire)

PHP Version 4 Copyright (c) 2002-2005, Sebastian Bergmann <sb@sebastian-bergmann.de>. All rights reserved.

Author: Scott Mattocks <scott@crisscott.com>
Copyright: 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
License: http://www.opensource.org/licenses/bsd-license.php BSD License
Version: CVS: $Id: Gtk.php,v 1.6 2005/11/10 09:47:15 sebastian Exp $
Poids: 740 lignes (23 kb)
Inclus ou requis:0 fois
Référencé: 1 fois
Nécessite: 0 fichiers

Définit 1 class

PHPUnit_GUI_Gtk:: (20 méthodes):
  PHPUnit_GUI_Gtk()
  main()
  _createUI()
  _createMenu()
  _createSuiteEntry()
  _createReportLabels()
  _createProgressBar()
  _createReportAreas()
  _createStatusLine()
  about()
  loadTest()
  runTest()
  _setLabelValue()
  run()
  _showStatus()
  show()
  addSuites()
  _showAll()
  _showFailures()
  _updateProgress()


Classe: PHPUnit_GUI_Gtk  - X-Ref

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();


PHPUnit_GUI_Gtk()   X-Ref
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.

param: none
return: void

main($showPassed = true)   X-Ref
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.

param: boolean $showPassed
return: void

_createUI()   X-Ref
Create the user interface.

The user interface is pretty simple. It consists of a
menu, text entry, run button, some labels, a progress
indicator, and a couple of areas for notification of
any messages.

param: none
return: void

_createMenu()   X-Ref
Create the menu.

The menu is very simple. It an exit menu item, which exits
the application, and an about menu item, which shows some
basic information about the application itself.

param: none
return: &object The GtkMenuBar

_createSuiteEntry()   X-Ref
Create the suite entry and related widgets.

The suite entry has some supporting components such as a
label, the show passed check box and the run button. All
of these items are packed into two nested boxes.

param: none
return: &object A box that contains all of the suite entry pieces.

_createReportLabels()   X-Ref
Create the labels that tell the user what has happened.

There are three labels, one each for total runs, errors and
failures. There is also one label for each of these that
describes what the label is. It could be done with one label
instead of two but that would make updates much harder.

param: none
return: &object A box containing the labels.

_createProgressBar()   X-Ref
Create the success/failure indicator.

A GtkProgressBar is used to visually indicate how many
tests were successful compared to how many were not. The
progress bar shows the percentage of success and will
change from green to red if there are any failures.

param: none
return: &object The progress bar

_createReportAreas()   X-Ref
Create the report text areas.

The report area consists of one text area for failures, one
text area for errors and one label for identification purposes.
All three widgets are packed into a box.

param: none
return: &object The box containing the report areas.

_createStatusLine()   X-Ref
Create a status label.

A status line at the bottom of the application is used
to notify the user of non-test related messages such as
failures loading a test suite.

param: none
return: &object The status label.

about()   X-Ref
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.

param: none
return: void

loadTest(&$file)   X-Ref
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.

param: string  The file that contains a test case/suite or the classname.
return: &object The new test suite.

runTest()   X-Ref
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'

param: none
return: void

_setLabelValue(&$label, $value)   X-Ref
Set the text of a label.

Change the text of a given label.

param: widget  &$label The label whose value is to be changed.
param: string  $value  The new text of the label.
return: void

run()   X-Ref
The main work of the application.

Load the test suite and then execute the tests.

param: none
return: void

_showStatus($status)   X-Ref
Update the status message.

param: string  $status The new message.
return: void

show($showPassed = true)   X-Ref
Alias for main()


addSuites($testSuite)   X-Ref
Add a suite to the tests.

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

param: object $testSuite The suite to add.
return: void

_showAll(&$result)   X-Ref
Show all test messages.

param: object  The TestResult from the test suite.
return: void

_showFailures(&$results, &$area)   X-Ref
Show failure/error messages in the given text area.

param: object  &$results The results of the test.
param: widget  &$area    The area to show the results in.

_updateProgress($runs, $errors, $failures)   X-Ref
Update the progress indicator.

param: integer $runs
param: integer $errors
param: integer $failures
return: void



Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics