PHPackages                             calderawp/caldera-interop-fixture - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. calderawp/caldera-interop-fixture

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

calderawp/caldera-interop-fixture
=================================

0.1.0(8y ago)11GPL-2.0PHPPHP ^7.1

Since May 8Pushed 8y ago2 watchersCompare

[ Source](https://github.com/CalderaWP/caldera-interop-fixture)[ Packagist](https://packagist.org/packages/calderawp/caldera-interop-fixture)[ RSS](/packages/calderawp-caldera-interop-fixture/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/0c78b469b57958a1a88db7e75e6da8b1f0165a0b70e6776bf2c3749b1a018f15/68747470733a2f2f7472617669732d63692e6f72672f63616c6465726177702f63616c646572612d696e7465726f702d666978747572652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/calderawp/caldera-interop-fixture)

Auto-magic tests for [caldera-interop Interoperable Servies](https://github.com/CalderaWP/caldera-interop/blob/processor/src/Service/README.md)

Why?
----

[](#why)

- Every interoperable set MUST transform between array/entitiy/model/collection/HTTP message/ etc. consistently.
- We can only trust that claim if we test a reasonable approximation of all of the possible combination of values for an entity's properties.
- Writing all those tests takes to long.

Install
-------

[](#install)

`composer require calderawp/caldera-interop-fixture --dev`

Requires
--------

[](#requires)

- PHP 7.1

Status
------

[](#status)

BETA

Usage
-----

[](#usage)

This testing component is designed to be used with interoperable sets that are provided to the container using a `InteropProvider`. This component is comprised of two parts.

### Fixture and Prop Description

[](#fixture-and-prop-description)

The `InteropFixture` class takes an array-like set of data `PropData` that describes the properties and possible values of an entity. The `PropData` is the least auto-magic part of this process.

#### PropData

[](#propdata)

For each property, we provide that property's name and an array of values. For example, to add a `xpLevel` prop:

```
$propData = new PropData();
$propData->testProps = [
   'xpLevel' => [
       'values' => []
   ]
];
```

The `values` index collects arrays that provides an input value and an expected output value. For example, to test that the absolute value of our property is always returned:

```
[
    'value' => -10,
    'expect' => 10
],
```

Completer example:

```
$propData = new PropData();
$propData->testProps = [
   'xpLevel' => [
       'values' => [
           [
               'value' => -10,
               'expect' => 10
           ],
           [
               'value' => 10,
               'expect' => 10
           ],
       ]
   ],
   'otherLevel' => [
           'values' => [
               [
                   'value' => 10,
                   'expect' => 10
               ],
               [
                   'value' => 10,
                   'expect' => 10
               ],
           ]
       ]
];
```

#### `InteropFixture`

[](#interopfixture)

```
use calderawp\InteropFixture\Entities\PropData;
use calderawp\InteropFixture\InteropFixture;
$fixture = new InteropFixture($propData);
```

### Using In Tests

[](#using-in-tests)

```
use calderawp\HelloExtension\HelloInteropService;
use calderawp\interop\CalderaForms;
use calderawp\interop\Interfaces\CalderaFormsApp;
use calderawp\InteropFixture\Entities\PropData;
/**
 * Class HelloInteropTest
 *
 * Test the example Hello interop binding
 */
class MyInteropTest extends UnitTestCase
{
	//Make fixture tests available
	use TestsInterops;

	public function testInterop()
	{
		//This provides 64 assertions for a set with two properties :)
		$this->checkFixture(
			new InteropFixture(PropData::fromArray([
				//array like examples above
			])),
			//The interoperable service provider for this set
			new SomeService(),
			//main app
			CalderaForms::factory()
		);
	}

}
```

### Complete Example

[](#complete-example)

See Tests/example for an example interoperable set that is tested in by the test in tests/Unit/HelloInteropTest. This example has two properites. Both with custom validation logic. 64 assertions are generated for this set.

Development
-----------

[](#development)

### Install

[](#install-1)

Requires git and Composer

- `git clone git@github.com:calderawp/caldera-interop-fixture.git`
- `cd caldera-interop-fixture`
- `composer install`

Coding Standard: Caldera (psr2 with tabs). Enforces using phpcs.

### Testing

[](#testing)

Tests are divided between unit tests and currently no other types of tests.

#### Install

[](#install-2)

All testing dependencies are installed with composer.

#### Use

[](#use)

Run these commands from the plugin's root directory.

- Run All Tests and Code Formatting
    - `composer tests`
    - Includes lints, unit tests and fixes documented below
- Run Unit Tests
    - `composer unit-tests`
    - Unit tests are located in `/Tests/Unit`
- Fix All Code Formatting
    - `composer formatting`
    - Runs code sniffs and code fixes and lints.

Stuff.
------

[](#stuff)

Copyright 2018 CalderaWP LLC. License: GPL v2 or later.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

2975d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca938daf3f2a666cd32c7bdb6e30714da6fe0e6cd5012fe4864b18afae43fbcd?d=identicon)[Shelob9](/maintainers/Shelob9)

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/calderawp-caldera-interop-fixture/health.svg)

```
[![Health](https://phpackages.com/badges/calderawp-caldera-interop-fixture/health.svg)](https://phpackages.com/packages/calderawp-caldera-interop-fixture)
```

PHPackages © 2026

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