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

Class: PHPUnit2_Util_Skeleton

Source Location: /PHPUnit2-2.3.0/Util/Skeleton.php

Class Overview


Class for creating a PHPUnit2_Framework_TestCase skeleton file.


Author(s):

Version:

  • Release: @package_version@

Copyright:

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

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 52]
Class for creating a PHPUnit2_Framework_TestCase skeleton file.

This class will take a classname as a parameter on construction and will create a PHP file that contains the skeleton of a PHPUnit2_Framework_TestCase subclass.

  1.  <?php
  2.  require_once 'PHPUnit2/Util/Skeleton.php';
  3.  
  4.  $skeleton = new PHPUnit2_Util_Skeleton(
  5.    'PHPUnit2_Util_Skeleton',
  6.    'PHPUnit2/Util/Skeleton.php'
  7.  );
  8.  
  9.  $skeleton->write();
  10.  ?>



[ Top ]


Class Variables

$className =

[line 130]

  • Access: protected

Type:   string


[ Top ]

$classSourceFile =

[line 136]

  • Access: protected

Type:   string


[ Top ]

$templateClassFooter =
'}

// Call {className}Test::main() if this source file is executed directly.
if (PHPUnit2_MAIN_METHOD == "{className}Test::main") {
    {className}Test::main();
}
?>
'

[line 105]

  • Access: protected

Type:   mixed


[ Top ]

$templateClassHeader =
'<?php
// Call {className}Test::main() if this source file is executed directly.
if (!defined("PHPUnit2_MAIN_METHOD")) {
    define("PHPUnit2_MAIN_METHOD", "{className}Test::main");
}

require_once "PHPUnit2/Framework/TestCase.php";
require_once "PHPUnit2/Framework/TestSuite.php";

// You may remove the following line when all tests have been implemented.
require_once "PHPUnit2/Framework/IncompleteTestError.php";

require_once "{classFile}";

/**
 * Test class for {className}.
 * Generated by PHPUnit2_Util_Skeleton on {date} at {time}.
 */
class {className}Test extends PHPUnit2_Framework_TestCase {
    /**
     * Runs the test methods of this class.
     *
     * @access public
     * @static
     */
    public static function main() {
        require_once "PHPUnit2/TextUI/TestRunner.php";

        $suite  = new PHPUnit2_Framework_TestSuite("{className}Test");
        $result = PHPUnit2_TextUI_TestRunner::run($suite);
    }

    /**
     * Sets up the fixture, for example, open a network connection.
     * This method is called before a test is executed.
     *
     * @access protected
     */
    protected function setUp() {
    }

    /**
     * Tears down the fixture, for example, close a network connection.
     * This method is called after a test is executed.
     *
     * @access protected
     */
    protected function tearDown() {
    }
'

[line 53]

  • Access: protected

Type:   mixed


[ Top ]

$templateMethod =
'
    /**
     * @todo Implement test{methodName}().
     */
    public function test{methodName}() {
        // Remove the following line when you implement this test.
        throw new PHPUnit2_Framework_IncompleteTestError;
    }
'

[line 115]

  • Access: protected

Type:   mixed


[ Top ]



Method Detail

__construct (Constructor)   [line 146]

PHPUnit2_Util_Skeleton __construct( string $className, [string $classSourceFile = ''])

Constructor.
  • Throws: Exception
  • Access: public

Parameters:

string   $className   — 
string   $classSourceFile   — 

[ Top ]

generate   [line 185]

string generate( )

Generates the test class' source.
  • Access: public

[ Top ]

setTemplates   [line 231]

void setTemplates( string $classHeader, string $classFooter, string $method)

Sets the templates for class header, class footer, and method.
  • Since: Method available since Release 2.2.0
  • Access: public

Parameters:

string   $classHeader   — 
string   $classFooter   — 
string   $method   — 

[ Top ]

testClassFooter   [line 278]

void testClassFooter( string $className)

  • Access: protected

Parameters:

string   $className   — 

[ Top ]

testClassHeader   [line 256]

void testClassHeader( string $className, string $classSourceFile)

  • Access: protected

Parameters:

string   $className   — 
string   $classSourceFile   — 

[ Top ]

testMethod   [line 294]

void testMethod( string $methodName)

  • Access: protected

Parameters:

string   $methodName   — 

[ Top ]

write   [line 211]

void write( [string $file = ''])

Generates the test class and writes it to a source file.
  • Access: public

Parameters:

string   $file   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:12:37 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.