Download the PHP package quizlet/hammock without Composer
On this page you can find all versions of the php package quizlet/hammock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package hammock
Overview
Hammock is a stand-alone mocking library for the Hack language. At its core, it uses fb_intercept
, which can intercept any function and change its behavior. Hammock aims to provide APIs for mocking public methods and global functions with ease. While it is also possible to mock protected and private methods, it is generally frowned upon to do so. Here are some of Hammock's key features:
- Block-scoped mocking, which automatically restores the original behavior of the mocked function at the end of the block.
- Tracking the intercepted arguments and number of calls into mocked functions.
- Spying on functions without altering their behavior.
Installation
Usage
Mock an object's method:
Same thing, but using a block scope:
Use the intercepted arguments and get the number of calls:
Spy on an object's method without altering its behavior:
Mock a class' method when no instance is available:
The full API documentation can be found in MAIN_API.md.
Advanced use cases can be found in ADVANCED.md.
Contributing
If you ever wanted to contribute to an open-source project, now is the chance! Please read CONTRIBUTING.md to understand the process for submitting a pull request.
Acknowledgements
Thanks to the following people who have contributed to Hammock:
- Tyron Jung
- Riya Dashoriya
- Lexidor
- Karoun Kasraie
- Andrew Sutherland
- Josh Rai
- Shaobo Sun
- Turadg Aleahmad
- Sean Young
- Chris Opperwall
Contact
Please reach out to riya.dashoriya@quizlet.com if you have any questions.
All versions of hammock with dependencies
hhvm/hhvm-autoload Version ^1|^2|^3
hhvm/hsl Version >=1.4 <5
quizlet/fb_intercept_polyfill Version ^1|^2