PHPackages                             facile-it/moka - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. facile-it/moka

ActiveLibrary[Testing &amp; Quality](/categories/testing)

facile-it/moka
==============

Shorthand for creating mock objects

v2.4.0(6y ago)911.7k[2 issues](https://github.com/facile-it/moka/issues)[1 PRs](https://github.com/facile-it/moka/pulls)MITPHPPHP ^7.1CI failing

Since Jun 14Pushed 6y ago34 watchersCompare

[ Source](https://github.com/facile-it/moka)[ Packagist](https://packagist.org/packages/facile-it/moka)[ Docs](http://github.com/facile-it/moka)[ RSS](/packages/facile-it-moka/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)Dependencies (8)Versions (32)Used By (0)

Moka - Shorthand for Creating Mock Objects
==========================================

[](#moka---shorthand-for-creating-mock-objects)

[![Packagist](https://camo.githubusercontent.com/8c4d654637e655f5bea70bc720653bde126924abbc464b9f91a6fde3d7c6882b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f666163696c652d69742f6d6f6b612e737667)](/LICENSE)[![GitHub release](https://camo.githubusercontent.com/1dae7e89232ddd8e7647045464bdaab14e4d1d22064c359081db0025cec04d9e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f666163696c652d69742f6d6f6b612e737667)](https://packagist.org/packages/facile-it/moka)[![Travis](https://camo.githubusercontent.com/fd72d00be3b6568f959e20831cb8fc5ef27ee4ba54c34bfbcc15df678acf6405/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f666163696c652d69742f6d6f6b612f6d61737465722e737667)](https://travis-ci.org/facile-it/moka/branches)[![Scrutinizer Coverage](https://camo.githubusercontent.com/11e65c6334f12ba9474ea45df3a4f5f6d0fc88ad956e7537be94ff1bd7487029/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f666163696c652d69742f6d6f6b612e737667)](https://scrutinizer-ci.com/g/facile-it/moka/?branch=master)[![Scrutinizer](https://camo.githubusercontent.com/017165f201b2c4d32ebdd2ab0c032907794142d433fb62ef72ce27c0c0d4ca04/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f666163696c652d69742f6d6f6b612e737667)](https://scrutinizer-ci.com/g/facile-it/moka/?branch=master)[![Packagist](https://camo.githubusercontent.com/cee98d9935e5816fb425819291e32e982c0194e454a1feec2d9c84cc2f28b37a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666163696c652d69742f6d6f6b612e737667)](https://packagist.org/packages/facile-it/moka)

Tired of spending most of your testing time mocking objects like there's no tomorrow? **Yes.**
**Moka** provides you with two simple methods to reduce your effort on such a tedious task, and with an incredible abstraction layer between the most popular mock engines and **you**.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require --dev facile-it/moka
```

Usage
-----

[](#usage)

To use **Moka** in your tests simply `use` function `Moka\Plugin\PHPUnit\moka()` (see generators section [below](#strategies)) and run `Moka::clean()` before every test. A simple interface will let you create *moka* (mock) objects and decorate them with *stub* methods and properties via a fluent interface:

```
