Skip to content

Instantly share code, notes, and snippets.

@loonies
Last active August 30, 2025 20:18
Show Gist options
  • Save loonies/1255249 to your computer and use it in GitHub Desktop.
Save loonies/1255249 to your computer and use it in GitHub Desktop.

Revisions

  1. loonies revised this gist Jul 5, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 4_Configuring_Mocks.md
    Original file line number Diff line number Diff line change
    @@ -40,7 +40,7 @@ Returns a matcher that matches when the method it is evaluated for is executed e

    ### exactly()

    Returns a matcher that matches when the method it is evaluated for is executed exactly once.
    Returns a matcher that matches when the method it is evaluated for is executed exactly $count times.

    * **param**: *int*
    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedCount*
  2. loonies revised this gist May 11, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 7_resources.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Resources

    * [The UNIT in unit testing](http://edorian.posterous.com/the-unit-in-unit-testing)
    * [The UNIT in unit testing](https://edorian.github.io/2012-03-14-The-UNIT-in-unit-testing/)
    * [PHPUnit Cheat Sheet](http://otroblogmas.com/phpunit-cheat-sheet/)
  3. loonies revised this gist Dec 19, 2013. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions 1_phpunit-api.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,20 @@
    ## PHPUnit API reference

    - version 3.6

    ## TODO

    Check those constraints:

    ~~~
    $this->anything()
    $this->contains($value)
    $this->arrayHasKey($key)
    $this->equalTo($value, $delta, $maxDepth)
    $this->classHasAttribute($attribute)
    $this->greaterThan($value)
    $this->isInstanceOf($className)
    $this->isType($type)
    $this->matchesRegularExpression($pattern)
    $this->stringContains($string, $case)
    ~~~
  4. Miodrag Tokić revised this gist Jun 14, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 1_phpunit-api.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    ## PHPUnit API
    ## PHPUnit API reference

    - version 3.6
  5. Miodrag Tokić revised this gist Aug 20, 2012. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions 3_Mocking.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ Returns a mock object for the specified class.

    *PHPUnit_Framework_MockObject_MockObject* **getMock**(*string* $originalClassName [, *mixed* $methods = array() [, *array* $arguments = array() [, *string* $mockClassName = '' [, *bool* $callOriginalConstructor = TRUE [, *bool* $callOriginalClone = TRUE [, *bool* $callAutoload = TRUE]]]]]])

    <code>
    ~~~
    $this->getMock(
    $originalClassName,
    $methods = array(),
    @@ -21,7 +21,7 @@ $this->getMock(
    $callOriginalClone = TRUE,
    $callAutoload = TRUE
    );
    </code>
    ~~~

    ### getMockForAbstractClass()

    @@ -32,7 +32,7 @@ Returns a mock object for the specified abstract class with all abstract methods

    *PHPUnit_Framework_MockObject_MockObject* **getMockForAbstractClass**(*string* $originalClassName [, *array* $arguments = array() [, *string* $mockClassName = '' [, *bool* $callOriginalConstructor = TRUE [, *bool* $callOriginalClone = TRUE [, *bool* $callAutoload = TRUE [, *array* $mockedMethods = array()]]]]]])

    <code>
    ~~~
    $this->getMockForAbstractClass(
    $originalClassName,
    array $arguments = array(),
    @@ -42,7 +42,7 @@ $this->getMockForAbstractClass(
    $callAutoload = TRUE,
    array $mockedMethods
    );
    </code>
    ~~~

    ### getMockFromWsdl()

    @@ -53,15 +53,15 @@ Returns a mock object based on the given WSDL file.

    *PHPUnit_Framework_MockObject_MockObject* **getMockFromWsdl**(*string* $wsdlFile [, *string* $originalClassName [, *string* $mockClassName = '' [, *array* $mockedMethods = array() [, *bool* $callOriginalConstructor = TRUE]]]])

    <code>
    ~~~
    $this->getMockFromWsdl(
    $wsdlFile,
    $originalClassName = '',
    $mockClassName = '',
    array $methods = array(),
    $callOriginalConstructor = TRUE
    );
    </code>
    ~~~

    ### getMockBuilder()

    @@ -72,7 +72,7 @@ Returns a builder object to create mock objects using a fluent interface.

    *PHPUnit_Framework_MockObject_MockBuilder* **getMockBuilder**(*string* **$className**)

    <code>
    ~~~
    $mock = $this->getMockBuilder($className)
    ->setMockClassName($name)
    ->setConstructorArgs(array())
    @@ -90,4 +90,4 @@ $mock = $this->getMockBuilder($className)
    ->disableAutoload()
    ->setMethods(array()|NULL)
    ->getMockForAbstractClass();
    </code>
    ~~~
  6. Miodrag Tokić revised this gist Aug 20, 2012. 8 changed files with 150 additions and 153 deletions.
    2 changes: 1 addition & 1 deletion 1_phpunit-api.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    ## PHPUnit API

    - version 3.6+
    - version 3.6
    62 changes: 41 additions & 21 deletions 2_PHPUnit_Framework_Assert.md → 2_Assertions.md
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,18 @@
    # PHPUnit_Framework_Assert
    # Assertions

    ----
    ## <a id="toc"></a>TOC

    ## Assertions
    * [String](#string)
    * [Array primitive](#array-primitive)
    * [Array class attribute](#array-class-attribute)
    * [Variable primitive](#variable-primitive)
    * [Variable class attribute](#variable-class-attribute)
    * [Class structure](#class-structure)
    * [File](#file)
    * [Xml](#Xml)
    * [Other](#other)

    Code:

    <code>
    $this->assertion()
    </code>

    ### String
    ### <a id="string"></a>String

    * assertRegExp
    * assertNotRegExp
    @@ -21,7 +23,9 @@ $this->assertion()
    * assertStringEndsWith
    * assertStringEndsNotWith

    ### Array primitive
    [TOC](#toc)

    ### <a id="array-primitive"></a>Array primitive

    * assertArrayHasKey
    * assertArrayNotHasKey
    @@ -34,7 +38,9 @@ $this->assertion()
    * assertSameSize
    * assertNotSameSize

    ### Array class attribute
    [TOC](#toc)

    ### <a id="array-class-attribute"></a>Array class attribute

    * assertAttributeContains
    * assertAttributeNotContains
    @@ -43,7 +49,9 @@ $this->assertion()
    * assertAttributeCount
    * assertAttributeNotCount

    ### Variable primitive
    [TOC](#toc)

    ### <a id="variable-primitive"></a>Variable primitive

    * assertTrue
    * assertFalse
    @@ -64,7 +72,9 @@ $this->assertion()
    * assertInternalType
    * assertNotInternalType

    ### Variable class attribute
    [TOC](#toc)

    ### <a id="variable-class-attribute"></a>Variable class attribute

    * assertAttributeSame
    * assertAttributeNotSame
    @@ -80,8 +90,10 @@ $this->assertion()
    * assertAttributeNotInstanceOf
    * assertAttributeInternalType
    * assertAttributeNotInternalType

    ### Class structure

    [TOC](#toc)

    ### <a id="class-structure"></a>Class structure

    * assertClassHasAttribute
    * assertClassNotHasAttribute
    @@ -90,16 +102,20 @@ $this->assertion()
    * assertObjectHasAttribute
    * assertObjectNotHasAttribute

    ### File
    [TOC](#toc)

    ### <a id="file"></a>File

    * assertFileEquals
    * assertFileNotEquals
    * assertStringEqualsFile
    * assertStringNotEqualsFile
    * assertFileExists
    * assertFileNotExists

    ### Xml

    [TOC](#toc)

    ### <a id="xml"></a>Xml

    * assertXmlFileEqualsXmlFile
    * assertXmlFileNotEqualsXmlFile
    @@ -109,7 +125,9 @@ $this->assertion()
    * assertXmlStringNotEqualsXmlString
    * assertEqualXMLStructure

    ### Other
    [TOC](#toc)

    ### <a id="other"></a>Other

    * assertStringMatchesFormatFile
    * assertStringNotMatchesFormatFile
    @@ -118,4 +136,6 @@ $this->assertion()
    * assertSelectEquals
    * assertTag
    * assertNotTag
    * assertThat
    * assertThat

    [TOC](#toc)
    93 changes: 93 additions & 0 deletions 3_Mocking.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,93 @@
    # Mocking

    ## TOC

    ### getMock()

    Returns a mock object for the specified class.

    * **param**: ...
    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMock**(*string* $originalClassName [, *mixed* $methods = array() [, *array* $arguments = array() [, *string* $mockClassName = '' [, *bool* $callOriginalConstructor = TRUE [, *bool* $callOriginalClone = TRUE [, *bool* $callAutoload = TRUE]]]]]])

    <code>
    $this->getMock(
    $originalClassName,
    $methods = array(),
    array $arguments = array(),
    $mockClassName = '',
    $callOriginalConstructor = TRUE,
    $callOriginalClone = TRUE,
    $callAutoload = TRUE
    );
    </code>

    ### getMockForAbstractClass()

    Returns a mock object for the specified abstract class with all abstract methods of the class mocked. Concrete methods to mock can be specified with the last parameter.

    * **param**: ...
    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMockForAbstractClass**(*string* $originalClassName [, *array* $arguments = array() [, *string* $mockClassName = '' [, *bool* $callOriginalConstructor = TRUE [, *bool* $callOriginalClone = TRUE [, *bool* $callAutoload = TRUE [, *array* $mockedMethods = array()]]]]]])

    <code>
    $this->getMockForAbstractClass(
    $originalClassName,
    array $arguments = array(),
    $mockClassName = '',
    $callOriginalConstructor = TRUE,
    $callOriginalClone = TRUE,
    $callAutoload = TRUE,
    array $mockedMethods
    );
    </code>

    ### getMockFromWsdl()

    Returns a mock object based on the given WSDL file.

    * **param**: ...
    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMockFromWsdl**(*string* $wsdlFile [, *string* $originalClassName [, *string* $mockClassName = '' [, *array* $mockedMethods = array() [, *bool* $callOriginalConstructor = TRUE]]]])

    <code>
    $this->getMockFromWsdl(
    $wsdlFile,
    $originalClassName = '',
    $mockClassName = '',
    array $methods = array(),
    $callOriginalConstructor = TRUE
    );
    </code>

    ### getMockBuilder()

    Returns a builder object to create mock objects using a fluent interface.

    * **param**: *string*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **getMockBuilder**(*string* **$className**)

    <code>
    $mock = $this->getMockBuilder($className)
    ->setMockClassName($name)
    ->setConstructorArgs(array())
    ->disableOriginalConstructor()
    ->disableOriginalClone()
    ->disableAutoload()
    ->setMethods(array()|NULL)
    ->getMock();

    $mock = $this->getMockBuilder($className)
    ->setMockClassName($name)
    ->setConstructorArgs(array())
    ->disableOriginalConstructor()
    ->disableOriginalClone()
    ->disableAutoload()
    ->setMethods(array()|NULL)
    ->getMockForAbstractClass();
    </code>
    59 changes: 13 additions & 46 deletions 3_PHPUnit_Framework_TestCase.md → 4_Configuring_Mocks.md
    Original file line number Diff line number Diff line change
    @@ -1,48 +1,7 @@
    # PHPUnit_Framework_TestCase

    ----

    ## Mockers

    Code:

    <code>
    $this->mocker()
    </code>

    ### getMock()

    Returns a mock object for the specified class.

    * **param**: ...
    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMock**(*string* $originalClassName [, *mixed* $methods = array() [, *array* $arguments = array() [, *string* $mockClassName = '' [, *bool* $callOriginalConstructor = TRUE [, *bool* $callOriginalClone = TRUE [, *bool* $callAutoload = TRUE]]]]]])

    ### getMockForAbstractClass()

    Returns a mock object for the specified abstract class with all abstract methods of the class mocked. Concrete methods to mock can be specified with the last parameter.

    * **param**: ...
    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMockForAbstractClass**(*string* $originalClassName [, *array* $arguments = array() [, *string* $mockClassName = '' [, *bool* $callOriginalConstructor = TRUE [, *bool* $callOriginalClone = TRUE [, *bool* $callAutoload = TRUE [, *array* $mockedMethods = array()]]]]]])

    ### getMockBuilder()

    Returns a builder object to create mock objects using a fluent interface.

    * **param**: *string*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **getMockBuilder**(*string* **$className**)

    ----
    # Setting up the expectations

    ## Matchers

    Code:

    <code>
    $mock->expects($this->matcher())
    </code>
    @@ -97,14 +56,22 @@ Returns a matcher that matches when the method it is evaluated for is invoked at

    *PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex* **at**(*int* **$index**)

    ----
    ## Constraints

    <code>
    $mock->with($this->constraint())
    </code>

    ## Stubs
    ### equalTo()
    ### logicalAnd()
    ### logicalNot()
    ### logicalOr()
    ### logicalXor()

    Code:
    ## Returns

    <code>
    $mock->will($this->stub())
    $mock->will($this->return())
    </code>

    ### returnValue()
    78 changes: 0 additions & 78 deletions 4_PHPUnit_Framework_MockObject_MockBuilder.md
    Original file line number Diff line number Diff line change
    @@ -1,78 +0,0 @@
    # PHPUnit_Framework_MockObject_MockBuilder

    ----

    ## Mock builder

    Code:

    <code>
    $this->builder()->builder()...
    </code>

    ### setMethods()

    Specify the methods that are to be replaced with a configurable test double. The behavior of the other methods is not changed.

    * **param**: *array|NULL*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **setMethods**(*mixed* **$methods**)

    ### setConstructorArgs()

    Specifies the arguments for the constructor.

    * **param**: *array*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **setConstructorArgs**(*array* **$args**)

    ### setMockClassName()

    Specifies the name for the mock class.

    * **param**: *string*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **setMockClassName**(*string* **$name**)

    ### disableOriginalConstructor()

    Suppresses the invocation of the original constructor.

    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **disableOriginalConstructor**()

    ### disableOriginalClone()

    Suppresses the invocation of the original clone constructor.

    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **disableOriginalClone**()

    ### disableAutoload()

    Suppresses the use of class autoloading while creating the mock object.

    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **disableAutoload**()

    ### getMock()

    Creates a mock object using a fluent interface.

    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMock**()

    ### getMockForAbstractClass()

    Creates a mock object for an abstract class using a fluent interface.

    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMockForAbstractClass**()
    3 changes: 0 additions & 3 deletions 5_PHPUnit_Framework_MockObject_MockObject.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +0,0 @@
    # PHPUnit_Framework_MockObject_MockObject

    ### expects()
    3 changes: 0 additions & 3 deletions 6_PHPUnit_Framework_MockObject_Matcher_Invocation.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +0,0 @@
    # PHPUnit_Framework_MockObject_Matcher_Invocation

    ...
    3 changes: 2 additions & 1 deletion 7_resources.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    # Resources

    * [The UNIT in unit testing](http://edorian.posterous.com/the-unit-in-unit-testing)
    * [The UNIT in unit testing](http://edorian.posterous.com/the-unit-in-unit-testing)
    * [PHPUnit Cheat Sheet](http://otroblogmas.com/phpunit-cheat-sheet/)
  7. Miodrag Tokić revised this gist May 11, 2012. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions 7_resources.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # Resources

    * [The UNIT in unit testing](http://edorian.posterous.com/the-unit-in-unit-testing)
  8. Miodrag Tokić revised this gist Dec 10, 2011. 3 changed files with 20 additions and 1 deletion.
    6 changes: 6 additions & 0 deletions 2_PHPUnit_Framework_Assert.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,12 @@

    ## Assertions

    Code:

    <code>
    $this->assertion()
    </code>

    ### String

    * assertRegExp
    3 changes: 3 additions & 0 deletions 3_PHPUnit_Framework_TestCase.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@
    ## Mockers

    Code:

    <code>
    $this->mocker()
    </code>
    @@ -41,6 +42,7 @@ Returns a builder object to create mock objects using a fluent interface.
    ## Matchers

    Code:

    <code>
    $mock->expects($this->matcher())
    </code>
    @@ -100,6 +102,7 @@ Returns a matcher that matches when the method it is evaluated for is invoked at
    ## Stubs

    Code:

    <code>
    $mock->will($this->stub())
    </code>
    12 changes: 11 additions & 1 deletion 4_PHPUnit_Framework_MockObject_MockBuilder.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,14 @@
    ## PHPUnit_Framework_MockObject_MockBuilder
    # PHPUnit_Framework_MockObject_MockBuilder

    ----

    ## Mock builder

    Code:

    <code>
    $this->builder()->builder()...
    </code>

    ### setMethods()

  9. Miodrag Tokić revised this gist Dec 10, 2011. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions 3_PHPUnit_Framework_TestCase.md
    Original file line number Diff line number Diff line change
    @@ -5,9 +5,9 @@
    ## Mockers

    Code:
    ~~~
    <code>
    $this->mocker()
    ~~~
    </code>

    ### getMock()

    @@ -41,9 +41,9 @@ Returns a builder object to create mock objects using a fluent interface.
    ## Matchers

    Code:
    ~~~
    <code>
    $mock->expects($this->matcher())
    ~~~
    </code>

    ### any()

    @@ -100,9 +100,9 @@ Returns a matcher that matches when the method it is evaluated for is invoked at
    ## Stubs

    Code:
    ~~~
    <code>
    $mock->will($this->stub())
    ~~~
    </code>

    ### returnValue()

  10. Miodrag Tokić revised this gist Dec 10, 2011. 6 changed files with 0 additions and 0 deletions.
  11. Miodrag Tokić revised this gist Dec 10, 2011. 6 changed files with 337 additions and 146 deletions.
    115 changes: 115 additions & 0 deletions PHPUnit_Framework_Assert.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,115 @@
    # PHPUnit_Framework_Assert

    ----

    ## Assertions

    ### String

    * assertRegExp
    * assertNotRegExp
    * assertStringMatchesFormat
    * assertStringNotMatchesFormat
    * assertStringStartsWith
    * assertStringStartsNotWith
    * assertStringEndsWith
    * assertStringEndsNotWith

    ### Array primitive

    * assertArrayHasKey
    * assertArrayNotHasKey
    * assertContains
    * assertNotContains
    * assertContainsOnly
    * assertNotContainsOnly
    * assertCount
    * assertNotCount
    * assertSameSize
    * assertNotSameSize

    ### Array class attribute

    * assertAttributeContains
    * assertAttributeNotContains
    * assertAttributeContainsOnly
    * assertAttributeNotContainsOnly
    * assertAttributeCount
    * assertAttributeNotCount

    ### Variable primitive

    * assertTrue
    * assertFalse
    * assertNotNull
    * assertNull
    * assertSame
    * assertNotSame
    * assertEquals
    * assertNotEquals
    * assertEmpty
    * assertNotEmpty
    * assertGreaterThan
    * assertGreaterThanOrEqual
    * assertLessThan
    * assertLessThanOrEqual
    * assertInstanceOf
    * assertNotInstanceOf
    * assertInternalType
    * assertNotInternalType

    ### Variable class attribute

    * assertAttributeSame
    * assertAttributeNotSame
    * assertAttributeEquals
    * assertAttributeNotEquals
    * assertAttributeEmpty
    * assertAttributeNotEmpty
    * assertAttributeGreaterThan
    * assertAttributeGreaterThanOrEqual
    * assertAttributeLessThan
    * assertAttributeLessThanOrEqual
    * assertAttributeInstanceOf
    * assertAttributeNotInstanceOf
    * assertAttributeInternalType
    * assertAttributeNotInternalType

    ### Class structure

    * assertClassHasAttribute
    * assertClassNotHasAttribute
    * assertClassHasStaticAttribute
    * assertClassNotHasStaticAttribute
    * assertObjectHasAttribute
    * assertObjectNotHasAttribute

    ### File

    * assertFileEquals
    * assertFileNotEquals
    * assertStringEqualsFile
    * assertStringNotEqualsFile
    * assertFileExists
    * assertFileNotExists

    ### Xml

    * assertXmlFileEqualsXmlFile
    * assertXmlFileNotEqualsXmlFile
    * assertXmlStringEqualsXmlFile
    * assertXmlStringNotEqualsXmlFile
    * assertXmlStringEqualsXmlString
    * assertXmlStringNotEqualsXmlString
    * assertEqualXMLStructure

    ### Other

    * assertStringMatchesFormatFile
    * assertStringNotMatchesFormatFile
    * assertSelectCount
    * assertSelectRegExp
    * assertSelectEquals
    * assertTag
    * assertNotTag
    * assertThat
    3 changes: 3 additions & 0 deletions PHPUnit_Framework_MockObject_Matcher_Invocation.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # PHPUnit_Framework_MockObject_Matcher_Invocation

    ...
    68 changes: 68 additions & 0 deletions PHPUnit_Framework_MockObject_MockBuilder.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,68 @@
    ## PHPUnit_Framework_MockObject_MockBuilder

    ### setMethods()

    Specify the methods that are to be replaced with a configurable test double. The behavior of the other methods is not changed.

    * **param**: *array|NULL*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **setMethods**(*mixed* **$methods**)

    ### setConstructorArgs()

    Specifies the arguments for the constructor.

    * **param**: *array*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **setConstructorArgs**(*array* **$args**)

    ### setMockClassName()

    Specifies the name for the mock class.

    * **param**: *string*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **setMockClassName**(*string* **$name**)

    ### disableOriginalConstructor()

    Suppresses the invocation of the original constructor.

    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **disableOriginalConstructor**()

    ### disableOriginalClone()

    Suppresses the invocation of the original clone constructor.

    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **disableOriginalClone**()

    ### disableAutoload()

    Suppresses the use of class autoloading while creating the mock object.

    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **disableAutoload**()

    ### getMock()

    Creates a mock object using a fluent interface.

    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMock**()

    ### getMockForAbstractClass()

    Creates a mock object for an abstract class using a fluent interface.

    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMockForAbstractClass**()
    3 changes: 3 additions & 0 deletions PHPUnit_Framework_MockObject_MockObject.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # PHPUnit_Framework_MockObject_MockObject

    ### expects()
    146 changes: 146 additions & 0 deletions PHPUnit_Framework_TestCase.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,146 @@
    # PHPUnit_Framework_TestCase

    ----

    ## Mockers

    Code:
    ~~~
    $this->mocker()
    ~~~

    ### getMock()

    Returns a mock object for the specified class.

    * **param**: ...
    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMock**(*string* $originalClassName [, *mixed* $methods = array() [, *array* $arguments = array() [, *string* $mockClassName = '' [, *bool* $callOriginalConstructor = TRUE [, *bool* $callOriginalClone = TRUE [, *bool* $callAutoload = TRUE]]]]]])

    ### getMockForAbstractClass()

    Returns a mock object for the specified abstract class with all abstract methods of the class mocked. Concrete methods to mock can be specified with the last parameter.

    * **param**: ...
    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMockForAbstractClass**(*string* $originalClassName [, *array* $arguments = array() [, *string* $mockClassName = '' [, *bool* $callOriginalConstructor = TRUE [, *bool* $callOriginalClone = TRUE [, *bool* $callAutoload = TRUE [, *array* $mockedMethods = array()]]]]]])

    ### getMockBuilder()

    Returns a builder object to create mock objects using a fluent interface.

    * **param**: *string*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **getMockBuilder**(*string* **$className**)

    ----

    ## Matchers

    Code:
    ~~~
    $mock->expects($this->matcher())
    ~~~

    ### any()

    Returns a matcher that matches when the method it is evaluated for is executed zero or more times.

    * **return**: *PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount*

    *PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount* **any**()

    ### never()

    Returns a matcher that matches when the method it is evaluated for is never executed.

    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedCount*

    *PHPUnit_Framework_MockObject_Matcher_InvokedCount* **never**()

    ### atLeastOnce()

    Returns a matcher that matches when the method it is evaluated for is executed at least once.

    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce*

    *PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce* **atLeastOnce**()

    ### once()

    Returns a matcher that matches when the method it is evaluated for is executed exactly once.

    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedCount*

    *PHPUnit_Framework_MockObject_Matcher_InvokedCount* **once**()

    ### exactly()

    Returns a matcher that matches when the method it is evaluated for is executed exactly once.

    * **param**: *int*
    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedCount*

    *PHPUnit_Framework_MockObject_Matcher_InvokedCount* **exactly**(*int* **$count**)

    ### at()

    Returns a matcher that matches when the method it is evaluated for is invoked at the given $index.

    * **param**: *int*
    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex*

    *PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex* **at**(*int* **$index**)

    ----

    ## Stubs

    Code:
    ~~~
    $mock->will($this->stub())
    ~~~

    ### returnValue()

    Desc.

    *PHPUnit_Framework_MockObject_Stub_Return* **returnValue**(*mixed* $value)

    ### returnValueMap()

    Desc.

    *PHPUnit_Framework_MockObject_Stub_ReturnValue* **MapreturnValueMap**(*array* $valueMap)

    ### returnArgument()

    *PHPUnit_Framework_MockObject_Stub_ReturnArgument* **returnArgument**(*int* $argumentIndex)

    ### returnCallback()

    Desc.

    *PHPUnit_Framework_MockObject_Stub_ReturnCallback* **returnCallback**(*mixed* $callback)

    ### returnSelf()

    Returns the current object.

    *PHPUnit_Framework_MockObject_Stub_ReturnSelf* **returnSelf**()

    ### throwException()

    Desc.

    *PHPUnit_Framework_MockObject_Stub_Exception* **throwException**(*Exception* $exception)

    ### onConsecutiveCalls()

    Desc.

    *PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls* **onConsecutiveCalls**(*mixed* ... [, *mixed* ...])

    148 changes: 2 additions & 146 deletions phpunit-api.md
    Original file line number Diff line number Diff line change
    @@ -1,147 +1,3 @@
    ## PHPUnit_Framework_TestCase

    ----

    ### any()

    Returns a matcher that matches when the method it is evaluated for is executed zero or more times.

    * **return**: *PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount*

    *PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount* **any**()

    ### never()

    Returns a matcher that matches when the method it is evaluated for is never executed.

    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedCount*

    *PHPUnit_Framework_MockObject_Matcher_InvokedCount* **never**()

    ### atLeastOnce()

    Returns a matcher that matches when the method it is evaluated for is executed at least once.

    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce*

    *PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce* **atLeastOnce**()

    ### once()

    Returns a matcher that matches when the method it is evaluated for is executed exactly once.

    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedCount*

    *PHPUnit_Framework_MockObject_Matcher_InvokedCount* **once**()

    ### exactly()

    Returns a matcher that matches when the method it is evaluated for is executed exactly once.

    * **param**: *int*
    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedCount*

    *PHPUnit_Framework_MockObject_Matcher_InvokedCount* **exactly**(*int* **$count**)

    ### at()

    Returns a matcher that matches when the method it is evaluated for is invoked at the given $index.

    * **param**: *int*
    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex*

    *PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex* **at**(*int* **$index**)

    ----

    ### getMockBuilder()

    Returns a builder object to create mock objects using a fluent interface.

    * **param**: *string*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **getMockBuilder**(*string* **$className**)



    ## PHPUnit_Framework_MockObject_MockBuilder

    ### setMethods()

    Specify the methods that are to be replaced with a configurable test double. The behavior of the other methods is not changed.

    * **param**: *array*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **setMethods**(*array* **$methods**)

    ### setConstructorArgs()

    Specifies the arguments for the constructor.

    * **param**: *array*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **setConstructorArgs**(*array* **$args**)

    ### setMockClassName()

    Specifies the name for the mock class.

    * **param**: *string*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **setMockClassName**(*string* **$name**)

    ### disableOriginalConstructor()

    Suppresses the invocation of the original constructor.

    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **disableOriginalConstructor**()

    ### disableOriginalClone()

    Suppresses the invocation of the original clone constructor.

    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **disableOriginalClone**()

    ### disableAutoload()

    Suppresses the use of class autoloading while creating the mock object.

    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **disableAutoload**()

    ### getMock()

    Creates a mock object using a fluent interface.

    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMock**()

    ### getMockForAbstractClass()

    Creates a mock object for an abstract class using a fluent interface.

    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMockForAbstractClass**()



    ## PHPUnit_Framework_MockObject_MockObject

    ### expects()

    ## PHPUnit_Framework_MockObject_Matcher_Invocation

    ...

    ## PHPUnit API

    - version 3.6+
  12. Miodrag Tokić revised this gist Nov 28, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion phpunit-api.md
    Original file line number Diff line number Diff line change
    @@ -69,7 +69,7 @@ Returns a builder object to create mock objects using a fluent interface.

    ### setMethods()

    Specifies the subset of methods to mock. Default is to mock all of them.
    Specify the methods that are to be replaced with a configurable test double. The behavior of the other methods is not changed.

    * **param**: *array*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*
  13. Miodrag Tokić revised this gist Sep 30, 2011. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions phpunit-api.md
    Original file line number Diff line number Diff line change
    @@ -135,3 +135,13 @@ Creates a mock object for an abstract class using a fluent interface.
    *PHPUnit_Framework_MockObject_MockObject* **getMockForAbstractClass**()



    ## PHPUnit_Framework_MockObject_MockObject

    ### expects()

    ## PHPUnit_Framework_MockObject_Matcher_Invocation

    ...


  14. Miodrag Tokić revised this gist Sep 30, 2011. 1 changed file with 87 additions and 1 deletion.
    88 changes: 87 additions & 1 deletion phpunit-api.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    ## PHPUnit_Framework_TestCase

    ----

    ### any()

    Returns a matcher that matches when the method it is evaluated for is executed zero or more times.
    @@ -48,4 +50,88 @@ Returns a matcher that matches when the method it is evaluated for is invoked at
    * **param**: *int*
    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex*

    *PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex* **at**(*int* **$index**)
    *PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex* **at**(*int* **$index**)

    ----

    ### getMockBuilder()

    Returns a builder object to create mock objects using a fluent interface.

    * **param**: *string*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **getMockBuilder**(*string* **$className**)



    ## PHPUnit_Framework_MockObject_MockBuilder

    ### setMethods()

    Specifies the subset of methods to mock. Default is to mock all of them.

    * **param**: *array*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **setMethods**(*array* **$methods**)

    ### setConstructorArgs()

    Specifies the arguments for the constructor.

    * **param**: *array*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **setConstructorArgs**(*array* **$args**)

    ### setMockClassName()

    Specifies the name for the mock class.

    * **param**: *string*
    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **setMockClassName**(*string* **$name**)

    ### disableOriginalConstructor()

    Suppresses the invocation of the original constructor.

    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **disableOriginalConstructor**()

    ### disableOriginalClone()

    Suppresses the invocation of the original clone constructor.

    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **disableOriginalClone**()

    ### disableAutoload()

    Suppresses the use of class autoloading while creating the mock object.

    * **return**: *PHPUnit_Framework_MockObject_MockBuilder*

    *PHPUnit_Framework_MockObject_MockBuilder* **disableAutoload**()

    ### getMock()

    Creates a mock object using a fluent interface.

    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMock**()

    ### getMockForAbstractClass()

    Creates a mock object for an abstract class using a fluent interface.

    * **return**: *PHPUnit_Framework_MockObject_MockObject*

    *PHPUnit_Framework_MockObject_MockObject* **getMockForAbstractClass**()


  15. Miodrag Tokić revised this gist Sep 30, 2011. 1 changed file with 11 additions and 11 deletions.
    22 changes: 11 additions & 11 deletions phpunit-api.md
    Original file line number Diff line number Diff line change
    @@ -1,38 +1,38 @@
    #### PHPUnit_Framework_TestCase
    ## PHPUnit_Framework_TestCase

    ###### any()
    ### any()

    Returns a matcher that matches when the method it is evaluated for is executed zero or more times.

    * **return**: PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount
    * **return**: *PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount*

    *PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount* **any**()

    ###### never()
    ### never()

    Returns a matcher that matches when the method it is evaluated for is never executed.

    * **return**: PHPUnit_Framework_MockObject_Matcher_InvokedCount
    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedCount*

    *PHPUnit_Framework_MockObject_Matcher_InvokedCount* **never**()

    ###### atLeastOnce()
    ### atLeastOnce()

    Returns a matcher that matches when the method it is evaluated for is executed at least once.

    * **return**: PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce
    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce*

    *PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce* **atLeastOnce**()

    ###### once()
    ### once()

    Returns a matcher that matches when the method it is evaluated for is executed exactly once.

    * **return**: PHPUnit_Framework_MockObject_Matcher_InvokedCount
    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedCount*

    *PHPUnit_Framework_MockObject_Matcher_InvokedCount* **once**()

    ###### exactly()
    ### exactly()

    Returns a matcher that matches when the method it is evaluated for is executed exactly once.

    @@ -41,7 +41,7 @@ Returns a matcher that matches when the method it is evaluated for is executed e

    *PHPUnit_Framework_MockObject_Matcher_InvokedCount* **exactly**(*int* **$count**)

    ###### at()
    ### at()

    Returns a matcher that matches when the method it is evaluated for is invoked at the given $index.

  16. Miodrag Tokić created this gist Sep 30, 2011.
    51 changes: 51 additions & 0 deletions phpunit-api.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    #### PHPUnit_Framework_TestCase

    ###### any()

    Returns a matcher that matches when the method it is evaluated for is executed zero or more times.

    * **return**: PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount

    *PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount* **any**()

    ###### never()

    Returns a matcher that matches when the method it is evaluated for is never executed.

    * **return**: PHPUnit_Framework_MockObject_Matcher_InvokedCount

    *PHPUnit_Framework_MockObject_Matcher_InvokedCount* **never**()

    ###### atLeastOnce()

    Returns a matcher that matches when the method it is evaluated for is executed at least once.

    * **return**: PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce

    *PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce* **atLeastOnce**()

    ###### once()

    Returns a matcher that matches when the method it is evaluated for is executed exactly once.

    * **return**: PHPUnit_Framework_MockObject_Matcher_InvokedCount

    *PHPUnit_Framework_MockObject_Matcher_InvokedCount* **once**()

    ###### exactly()

    Returns a matcher that matches when the method it is evaluated for is executed exactly once.

    * **param**: *int*
    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedCount*

    *PHPUnit_Framework_MockObject_Matcher_InvokedCount* **exactly**(*int* **$count**)

    ###### at()

    Returns a matcher that matches when the method it is evaluated for is invoked at the given $index.

    * **param**: *int*
    * **return**: *PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex*

    *PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex* **at**(*int* **$index**)