PHPackages                             cirrusidentity/simplesamlphp-test-utils - 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. cirrusidentity/simplesamlphp-test-utils

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

cirrusidentity/simplesamlphp-test-utils
=======================================

Utilities to aid in testing simpleSAMLphp modules

v1.18.1(5y ago)14.0k4[3 PRs](https://github.com/cirrusidentity/simplesamlphp-test-utils/pulls)1LGPL-2.1-onlyPHPPHP &gt;=7.2

Since Feb 8Pushed 1y ago6 watchersCompare

[ Source](https://github.com/cirrusidentity/simplesamlphp-test-utils)[ Packagist](https://packagist.org/packages/cirrusidentity/simplesamlphp-test-utils)[ RSS](/packages/cirrusidentity-simplesamlphp-test-utils/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (4)Versions (9)Used By (1)

[![Build Status](https://camo.githubusercontent.com/21aadd3211b6cfb96693acd9940e51ba8a02773e35ddc4239b010596e938cffc/68747470733a2f2f7472617669732d63692e6f72672f6369727275736964656e746974792f73696d706c6573616d6c7068702d746573742d7574696c732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/cirrusidentity/simplesamlphp-test-utils)

simplesamlphp-test-utils
========================

[](#simplesamlphp-test-utils)

Utilities to aid in testing SimpleSAMLphp modules

Installation
============

[](#installation)

Install as a dev dependency using composer

```
composer require --dev  cirrusidentity/simplesamlphp-test-utils:dev-master

```

Update the dependency

```
composer update -dev  cirrusidentity/simplesamlphp-test-utils

```

Usage
=====

[](#usage)

This project makes heavy use of `AspectMock` to make SSP's internal easier to test. Adjust your phpunit bootstrap.php per  to setup AspectMock and also ensure you set `backupGlobals="false"` in phpunit.xml. See this projects `boostrap.php` on some workarounds for getting AspectMock to play nicely with SSP's custom class loader

You can sanity check your project by calling `SanityChecker::confirmAspectMockConfigured()`in a test. See `AspectMockConfiguredTest` for an example.

Clearing Static State
---------------------

[](#clearing-static-state)

You *should* reset `AspectMock` after each test.

```
use AspectMock\Test as test;
...
    protected function tearDown() {
        test::clean(); // remove all registered test doubles
    }
```

Several SSP components also cache things across all tests. Some of these classes are marked with the `\SimpleSAML\Utils\ClearableState` interface and you can clear this state at the appropriate time for your tests.

Mock Redirects
--------------

[](#mock-redirects)

Your module may need to redirect the user somewhere. If you try to create a unit test for a redirect you'll normally have trouble since SSP's redirect method eventually calls `exit`You can use `MockHttp` (which internally uses `AspectMock`) to change the behavior of the redirect method to throw an exception instead. You can then catch the exception and asserted the correct URL was being redirect to

```
        // Enable throwing an exception when redirects would normally be called.
        MockHttp::throwOnRedirectTrustedURL();
        $params = [
            'state' => '1234'
        ];
        try {
            HTTP::redirectTrustedURL('http://my.url.com', $params);
            $this->fail('Exception expected');
        } catch (RedirectException $e) {
            $this->assertEquals('redirectTrustedURL', $e->getMessage());
            $this->assertEquals('http://my.url.com', $e->getUrl());
            $this->assertEquals($params, $e->getParams());
        }
```

Mock Auth Sources
-----------------

[](#mock-auth-sources)

See MockAuthSourceTest. `bootstrap.php` needs to explicitly load the Source.php file

```
$kernel->loadFile($projectRoot . '/vendor/simplesamlphp/simplesamlphp/lib/SimpleSAML/Auth/Source.php');

```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~555 days

Total

5

Last Release

479d ago

Major Versions

v1.18.1 → v2.x-dev2025-03-11

PHP version history (3 changes)1.16.0PHP &gt;=5.6

v1.18.1PHP &gt;=7.2

v2.x-devPHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/932934?v=4)[Patrick](/maintainers/pradtke)[@pradtke](https://github.com/pradtke)

---

Top Contributors

[![pradtke](https://avatars.githubusercontent.com/u/932934?v=4)](https://github.com/pradtke "pradtke (18 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![sigmunau](https://avatars.githubusercontent.com/u/4507494?v=4)](https://github.com/sigmunau "sigmunau (1 commits)")

---

Tags

simplesamlphp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/cirrusidentity-simplesamlphp-test-utils/health.svg)

```
[![Health](https://phpackages.com/badges/cirrusidentity-simplesamlphp-test-utils/health.svg)](https://phpackages.com/packages/cirrusidentity-simplesamlphp-test-utils)
```

###  Alternatives

[egroupware/egroupware

EGroupware extends a classic groupware with an integrated CRM-system, a secure file-server and Collabora Online Office.

2931.7k](/packages/egroupware-egroupware)

PHPackages © 2026

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