Passed
Push — master ( 0b999e...3d12f2 )
by Baptiste
43s
created

the_json_path_should_be_less_than()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php declare(strict_types=1);
2
namespace Behapi\Json;
3
4
use Webmozart\Assert\Assert;
5
6
trait ComparisonTrait
7
{
8
    abstract protected function getValue(?string $path);
9
10
    /** @Then in the json, :path should be greater than :expected */
11
    final public function the_json_path_should_be_greater_than(string $path, int $expected): void
12
    {
13
        Assert::greaterThan($this->getValue($path), $expected);
14
    }
15
16
    /** @Then in the json, :path should be greater than or equal to :expected */
17
    final public function the_json_path_should_be_greater_or_equal_than(string $path, int $expected): void
18
    {
19
        Assert::greaterThanEq($this->getValue($path), $expected);
20
    }
21
22
    /** @Then in the json, :path should be less than :expected */
23
    final public function the_json_path_should_be_less_than(string $path, int $expected): void
24
    {
25
        Assert::lessThan($this->getValue($path), $expected);
26
    }
27
28
    /** @Then in the json, :path should be less than or equal to :expected */
29
    final public function the_json_path_should_be_less_or_equal_than(string $path, int $expected): void
30
    {
31
        Assert::lessThanEq($this->getValue($path), $expected);
32
    }
33
}
34