ApplicationInboundEventContract::verifyContract()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 10
rs 10
1
<?php
2
3
namespace App\Tests\TestUtils\Contracts;
4
5
use PHPUnit\Framework\TestCase;
6
7
abstract class ApplicationInboundEventContract extends TestCase
8
{
9
10
    use ApplicationEventContractLoader;
11
12
    protected function verifyContract(string $eventClass, string $contract): bool
13
    {
14
        $data = $this->getInboundEvent($contract);
15
16
        try {
17
            new $eventClass($data);
18
        } catch (\Exception $e) {
19
            $this->fail(sprintf("Event Class %s cannot be constructed with the Contract Data '%s': %s", $eventClass, $contract, $e->getMessage()));
20
        }
21
        return true;
22
    }
23
24
25
}