awesome-repositories.com
Blog
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectAboutHow we rankPressMCP server
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
sebastianbergmann avatar

sebastianbergmann/phpunit-mock-objectsArchived

0
View on GitHub↗
4,934 stars·153 forks·PHP·1 viewphpunit.de↗

Phpunit Mock Objects

This project is a mocking framework and library designed for creating simulated objects to isolate code and verify interactions during PHPUnit testing. It serves as a toolset for writing and running automated tests in PHP to ensure software correctness.

The library replaces real object dependencies with controlled doubles to test specific code paths and simulate complex class behaviors. This enables the verification of logic within individual PHP classes by mocking the inputs and outputs of their collaborators.

The framework provides capabilities for runtime object synthesis and interception, including dynamic proxy generation, method call tracking, and behavioral stubbing. It supports expectation-based verification and the synthesis of concrete classes from interfaces.

Features

  • Dynamic Mock Objects - Provides runtime generation of proxy objects to simulate dependencies and track interactions during unit tests.
  • Interaction Expectations - Provides verification of specific method calls, arguments, and invocation frequency to determine test success.
  • Method Stubbings - Allows defining custom return values or callbacks for mocked methods to simulate specific dependency behaviors.
  • Method Interception - Captures method arguments and return values to verify interactions between the system under test and its dependencies.
  • Mocking Frameworks - Provides a complete system for replacing real object dependencies with controlled doubles to test specific code paths.
  • PHP Testing Frameworks - Facilitates the verification of individual PHP classes by mocking the inputs and outputs of collaborator objects.
  • Unit Testing - Enables the creation of isolated unit tests by simulating complex dependencies within the PHPUnit environment.
  • Runtime Synthesized Implementations - Synthesizes concrete classes from interfaces at runtime to create mock objects for dependencies without existing implementations.
  • Method Interception Proxies - Implements dynamic proxy systems that intercept method calls to facilitate behavioral stubbing and verification.
  • Service Isolation Utilities - Ensures code is verified independently by removing dependencies on external services or databases through the use of doubles.
  • Reflection-Based Proxies - Uses PHP reflection to generate proxy classes at runtime that override original methods and track invocations.

Star history

Star history chart for sebastianbergmann/phpunit-mock-objectsStar history chart for sebastianbergmann/phpunit-mock-objects

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Frequently asked questions

What does sebastianbergmann/phpunit-mock-objects do?

This project is a mocking framework and library designed for creating simulated objects to isolate code and verify interactions during PHPUnit testing. It serves as a toolset for writing and running automated tests in PHP to ensure software correctness.

What are the main features of sebastianbergmann/phpunit-mock-objects?

The main features of sebastianbergmann/phpunit-mock-objects are: Dynamic Mock Objects, Interaction Expectations, Method Stubbings, Method Interception, Mocking Frameworks, PHP Testing Frameworks, Unit Testing, Runtime Synthesized Implementations.

What are some open-source alternatives to sebastianbergmann/phpunit-mock-objects?

Open-source alternatives to sebastianbergmann/phpunit-mock-objects include: phpspec/prophecy — Prophecy is a PHP mocking framework and test double library used to simulate object dependencies during unit testing.… sebastianbergmann/phpunit — PHPUnit is a unit testing framework and automated testing tool for the PHP ecosystem. It provides a comprehensive… mockito/mockito — Mockito is a Java mocking framework and JUnit testing library used to create simulated objects and stub method calls… moq/moq4 — Moq4 is a .NET mocking framework used to create simulated implementations of interfaces and abstract classes. It… sinonjs/sinon — Sinon is a JavaScript test double library and mocking framework used to isolate code and verify behavior during unit… codeception/codeception — Codeception is a full-stack testing framework for PHP applications that provides a unified interface for unit,…

Open-source alternatives to Phpunit Mock Objects

Similar open-source projects, ranked by how many features they share with Phpunit Mock Objects.
  • phpspec/prophecyphpspec avatar

    phpspec/prophecy

    8,480View on GitHub↗

    Prophecy is a PHP mocking framework and test double library used to simulate object dependencies during unit testing. It serves as a behavioral testing tool for creating mocks, stubs, and dummies to isolate code and ensure predictable test results. The framework enables interaction verification by tracking method call counts and arguments to validate that specific interactions occurred. It supports defining specific return values or custom logic for method calls to simulate various execution scenarios. The library provides capabilities for argument matching based on type or value, interactio

    PHP
    View on GitHub↗8,480
  • sebastianbergmann/phpunitsebastianbergmann avatar

    sebastianbergmann/phpunit

    20,033View on GitHub↗

    PHPUnit is a unit testing framework and automated testing tool for the PHP ecosystem. It provides a comprehensive suite for writing and running automated tests to verify the functional correctness of PHP code and identify software bugs. The framework supports both unit and end-to-end testing to validate individual code units and complete application workflows. It includes capabilities for automated regression testing and test suite management, allowing for the execution of targeted subsets of tests. The tool provides mechanisms for identifying flaky tests through automatic retries and test r

    PHP
    View on GitHub↗20,033
  • mockito/mockitomockito avatar

    mockito/mockito

    15,432View on GitHub↗

    Mockito is a Java mocking framework and JUnit testing library used to create simulated objects and stub method calls to isolate components during unit tests. It functions as a dynamic proxy generator and bytecode instrumentation tool, allowing for the creation of runtime substitutes that mimic the behavior of real classes. The framework distinguishes itself by providing the ability to mock final classes and methods, bypassing standard language restrictions through bytecode modification. This capability enables the testing of legacy code that lacks interfaces. The toolset covers behavioral mo

    Java
    View on GitHub↗15,432
  • moq/moq4Moq avatar

    Moq/moq4

    6,387View on GitHub↗

    Moq4 is a .NET mocking framework used to create simulated implementations of interfaces and abstract classes. It serves as a test double generator and behavior verification tool, allowing developers to isolate code during unit testing by replacing real dependencies with programmed mocks. The framework enables the definition of expected method behaviors and return values to control the execution flow of tests. It provides specialized capabilities for simulating methods that use output or reference parameters and mechanisms to monitor and trigger events on simulated objects. The library includ

    C#
    View on GitHub↗6,387
  • See all 30 alternatives to Phpunit Mock Objects→