PHPackages                             hafriedlander/silverstripe-phockito - 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. hafriedlander/silverstripe-phockito

ActiveSilverstripe-module[Testing &amp; Quality](/categories/testing)

hafriedlander/silverstripe-phockito
===================================

Integrate Phockito (a PHP Mocking framework) with SilverStripe

1.0.0(12y ago)434.6k6[5 PRs](https://github.com/hafriedlander/silverstripe-phockito/pulls)2BSD-3-ClausePHP

Since Oct 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/hafriedlander/silverstripe-phockito)[ Packagist](https://packagist.org/packages/hafriedlander/silverstripe-phockito)[ RSS](/packages/hafriedlander-silverstripe-phockito/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (2)Versions (2)Used By (2)

Phockito integration module for SilverStripe
============================================

[](#phockito-integration-module-for-silverstripe)

Phockito generates subclasses of the class under mock or spy. This doesn't work well with SilverStripe, which builds a manifest of classes and expects them to remain static during execution.

This module provides integration between SilverStripe and Phockito, so that every time you create a mock or spy with Phockito, it's registered in SilverStripe's ClassManifest.

This all happens automatically, so you don't have to worry about it - just add this module to your composer.json, then start calling Phocktio::mock or Phockito::spy in your tests.

If you're calling `Phockito::include_hamcrest()` to use Hamcrest matchers like `anything()`, please remember to limit the inclusion to the test execution by placing it in `setUpOnce()`. Placing it outside of the class scope and executing the include calls when then PHP file is first included by PHP can cause clashes with PHPUnit's built-in matchers. To further avoid clashes, you should also avoid including these matchers yourself (`PHPUnit\Framework\Assert\Functions.php`).

```
