2017 © Pedro Peláez
 

library php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

image

php-mock/php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

  • Thursday, June 14, 2018
  • by malkusch
  • Repository
  • 2 Watchers
  • 16 Stars
  • 135,281 Installations
  • PHP
  • 45 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 9 Versions
  • 15 % Grown

The README.md

.github/workflows/tests.yml, (*1)

Mock PHP built-in functions with Mockery

This package integrates the function mock library PHP-Mock with Mockery., (*2)

Installation

Use Composer:, (*3)

composer require --dev php-mock/php-mock-mockery

Usage

PHPMockery::mock() let's you build a function mock which can be equiped with Mockery's expectations. After your test you'll have to disable all created function mocks by calling Mockery::close()., (*4)

Example

namespace foo;

use phpmock\mockery\PHPMockery;

$mock = PHPMockery::mock(__NAMESPACE__, "time")->andReturn(3);
assert (3 == time());

\Mockery::close();

Restrictions

This library comes with the same restrictions as the underlying php-mock:, (*5)

  • Only unqualified function calls in a namespace context can be mocked. E.g. a call for time() in the namespace foo is mockable, a call for \time() is not., (*6)

  • The mock has to be defined before the first call to the unqualified function in the tested class. This is documented in Bug #68541. In most cases you can ignore this restriction. But if you happen to run into this issue you can call PHPMockery::define() before that first call. This would define a side effectless namespaced function., (*7)

License and authors

This project is free and under the WTFPL. Responsable for this project is Markus Malkusch markus@malkusch.de., (*8)

Donations

If you like this project and feel generous donate a few Bitcoins here: 1335STSwu9hST4vcMRppEPgENMHD2r1REK, (*9)

The Versions

14/06 2018

dev-master

9999999-dev https://github.com/php-mock/php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

  Sources   Download

WTFPL

The Requires

 

The Development Requires

bdd tdd test mock stub test double function mockery

27/03 2018

1.3.0

1.3.0.0 https://github.com/php-mock/php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

  Sources   Download

WTFPL

The Requires

 

The Development Requires

bdd tdd test mock stub test double function mockery

01/12 2017

dev-6-expose-more

dev-6-expose-more https://github.com/php-mock/php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

  Sources   Download

WTFPL

The Requires

 

The Development Requires

bdd tdd test mock stub test double function mockery

13/10 2017

1.2.0

1.2.0.0 https://github.com/php-mock/php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

  Sources   Download

WTFPL

The Requires

 

The Development Requires

bdd tdd test mock stub test double function mockery

11/11 2015

1.1.0

1.1.0.0 https://github.com/php-mock/php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

  Sources   Download

WTFPL

The Requires

 

The Development Requires

bdd tdd test mock stub test double function mockery

26/10 2015

1.0.0

1.0.0.0 https://github.com/php-mock/php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

  Sources   Download

WTFPL

The Requires

 

The Development Requires

bdd tdd test mock stub test double function mockery

20/09 2015

0.3

0.3.0.0 https://github.com/php-mock/php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

  Sources   Download

WTFPL

The Requires

 

The Development Requires

bdd tdd test mock stub test double function mockery

02/04 2015

0.2

0.2.0.0 https://github.com/php-mock/php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

  Sources   Download

WTFPL

The Requires

 

The Development Requires

bdd tdd test mock stub test double function mockery

02/04 2015

0.1

0.1.0.0 https://github.com/php-mock/mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

  Sources   Download

WTFPL

The Requires

 

The Development Requires

bdd tdd test mock stub test double function mockery