PHPackages                             timesplinter/proxy-mock - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. timesplinter/proxy-mock

AbandonedLibrary[Testing &amp; Quality](/categories/testing)

timesplinter/proxy-mock
=======================

v0.5.1(6y ago)140.4k2MITPHPPHP ^7.0CI failing

Since Jul 5Pushed 6y agoCompare

[ Source](https://github.com/TiMESPLiNTER/proxy-mock)[ Packagist](https://packagist.org/packages/timesplinter/proxy-mock)[ RSS](/packages/timesplinter-proxy-mock/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (1)Versions (13)Used By (0)

ProxyMock
=========

[](#proxymock)

**THIS PACKAGE IS ABANDONNED**

To replace a service of the Symfony container with a mock make a public alias on the service and then you're able to set a mock for it in the test case (if you have access to the container which is the case in ̀Symfony's `KernelTestCase`).

**config/services.yaml**

```
services:
    my.service:
        class: My\Service

```

**config/services\_test.yaml**

```
services:
    my.service.test:
        alias: my.service
        public: true

```

**Your test case `extends KernelTestCase`**

```
use My\Service;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;

final class ConsumeUserMessagesFromCoreTest extends KernelTestCase
{
    public function testSomething(): void
    {
        // Access the service over the public alias defined in "services_test.yaml"
        self::$container->set('my.service.test', $this->getMockBuilder(Service::class)->getMock());
    }
}
```

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a6a4bef9f13d9b786c5265d2cfee98a5136eda5c935cc90d3dbc926d05da9d17/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f54694d4553504c694e5445522f70726f78792d6d6f636b2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/TiMESPLiNTER/proxy-mock/?branch=master)

This library helps to create a proxy instance of a class which then can hold a PHPUnit mock of it. That way you can manipulate the mock which sits inside the proxy class but never have to change the proxy class.

This can be useful for example in cases of read-only containers where you can't override services at runtime. (The dependency injection container component of Symfony 4 will most likely behave like that.)

```
class Foo { ... }

$factory = new ProxyMockFactory();
$proxyMock = $factory->create(Foo::class);

// In a PHPUnit test case
$mock = $this->getMockBuilder(Foo::class)
    ->disableOriginalConstructor()
    ->getMock();

$proxyMock->setMock($mock);
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~76 days

Recently: every ~170 days

Total

12

Last Release

2402d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/598854?v=4)[Pascal Münst](/maintainers/TiMESPLiNTER)[@TiMESPLiNTER](https://github.com/TiMESPLiNTER)

---

Top Contributors

[![TiMESPLiNTER](https://avatars.githubusercontent.com/u/598854?v=4)](https://github.com/TiMESPLiNTER "TiMESPLiNTER (15 commits)")[![dudologicus](https://avatars.githubusercontent.com/u/8045953?v=4)](https://github.com/dudologicus "dudologicus (3 commits)")[![dominikzogg](https://avatars.githubusercontent.com/u/1011217?v=4)](https://github.com/dominikzogg "dominikzogg (1 commits)")[![sawmurai](https://avatars.githubusercontent.com/u/6454986?v=4)](https://github.com/sawmurai "sawmurai (1 commits)")

---

Tags

mockphpphpunitproxytesting

### Embed Badge

![Health badge](/badges/timesplinter-proxy-mock/health.svg)

```
[![Health](https://phpackages.com/badges/timesplinter-proxy-mock/health.svg)](https://phpackages.com/packages/timesplinter-proxy-mock)
```

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[jasonmccreary/laravel-test-assertions

A set of helpful assertions when testing Laravel applications.

3513.9M32](/packages/jasonmccreary-laravel-test-assertions)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)[typo3/testing-framework

The TYPO3 testing framework provides base classes for unit, functional and acceptance testing.

675.0M775](/packages/typo3-testing-framework)[robiningelbrecht/phpunit-pretty-print

Prettify PHPUnit output

76460.0k15](/packages/robiningelbrecht-phpunit-pretty-print)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
