-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathToBeAvgTimeTest.php
More file actions
31 lines (24 loc) · 733 Bytes
/
ToBeAvgTimeTest.php
File metadata and controls
31 lines (24 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
declare(strict_types=1);
test('success', function () {
benchmark()
->toAssert()
->toBeAvgTime(1, 1000);
expect(true)->toBeTrue();
});
test('success without arguments', function () {
benchmark()
->toAssert()
->toBeAvgTime();
expect(true)->toBeTrue();
});
test('failure greater than', function () {
benchmark()
->toAssert()
->toBeAvgTime(from: 1000);
})->throws(AssertionError::class, 'The average time value must be greater than or equal to 1000.');
test('failure less than', function () {
benchmark()
->toAssert()
->toBeAvgTime(till: 1);
})->throws(AssertionError::class, 'The average time value must be less than or equal to 1.');