PHP Package: php-mock/php-mock-phpunit

PHP library for mocking PHP functions in PHPUnit tests using PHP-Mock library

Current Version: 2.13.1
Last Updated: 2025-09-23
PHP Requirement: >=7
Dependencies:
php-mock/php-mock
⚠️ To ensure full functionality, the above dependencies might be required.

Package Description

php-mock-phpunit is a powerful PHP library that allows developers to mock PHP functions in PHPUnit tests effortlessly. With this library, you can easily simulate function behaviors, enabling efficient testing of complex PHP applications. It seamlessly integrates with PHPUnit, offering a seamless experience for developers in creating robust and reliable test suites. Whether you're working on legacy code or modern PHP projects, php-mock-phpunit is an indispensable tool for ensuring code quality and reliability.

📦 Show all available classes🔗 View on GitHub

Download Latest Version: 2.13.1

Download Download v2.13.1

Previous Versions

Code Integration Example

Make sure to include the correct namespace and class paths for proper usage.

<?php
// Example from PHPlibraries.com
require_once 'libs/php-mock/php-mock-phpunit/2.13.1/loader.php';
require_once 'libs/php-mock/php-mock/{lib_version}/loader.php';

use PhpMock\Mock;
use PhpMock\MockBuilder;

$obj = new Mock();
echo '✅ Test OK: ' . get_class($obj);
?>

We aim to make using PHP packages easier without Composer. If something doesn't work, let us know — we'll fix it promptly.

Community Discussion

Ask questions, share tips, or report issues below.