All Projects → dg → Bypass Finals

dg / Bypass Finals

Licence: other
Removes final keywords from source code on-the-fly and allows mocking of final methods and classes. It can be used together with any test tool such as PHPUnit or Mockery.

Projects that are alternatives of or similar to Bypass Finals

specter-php
JSON Mocking and Testing for PHP
Stars: ✭ 18 (-92.11%)
Mutual labels:  phpunit, mocking
php-test-generator
Generate test cases for existing PHP files
Stars: ✭ 47 (-79.39%)
Mutual labels:  phpunit, mocking
Mockery
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).
Stars: ✭ 10,048 (+4307.02%)
Mutual labels:  mocking, phpunit
Phpunit Bridge
Provides utilities for PHPUnit, especially user deprecation notices management.
Stars: ✭ 2,150 (+842.98%)
Mutual labels:  phpunit
Mocktopus
Mocking framework for Rust
Stars: ✭ 179 (-21.49%)
Mutual labels:  mocking
Brainmonkey
Mocking utility for PHP functions and WordPress plugin API
Stars: ✭ 191 (-16.23%)
Mutual labels:  phpunit
Sinon Jest Cheatsheet
Some examples on how to achieve the same goal with either of both libraries: sinon and jest. Also some of those goals achievable only by one of these tools.
Stars: ✭ 226 (-0.88%)
Mutual labels:  mocking
Examples
Examples of Mock Service Worker usage with various frameworks and libraries.
Stars: ✭ 163 (-28.51%)
Mutual labels:  mocking
Steward
PHP libraries that makes Selenium WebDriver + PHPUnit functional testing easy and robust
Stars: ✭ 215 (-5.7%)
Mutual labels:  phpunit
Django Mock Queries
A library for mocking django queryset functions in memory for testing
Stars: ✭ 187 (-17.98%)
Mutual labels:  mocking
Testify
A toolkit with common assertions and mocks that plays nicely with the standard library
Stars: ✭ 14,996 (+6477.19%)
Mutual labels:  mocking
Xamarin.forms.mocks
Library for running Xamarin.Forms inside of unit tests
Stars: ✭ 179 (-21.49%)
Mutual labels:  mocking
Phony
Mocks, stubs, and spies for PHP.
Stars: ✭ 193 (-15.35%)
Mutual labels:  mocking
Mocktail
A mock library for Dart inspired by mockito
Stars: ✭ 172 (-24.56%)
Mutual labels:  mocking
Fake Xrm Easy
The testing framework for Dynamics CRM and Dynamics 365 which runs on an In-Memory context and deals with mocks or fakes for you
Stars: ✭ 216 (-5.26%)
Mutual labels:  mocking
Vcrpy
Automatically mock your HTTP interactions to simplify and speed up testing
Stars: ✭ 2,144 (+840.35%)
Mutual labels:  mocking
Python Mocket
a socket mock framework - for all kinds of socket animals, web-clients included
Stars: ✭ 209 (-8.33%)
Mutual labels:  mocking
Js Mocking Fundamentals
JavaScript Mocking Fundamentals on TestingJavaScript.com
Stars: ✭ 182 (-20.18%)
Mutual labels:  mocking
Respx
Mock HTTPX with awesome request patterns and response side effects 🦋
Stars: ✭ 183 (-19.74%)
Mutual labels:  mocking
Gaos
HTTP mocking to test API services for chaos scenarios
Stars: ✭ 191 (-16.23%)
Mutual labels:  mocking

Bypass Finals

Downloads this Month Build Status Latest Stable Version License

Introduction

Removes final keywords from source code on-the-fly and allows mocking of final methods and classes. It can be used together with any test tool such as PHPUnit, Mockery or Nette Tester.

Installation

The recommended way to install is through Composer:

composer require dg/bypass-finals --dev

It requires PHP version 7.1 (or 5.6 in case of release 1.1) and supports PHP up to 8.0.

Usage

Simply call this:

DG\BypassFinals::enable();

You need to enable it before the classes you want to remove the final are loaded. So call it as soon as possible, preferably right after vendor/autoload.php is loaded.

Note that final internal PHP classes like Closure cannot be mocked.

You can choose to only bypass finals in specific files or directories:

DG\BypassFinals::setWhitelist([
    '*/Nette/*',
]);

This gives you finer control and can solve issues with certain frameworks and libraries.

Support Project

Do you like BypassFinals?

Donate

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].