PHPackages                             console-helpers/prophecy-phpunit - 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. console-helpers/prophecy-phpunit

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

console-helpers/prophecy-phpunit
================================

Integrating the Prophecy mocking library in PHPUnit test cases

v3.0.0(1y ago)03.1k↓50%14MITPHPPHP ^5.6 || ^7 || ^8CI passing

Since Jul 4Pushed 1y agoCompare

[ Source](https://github.com/console-helpers/prophecy-phpunit)[ Packagist](https://packagist.org/packages/console-helpers/prophecy-phpunit)[ Docs](http://phpspec.net)[ RSS](/packages/console-helpers-prophecy-phpunit/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (10)Used By (4)

Prophecy
========

[](#prophecy)

[![Build Status](https://github.com/phpspec/prophecy-phpunit/actions/workflows/ci.yml/badge.svg)](https://github.com/phpspec/prophecy-phpunit/actions/workflows/ci.yml)

Prophecy PhpUnit integrates the [Prophecy](https://github.com/phpspec/prophecy) mocking library with [PHPUnit](https://phpunit.de) to provide an easier mocking in your testsuite.

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

[](#installation)

### Prerequisites

[](#prerequisites)

Prophecy PhpUnit requires PHP 5.6 or greater. Prophecy PhpUnit requires PHPUnit 5.0 or greater.

### Setup through composer

[](#setup-through-composer)

```
composer require --dev phpspec/prophecy-phpunit
```

You can read more about Composer on its [official webpage](https://getcomposer.org).

How to use it
-------------

[](#how-to-use-it)

The trait `ProphecyTrait` provides a method `prophesize($classOrInterface = null)` to use Prophecy. For the usage of the Prophecy doubles, please refer to the [Prophecy documentation](https://github.com/phpspec/prophecy).

Below is a usage example:

```
