the_json_path_should_be_less_than()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php declare(strict_types=1);
2
namespace Behapi\Json;
3
4
use 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::that($this->getValue($path))
14
            ->greaterThan($expected)
15
        ;
16
    }
17
18
    /** @Then in the json, :path should be greater than or equal to :expected */
19
    final public function the_json_path_should_be_greater_or_equal_than(string $path, int $expected): void
20
    {
21
        Assert::that($this->getValue($path))
22
            ->greaterOrEqualThan($expected)
23
        ;
24
    }
25
26
    /** @Then in the json, :path should be less than :expected */
27
    final public function the_json_path_should_be_less_than(string $path, int $expected): void
28
    {
29
        Assert::that($this->getValue($path))
30
            ->lessThan($expected)
31
        ;
32
    }
33
34
    /** @Then in the json, :path should be less than or equal to :expected */
35
    final public function the_json_path_should_be_less_or_equal_than(string $path, int $expected): void
36
    {
37
        Assert::that($this->getValue($path))
38
            ->lessOrEqualThan($expected)
39
        ;
40
    }
41
}
42