Skip to content
This repository was archived by the owner on Mar 31, 2018. It is now read-only.
This repository was archived by the owner on Mar 31, 2018. It is now read-only.

Convenience Function for Mocking Methods #204

@paulstatezny

Description

@paulstatezny

Convenience Function for Mocking Methods

Acceptance Criteria

  1. TestCase::mockMethod exists, and takes the following parameters:
    • Name of mock object (Must be a key in $this->mocks)
    • Name of method (Must be a method of that mock object)
    • Callback to provide to returnCallback

This will transform:

$this->mocks['roleService']->expects($this->any())
    ->method('addRoleForUser')
    ->will($this->returnCallback(function ($user, $role) {
        // Code here
    }));

Into this:

$this->mockMethod('roleService', 'addRoleForUser', function ($user, $role) {
    // Code here
});

Tasks

  • Add method to TestCase

Additional Notes

  • None

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions