PHP code example of calderawp / caldera-interop-fixture

1. Go to this page and download the library: Download calderawp/caldera-interop-fixture library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

calderawp / caldera-interop-fixture example snippets



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

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



$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
                ],
            ]
        ]
];

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

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()
		);
	}


}