PHPackages                             tumtum/mock-extern-service - 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. tumtum/mock-extern-service

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

tumtum/mock-extern-service
==========================

To mock service like mail or UDP socket for functional Tests. TDD, PHPUnit

v0.1.1(9y ago)05761[1 issues](https://github.com/TumTum/mock-extern-service/issues)1MITPHP

Since Jun 9Pushed 9y ago1 watchersCompare

[ Source](https://github.com/TumTum/mock-extern-service)[ Packagist](https://packagist.org/packages/tumtum/mock-extern-service)[ RSS](/packages/tumtum-mock-extern-service/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

Mock Extern Service
===================

[](#mock-extern-service)

[![Build Status](https://camo.githubusercontent.com/7ccd725b4ea4da4b3f04029c666f58026ebc335cfd68a63a34c0d7454de6f06b/68747470733a2f2f7472617669732d63692e6f72672f746d6c6f6265726f6e2f6d6f636b2d65787465726e2d736572766963652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tmloberon/mock-extern-service)

To mock service like mail or UDP socket for functional Tests. The result will be saved in a file and that can you assert.

Installation
------------

[](#installation)

*composer require --dev "tumtum/mock-extern-service"*

Booting
-------

[](#booting)

At first to you must booting this system, that can you do in the bootstrap file [see](tests/bootstrap.php).

```
\tm\MockExternService\Service::boot();

```

Than you must start PHPUnit with PHP interpreter option `-d sendmail_path=[vendor/]bin/smtp-mock-server.php`This script will mock the Mail System.

Assert
------

[](#assert)

#### Mock Mails System

[](#mock-mails-system)

with `tm\MockExternService\Result::MailInbox()` get you the mail Content.

The PHP ini "sendmail\_path" must be set to [smtp-mock-server.php](mock-service/smtp-mock-server.php) script. That get the Mail and save it. This config can only set befor starts the script. Like in php.ini or as command option (php -d)

###### Sample:

[](#sample)

```
public function testMockMailSystem()
{
    $msg = "Content " . time();
    mail('root@@127.0.0.1', "subject", $msg);

    $this->assertContains($msg, MockExternService\Result::MailInbox());
}

```

#### Mock UDP Socket

[](#mock-udp-socket)

with `tm\MockExternService\Result::UdpSockArrived()` get you 2048 Bit of Content. Socket will be listen on:

hostport127.0.0.113010###### Sample:

[](#sample-1)

```
public function testGrayLogServer()
{
    $data = "graylog_data " . time();
    $socket = fsockopen('udp://127.0.0.1:13010');
    fputs($socket, $data);

    $this->assertEquals($data, MockExternService\Result::UdpSockArrived());
}

```

Sample:
-------

[](#sample-2)

See [PHPUnitTest](tests/) command: `php -d sendmail_path=mock-service/smtp-mock-server.php ./vendor/bin/phpunit`.

Chanelog
--------

[](#chanelog)

- v0.1 First Idea

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.3% 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

Unknown

Total

1

Last Release

3308d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/08ef539c93c95c0ccb3c36d51c8cc86a6276e8e5a8fb3fadd983843b013dbba3?d=identicon)[TumTum](/maintainers/TumTum)

---

Top Contributors

[![tmloberon](https://avatars.githubusercontent.com/u/28302826?v=4)](https://github.com/tmloberon "tmloberon (12 commits)")[![TumTum](https://avatars.githubusercontent.com/u/225997?v=4)](https://github.com/TumTum "TumTum (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tumtum-mock-extern-service/health.svg)

```
[![Health](https://phpackages.com/badges/tumtum-mock-extern-service/health.svg)](https://phpackages.com/packages/tumtum-mock-extern-service)
```

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14228.7M341](/packages/dms-phpunit-arraysubset-asserts)[phpbenchmark/phpbenchmark

Easy to use benchmark toolkit for your PHP-application. This library contains classes for comparing algorithms as well as benchmarking application responses

8011.5k2](/packages/phpbenchmark-phpbenchmark)

PHPackages © 2026

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