[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/tests/test_tools/simpletest/ -> shell_tester.php (sommaire)

base include file for SimpleTest

Version: $Id: shell_tester.php 1397 2006-09-07 07:55:53Z wei $
Poids: 306 lignes (11 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 2 classes

SimpleShell:: (4 méthodes):
  SimpleShell()
  execute()
  getOutput()
  getOutputAsList()

ShellTestCase:: (17 méthodes):
  ShellTestCase()
  execute()
  dumpOutput()
  getOutput()
  getOutputAsList()
  assertEqual()
  assertNotEqual()
  assertExitCode()
  assertOutput()
  assertOutputPattern()
  assertNoOutputPattern()
  assertFileExists()
  assertFileNotExists()
  assertFilePattern()
  assertNoFilePattern()
  _getShell()
  _createShell()


Classe: SimpleShell  - X-Ref

Wrapper for exec() functionality.

SimpleShell()   X-Ref
Executes the shell comand and stashes the output.


execute($command)   X-Ref
Actually runs the command. Does not trap the
error stream output as this need PHP 4.3+.

param: string $command    The actual command line
return: integer           Exit code.

getOutput()   X-Ref
Accessor for the last output.

return: string        Output as text.

getOutputAsList()   X-Ref
Accessor for the last output.

return: array         Output as array of lines.

Classe: ShellTestCase  - X-Ref

Test case for testing of command line scripts and
utilities. Usually scripts taht are external to the
PHP code, but support it in some way.

ShellTestCase($label = false)   X-Ref
Creates an empty test case. Should be subclassed
with test methods for a functional test case.

param: string $label     Name of test case. Will use

execute($command)   X-Ref
Executes a command and buffers the results.

param: string $command     Command to run.
return: boolean            True if zero exit code.

dumpOutput()   X-Ref
Dumps the output of the last command.


getOutput()   X-Ref
Accessor for the last output.

return: string        Output as text.

getOutputAsList()   X-Ref
Accessor for the last output.

return: array         Output as array of lines.

assertEqual($first, $second, $message = "%s")   X-Ref
Will trigger a pass if the two parameters have
the same value only. Otherwise a fail. This
is for testing hand extracted text, etc.

param: mixed $first          Value to compare.
param: mixed $second         Value to compare.
param: string $message       Message to display.
return: boolean              True on pass

assertNotEqual($first, $second, $message = "%s")   X-Ref
Will trigger a pass if the two parameters have
a different value. Otherwise a fail. This
is for testing hand extracted text, etc.

param: mixed $first           Value to compare.
param: mixed $second          Value to compare.
param: string $message        Message to display.
return: boolean               True on pass

assertExitCode($status, $message = "%s")   X-Ref
Tests the last status code from the shell.

param: integer $status   Expected status of last
param: string $message   Message to display.
return: boolean          True if pass.

assertOutput($expected, $message = "%s")   X-Ref
Attempt to exactly match the combined STDERR and
STDOUT output.

param: string $expected  Expected output.
param: string $message   Message to display.
return: boolean          True if pass.

assertOutputPattern($pattern, $message = "%s")   X-Ref
Scans the output for a Perl regex. If found
anywhere it passes, else it fails.

param: string $pattern    Regex to search for.
param: string $message    Message to display.
return: boolean           True if pass.

assertNoOutputPattern($pattern, $message = "%s")   X-Ref
If a Perl regex is found anywhere in the current
output then a failure is generated, else a pass.

param: string $pattern    Regex to search for.
param: $message           Message to display.
return: boolean           True if pass.

assertFileExists($path, $message = "%s")   X-Ref
File existence check.

param: string $path      Full filename and path.
param: string $message   Message to display.
return: boolean          True if pass.

assertFileNotExists($path, $message = "%s")   X-Ref
File non-existence check.

param: string $path      Full filename and path.
param: string $message   Message to display.
return: boolean          True if pass.

assertFilePattern($pattern, $path, $message = "%s")   X-Ref
Scans a file for a Perl regex. If found
anywhere it passes, else it fails.

param: string $pattern    Regex to search for.
param: string $path       Full filename and path.
param: string $message    Message to display.
return: boolean           True if pass.

assertNoFilePattern($pattern, $path, $message = "%s")   X-Ref
If a Perl regex is found anywhere in the named
file then a failure is generated, else a pass.

param: string $pattern    Regex to search for.
param: string $path       Full filename and path.
param: string $message    Message to display.
return: boolean           True if pass.

_getShell()   X-Ref
Accessor for current shell. Used for testing the
the tester itself.

return: Shell        Current shell.

_createShell()   X-Ref
Factory for the shell to run the command on.

return: Shell        New shell object.



Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7