Class ShellTestCase

Description

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.

Located in /libraries/pear/simpletest/shell_tester.php (line 62)

RunnableTest
   |
   --SimpleTestCase
      |
      --ShellTestCase
Direct descendents
Class Description
 class TestOfShellTestCase 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.
 class TestOfVisualShell 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.
 class TestOfShellTesterAndShell 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.
Variable Summary
Method Summary
 ShellTestCase ShellTestCase ([string $label = false])
 void assertExitCode (integer $status, [string $message = "%s"])
 void assertFileExists (string $path, [string $message = "%s"])
 void assertFileNotExists (string $path, [string $message = "%s"])
 void assertFilePattern (string $pattern, string $path, [string $message = "%s"])
 void assertNoFilePattern (string $pattern, string $path, [string $message = "%s"])
 void assertNoOutputPattern (string $pattern, [$message $message = "%s"])
 void assertOutput (string $expected, [string $message = "%s"])
 void assertOutputPattern (string $pattern, [string $message = "%s"])
 void dumpOutput ()
 boolean execute (string $command)
 Shell &_createShell ()
 Shell &_getShell ()
Variables
mixed $_current_shell (line 63)
mixed $_last_command (line 65)
mixed $_last_status (line 64)

Inherited Variables

Inherited from SimpleTestCase

SimpleTestCase::$_reporter

Inherited from RunnableTest

RunnableTest::$_label
Methods
Constructor ShellTestCase (line 74)

Creates an empty test case. Should be subclassed with test methods for a functional test case.

  • access: public
ShellTestCase ShellTestCase ([string $label = false])
  • string $label: Name of test case. Will use the class name if none specified.
assertExitCode (line 110)

Tests the last status code from the shell.

  • access: public
void assertExitCode (integer $status, [string $message = "%s"])
  • integer $status: Expected status of last command.
  • string $message: Message to display.
assertFileExists (line 168)

File existence check.

  • access: public
void assertFileExists (string $path, [string $message = "%s"])
  • string $path: Full filename and path.
  • string $message: Message to display.
assertFileNotExists (line 179)

File non-existence check.

  • access: public
void assertFileNotExists (string $path, [string $message = "%s"])
  • string $path: Full filename and path.
  • string $message: Message to display.
assertFilePattern (line 192)

Scans a file for a Perl regex. If found anywhere it passes, else it fails.

  • access: public
void assertFilePattern (string $pattern, string $path, [string $message = "%s"])
  • string $pattern: Regex to search for.
  • string $path: Full filename and path.
  • string $message: Message to display.
assertNoFilePattern (line 208)

If a Perl regex is found anywhere in the named file then a failure is generated, else a pass.

  • access: public
void assertNoFilePattern (string $pattern, string $path, [string $message = "%s"])
  • string $pattern: Regex to search for.
  • string $path: Full filename and path.
  • string $message: Message to display.
assertNoOutputPattern (line 154)

If a Perl regex is found anywhere in the current output then a failure is generated, else a pass.

  • access: public
void assertNoOutputPattern (string $pattern, [$message $message = "%s"])
  • string $pattern: Regex to search for.
  • $message $message: Message to display.
assertOutput (line 124)

Attempt to exactly match the combined STDERR and STDOUT output.

  • access: public
void assertOutput (string $expected, [string $message = "%s"])
  • string $expected: Expected output.
  • string $message: Message to display.
assertOutputPattern (line 139)

Scans the output for a Perl regex. If found anywhere it passes, else it fails.

  • access: public
void assertOutputPattern (string $pattern, [string $message = "%s"])
  • string $pattern: Regex to search for.
  • string $message: Message to display.
dumpOutput (line 98)

Dumps the output of the last command.

  • access: public
void dumpOutput ()
execute (line 87)

Executes a command and buffers the results.

  • return: True if zero exit code.
  • access: public
boolean execute (string $command)
  • string $command: Command to run.
_createShell (line 231)

Factory for the shell to run the command on.

  • return: New shell object.
  • access: protected
Shell &_createShell ()
_getShell (line 222)

Accessor for current shell. Used for testing the the tester itself.

  • return: Current shell.
  • access: protected
Shell &_getShell ()

Redefined in descendants as:

Inherited Methods

Inherited From SimpleTestCase

 SimpleTestCase::SimpleTestCase()
 SimpleTestCase::assertExpectation()
 SimpleTestCase::assertFalse()
 SimpleTestCase::assertTrue()
 SimpleTestCase::dump()
 SimpleTestCase::error()
 SimpleTestCase::fail()
 SimpleTestCase::getAssertionLine()
 SimpleTestCase::invoke()
 SimpleTestCase::pass()
 SimpleTestCase::run()
 SimpleTestCase::sendMessage()
 SimpleTestCase::setUp()
 SimpleTestCase::signal()
 SimpleTestCase::swallowErrors()
 SimpleTestCase::tearDown()
 SimpleTestCase::_createRunner()
 SimpleTestCase::_isConstructor()
 SimpleTestCase::_isTest()

Inherited From RunnableTest

 RunnableTest::RunnableTest()
 RunnableTest::getLabel()
 RunnableTest::getSize()
 RunnableTest::run()

Documentation generated on Fri, 3 Dec 2004 12:27:28 +0000 by phpDocumentor 1.3.0RC3