Class MockGenerator

Description

Service class for code generation of mock objects.

Located in /mock_objects.php (line 1187)


	
			
Variable Summary
 mixed $_class
 mixed $_mock_base
 mixed $_mock_class
 mixed $_reflection
Method Summary
 MockGenerator MockGenerator (string $class, string $mock_class)
 void generate (array $methods)
 void generatePartial (array $methods)
 void generateSubclass (array $methods)
Variables
mixed $_class (line 1188)
mixed $_mock_base (line 1190)
mixed $_mock_class (line 1189)
mixed $_reflection (line 1191)
Methods
Constructor MockGenerator (line 1199)

Builds initial reflection object.

MockGenerator MockGenerator (string $class, string $mock_class)
  • string $class: Class to be mocked.
  • string $mock_class: New class with identical interface, but no behaviour.
generate (line 1219)

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

  • access: public
void generate (array $methods)
  • array $methods: Additional methods to add beyond those in th cloned class. Use this to emulate the dynamic addition of methods in the cloned class or when the class hasn't been written yet.
generatePartial (line 1268)

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
void generatePartial (array $methods)
  • array $methods: Methods to be overridden with mock versions.
generateSubclass (line 1242)

Subclasses a class and overrides every method with a mock one that can have return values and expectations set. Chains to an aggregated SimpleMock.

  • access: public
void generateSubclass (array $methods)
  • 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.

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