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

Class: PHPUnit2_Extensions_MockObject_Mock

Source Location: /PHPUnit2-3.0.0alpha11/Extensions/MockObject/Mock.php

Class Overview


Provides generation of mock classes and objects from existing classes.


Author(s):

Version:

  • Release: @package_version@

Copyright:

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

Methods


Inherited Variables

Inherited Methods


Class Details

[line 92]
Provides generation of mock classes and objects from existing classes.

The mocked class will contain all the methods of the original class but with a different implementation which will call the current PHPUnit2_Extensions_MockObject_InvocationMocker object, this objects takes care of checking expectations and stubs. It is also possible to define which methods are mocked by passing an array of method names.

The simplest way to define a mock object is to do:


1 PHPUnit2_Extensions_MockObject_Mock::generate('MyClass');
2 $o = new Mock_MyClass;

The generate() method returns an object which can be queried.


1 $m = PHPUnit2_Extensions_MockObject::generate('MyClass');
2 $o = new $m->mockClassName;
3 print "original class was: . $m->className;



[ Top ]


Method Detail

canMockMethod   [line 181]

void canMockMethod( mixed ReflectionMethod$method)


[ Top ]

generate   [line 119]

void generate( mixed $className, [mixed $mockClassName = array $methods = array()''])


[ Top ]

generateClass   [line 130]

void generateClass( )


[ Top ]

generateClassDefinition   [line 153]

void generateClassDefinition( mixed ReflectionClass$class)


[ Top ]

generateCloneCode   [line 283]

void generateCloneCode( mixed ReflectionClass$class)


[ Top ]

generateConstructorCode   [line 261]

void generateConstructorCode( mixed ReflectionClass$class)


[ Top ]

generateMethodDefinition   [line 199]

void generateMethodDefinition( mixed ReflectionMethod$method)


[ Top ]

generateMethodParameters   [line 297]

void generateMethodParameters( mixed ReflectionMethod$method, [mixed $asCall = FALSE])


[ Top ]

generateMockApi   [line 240]

void generateMockApi( mixed ReflectionClass$class)


[ Top ]

shouldMockMethod   [line 194]

void shouldMockMethod( mixed ReflectionMethod$method)


[ Top ]


Documentation generated on Tue, 12 Sep 2006 09:37:19 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.