ApplicationInboundEventContract   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A verifyContract() 0 10 2
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
}