Class Mock

Description

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

Located in /mock_objects.php (line 1116)


	
			
Direct descendents
Class Description
 class Stub
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 Mock ()
Methods
static generate (line 1141)

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

  • access: public
static 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.
static generatePartial (line 1158)

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.

  • access: public
static 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 1168)

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

  • access: public
static void getExpectationLine ()
Constructor Mock (line 1122)

Factory for mock object classes.

  • access: public
Mock Mock ()

Documentation generated on Sun, 04 May 2008 09:21:48 -0500 by phpDocumentor 1.3.0