bag2/doppel

Test double implementation for static methods

v0.1.0 2021-03-21 18:15 UTC

This package is auto-updated.

Last update: 2024-12-17 13:52:58 UTC


README

Build Status Infection MSI

Doppel is a PHP mocking framework for static methods.

Example

<?php

class Vehicle {
    public static function horn() {
        return 'Beep!';
    }
}

echo Vehicle::horn(), PHP_EOL; // Beep!

$doppel = (new Bag2\Doppel\Factory)->create();
$doppel->add('Vehicle::horn')->andReturn('Boo!');

echo Vehicle::horn(), PHP_EOL; // Boo!

$doppel->finalize();

echo Vehicle::horn(), PHP_EOL; // Beep!

Copyright

This package is licenced under Mozilla Public License Version 2.0.

Copyright 2020 Baguette HQ

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://www.mozilla.org/en-US/MPL/2.0/.