kandi background
Explore Kits

14 best PHP Mock libraries in 2022

by Open Weaver kits ✔ Updated: Apr 6, 2022

Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is a critical element of extreme programming, which relies on frequent releases in short development cycles and emphasizes comprehensive unit testing to ensure application stability. Mock objects can be used as a replacement for real objects in unit testing, they often also record how they were used so that you can make assertions about this after the test has finished. Let's see the 14 best PHP Mock libraries in 2022, mockery - simple yet flexible PHP mock object framework; prophecy - Highly opinionated mocking framework for PHP 5.3; phpunit-mock-objects Mock Object library for PHPUnit.

mockeryby mockery

PHP star image 10327 Version:1.5.1

License: Others (Non-SPDX)

Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL).

Support
Quality
Security
License
Reuse

mockeryby mockery

PHP star image 10327 Version:1.5.1 License: Others (Non-SPDX)

Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL).
Support
Quality
Security
License
Reuse

prophecyby phpspec

PHP star image 8530 Version:v1.16.0

License: Permissive (MIT)

Highly opinionated mocking framework for PHP 5.3+

Support
Quality
Security
License
Reuse

prophecyby phpspec

PHP star image 8530 Version:v1.16.0 License: Permissive (MIT)

Highly opinionated mocking framework for PHP 5.3+
Support
Quality
Security
License
Reuse

phpunit-mock-objectsby sebastianbergmann

PHP star image 5025 Version:1.2.3

License: Others (Non-SPDX)

Mock Object library for PHPUnit

Support
Quality
Security
License
Reuse

phpunit-mock-objectsby sebastianbergmann

PHP star image 5025 Version:1.2.3 License: Others (Non-SPDX)

Mock Object library for PHPUnit
Support
Quality
Security
License
Reuse

vfsStreamby bovigo

PHP star image 1352 Version:v1.6.11

License: Permissive (BSD-3-Clause)

vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with any unit test framework, like PHPUnit or SimpleTest.

Support
Quality
Security
License
Reuse

vfsStreamby bovigo

PHP star image 1352 Version:v1.6.11 License: Permissive (BSD-3-Clause)

vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with any unit test framework, like PHPUnit or SimpleTest.
Support
Quality
Security
License
Reuse

AspectMockby Codeception

PHP star image 758 Version:4.1.1

License: Permissive (MIT)

The most powerful and flexible mocking framework for PHPUnit / Codeception.

Support
Quality
Security
License
Reuse

AspectMockby Codeception

PHP star image 758 Version:4.1.1 License: Permissive (MIT)

The most powerful and flexible mocking framework for PHPUnit / Codeception.
Support
Quality
Security
License
Reuse

wp_mockby 10up

PHP star image 601 Version:0.5.0

License: Others (Non-SPDX)

WordPress API Mocking Framework

Support
Quality
Security
License
Reuse

wp_mockby 10up

PHP star image 601 Version:0.5.0 License: Others (Non-SPDX)

WordPress API Mocking Framework
Support
Quality
Security
License
Reuse

phakeby phake

PHP star image 462 Version:v4.2.0

License: Others (Non-SPDX)

PHP Mocking Framework

Support
Quality
Security
License
Reuse

phakeby phake

PHP star image 462 Version:v4.2.0 License: Others (Non-SPDX)

PHP Mocking Framework
Support
Quality
Security
License
Reuse

Phakeby mlively

PHP star image 456 Version:v4.0.0

License: Others (Non-SPDX)

PHP Mocking Framework

Support
Quality
Security
License
Reuse

Phakeby mlively

PHP star image 456 Version:v4.0.0 License: Others (Non-SPDX)

PHP Mocking Framework
Support
Quality
Security
License
Reuse

http-mockby InterNations

PHP star image 387 Version:0.14.0

License: Permissive (MIT)

Mock HTTP requests on the server side in your PHP unit tests

Support
Quality
Security
License
Reuse

http-mockby InterNations

PHP star image 387 Version:0.14.0 License: Permissive (MIT)

Mock HTTP requests on the server side in your PHP unit tests
Support
Quality
Security
License
Reuse

soft-mocksby badoo

PHP star image 302 Version:3.1.1

License: Permissive (MIT)

PHP mocks engine that allows to redefine functions and user methods on-the-fly (provides similar functionality to runkit and uopz extensions)

Support
Quality
Security
License
Reuse

soft-mocksby badoo

PHP star image 302 Version:3.1.1 License: Permissive (MIT)

PHP mocks engine that allows to redefine functions and user methods on-the-fly (provides similar functionality to runkit and uopz extensions)
Support
Quality
Security
License
Reuse

Stubby Codeception

PHP star image 277 Version:4.0.2

License: Permissive (MIT)

Flexible Stub wrapper for PHPUnit's Mock Builder

Support
Quality
Security
License
Reuse

Stubby Codeception

PHP star image 277 Version:4.0.2 License: Permissive (MIT)

Flexible Stub wrapper for PHPUnit's Mock Builder
Support
Quality
Security
License
Reuse

BrainMonkeyby Brain-WP

PHP star image 257 Version:2.6.1

License: Permissive (MIT)

Mocking utility for PHP functions and WordPress plugin API

Support
Quality
Security
License
Reuse

BrainMonkeyby Brain-WP

PHP star image 257 Version:2.6.1 License: Permissive (MIT)

Mocking utility for PHP functions and WordPress plugin API
Support
Quality
Security
License
Reuse

php-mock-phpunitby php-mock

PHP star image 123 Version:2.6.0

License: Permissive (WTFPL)

Mock built-in PHP functions (e.g. time() or rand()) in PHPUnit.

Support
Quality
Security
License
Reuse

php-mock-phpunitby php-mock

PHP star image 123 Version:2.6.0 License: Permissive (WTFPL)

Mock built-in PHP functions (e.g. time() or rand()) in PHPUnit.
Support
Quality
Security
License
Reuse

mock-webserverby donatj

PHP star image 95 Version:v2.4.1

License: Permissive (MIT)

Simple mock web server in PHP for unit testing.

Support
Quality
Security
License
Reuse

mock-webserverby donatj

PHP star image 95 Version:v2.4.1 License: Permissive (MIT)

Simple mock web server in PHP for unit testing.
Support
Quality
Security
License
Reuse

See similar Kits and Libraries

Mock
Testing