CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.10 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.10
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
      • Constraint
      • Fixture
      • Stub
    • Utility
    • Validation
    • View

Class MockBuilder

PHPUnit MockBuilder with muted Reflection errors

Namespace: Cake\TestSuite

Method Summary

  • __construct() public
  • allowMockingUnknownTypes() public
  • disableArgumentCloning() public

    Disables the cloning of arguments passed to mocked methods.

  • disableAutoload() public

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

  • disableOriginalClone() public

    Disables the invocation of the original clone constructor.

  • disableOriginalConstructor() public

    Disables the invocation of the original constructor.

  • disableProxyingToOriginalMethods() public

    Disables the invocation of the original methods.

  • disallowMockingUnknownTypes() public
  • enableArgumentCloning() public

    Enables the cloning of arguments passed to mocked methods.

  • enableAutoload() public

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

  • enableOriginalClone() public

    Enables the invocation of the original clone constructor.

  • enableOriginalConstructor() public

    Enables the invocation of the original constructor.

  • enableProxyingToOriginalMethods() public

    Enables the invocation of the original methods.

  • getMock() public

    Creates a mock object using a fluent interface.

  • getMockForAbstractClass() public

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

  • getMockForTrait() public

    Creates a mock object for a trait using a fluent interface.

  • setConstructorArgs() public

    Specifies the arguments for the constructor.

  • setMethods() public

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

  • setMethodsExcept() public

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

  • setMockClassName() public

    Specifies the name for the mock class.

  • setProxyTarget() public

    Sets the proxy target.

  • setSupressedErrorHandler() public static

    Set error handler to supress ReflectionType::__toString() deprecation warning

Method Detail

__construct() ¶ public

__construct(TestCase $testCase, array|string $type)
Parameters
TestCase $testCase
array|string $type

allowMockingUnknownTypes() ¶ public

allowMockingUnknownTypes(): MockBuilder
Returns
MockBuilder

disableArgumentCloning() ¶ public

disableArgumentCloning(): MockBuilder

Disables the cloning of arguments passed to mocked methods.

Returns
MockBuilder

disableAutoload() ¶ public

disableAutoload(): MockBuilder

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

Returns
MockBuilder

disableOriginalClone() ¶ public

disableOriginalClone(): MockBuilder

Disables the invocation of the original clone constructor.

Returns
MockBuilder

disableOriginalConstructor() ¶ public

disableOriginalConstructor(): MockBuilder

Disables the invocation of the original constructor.

Returns
MockBuilder

disableProxyingToOriginalMethods() ¶ public

disableProxyingToOriginalMethods(): MockBuilder

Disables the invocation of the original methods.

Returns
MockBuilder

disallowMockingUnknownTypes() ¶ public

disallowMockingUnknownTypes(): MockBuilder
Returns
MockBuilder

enableArgumentCloning() ¶ public

enableArgumentCloning(): MockBuilder

Enables the cloning of arguments passed to mocked methods.

Returns
MockBuilder

enableAutoload() ¶ public

enableAutoload(): MockBuilder

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

Returns
MockBuilder

enableOriginalClone() ¶ public

enableOriginalClone(): MockBuilder

Enables the invocation of the original clone constructor.

Returns
MockBuilder

enableOriginalConstructor() ¶ public

enableOriginalConstructor(): MockBuilder

Enables the invocation of the original constructor.

Returns
MockBuilder

enableProxyingToOriginalMethods() ¶ public

enableProxyingToOriginalMethods(): MockBuilder

Enables the invocation of the original methods.

Returns
MockBuilder

getMock() ¶ public

getMock(): MockObject

Creates a mock object using a fluent interface.

Returns
MockObject

getMockForAbstractClass() ¶ public

getMockForAbstractClass(): MockObject

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

Returns
MockObject

getMockForTrait() ¶ public

getMockForTrait(): MockObject

Creates a mock object for a trait using a fluent interface.

Returns
MockObject

setConstructorArgs() ¶ public

setConstructorArgs(array $args): MockBuilder

Specifies the arguments for the constructor.

Parameters
array $args
Returns
MockBuilder

setMethods() ¶ public

setMethods(array|null $methods = null): MockBuilder

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

Parameters
array|null $methods optional
Returns
MockBuilder

setMethodsExcept() ¶ public

setMethodsExcept(array $methods = []): MockBuilder

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

Parameters
array $methods optional
Returns
MockBuilder

setMockClassName() ¶ public

setMockClassName(string $name): MockBuilder

Specifies the name for the mock class.

Parameters
string $name
Returns
MockBuilder

setProxyTarget() ¶ public

setProxyTarget(object $object): MockBuilder

Sets the proxy target.

Parameters
object $object
Returns
MockBuilder

setSupressedErrorHandler() ¶ public static

setSupressedErrorHandler(): void

Set error handler to supress ReflectionType::__toString() deprecation warning

Returns
void
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs