2017 © Pedro PelĂĄez
 

library mockery-callable-mock

Mockery Callable Mock

image

tmarsteel/mockery-callable-mock

Mockery Callable Mock

  • Friday, September 15, 2017
  • by tmarsteel
  • Repository
  • 1 Watchers
  • 0 Stars
  • 110 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

Mockery Callable Mock

<?php

use Akamon\MockeryCallableMock\MockeryCallableMock;

// creating a mockery function/callable
$mock = new MockeryCallableMock();

// call it normally
$mock('foo', 'bar');
call_user_func($mock, 'foo', 'bar');

// add it expectations
$mock->shouldBeCalled(); // returns a mockery expectation, so you can use it normally

$mock->shouldBeCalled()->with('foo')->once();
$mock('foo');

$mock->shouldBeCalled()->withNoArgs()->twice();
$mock();
$mock();

// returned values
$mock->shouldBeCalled()->andReturn('foo');
$retval = $mock();

// creating stubs
$stub = new MockeryCallableMock();

$stub->canBeCalled()->with('foo')->andReturn('bar');

// verifying calls
$mock = new MockeryCallableMock();
$mock('bar');

$mock->shouldHaveBeenCalled()->with('bar');
$mock->shouldNotHaveBeenCalled('foo');

// spying
$realAction = function($arg1, $arg2) { /* ... */ }; // or
$realAction = [$this, 'methodToInvoke'];

$callableSpy = new MockeryCallableMock($realAction);

$callableSpy(); // $realAction gets invoked
$callableSpy()->shouldHaveBeenCalled();

Requirements

PHP 7.0+, (*1)

Authors

License

Akamon Mockery Callable Mock is licensed under the MIT License. See the LICENSE file for full details., (*2)

The Versions

15/09 2017

dev-master

9999999-dev

Mockery Callable Mock

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Tobias Marstaller

mock mockery callable

15/09 2017

v2.1.0

2.1.0.0

Mockery Callable Mock

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Tobias Marstaller

mock mockery callable

15/09 2017

v2.0.0

2.0.0.0

Mockery Callable Mock

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Tobias Marstaller

mock mockery callable

27/04 2016

2.0.0-RC1

2.0.0.0-RC1

Mockery Callable Mock

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

mock mockery callable

31/01 2014

v1.0.0

1.0.0.0

Mockery Callable Mock

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

mock mockery callable