Class Mock

Description

Static methods only service class for code generation of mock objects.

Located in /mock_objects.php (line 1192)


	
			
Method Summary
 static void generate (string $class, [string $mock_class = false], [array $methods = false])
 static void generatePartial (string $class, string $mock_class, array $methods)
 static void getExpectationLine ()
 Mock __construct ()
Methods
static generate (line 1214)

Clones a class' interface and creates a mock version that can have return values and expectations set.

void generate (string $class, [string $mock_class = false], [array $methods = false])
  • string $class: Class to clone.
  • string $mock_class: New class name. Default is the old name with "Mock" prepended.
  • array $methods: Additional methods to add beyond those in the cloned class. Use this to emulate the dynamic addition of methods in the cloned class or when the class hasn't been written yet.sta
static generatePartial (line 1229)

Generates a version of a class with selected methods mocked only. Inherits the old class and chains the mock methods of an aggregated mock object.

void generatePartial (string $class, string $mock_class, array $methods)
  • string $class: Class to clone.
  • string $mock_class: New class name.
  • array $methods: Methods to be overridden with mock versions.
static getExpectationLine (line 1237)

Uses a stack trace to find the line of an assertion.

void getExpectationLine ()
Constructor __construct (line 1197)

Factory for mock object classes.

Mock __construct ()

Documentation generated on Sun, 31 Oct 2010 16:31:48 -0500 by phpDocumentor 1.4.3