-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFailureTest.php
More file actions
69 lines (54 loc) · 1.92 KB
/
FailureTest.php
File metadata and controls
69 lines (54 loc) · 1.92 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
declare(strict_types=1);
namespace Tests\Benchmark;
use DragonCode\Benchmark\Exceptions\ValueIsNotCallableException;
use Tests\TestCase;
use TypeError;
class FailureTest extends TestCase
{
public function testAsProperties(): void
{
$this->expectException(TypeError::class);
$this->expectExceptionMessage('must be of type Closure|array, int given');
$this->benchmark()->compare(123);
}
public function testAsArray(): void
{
$this->expectException(ValueIsNotCallableException::class);
$this->expectExceptionMessage('The array value must be of type callable, integer given.');
$this->benchmark()->compare([
'first' => 123,
'second' => 123,
]);
}
public function testAsPropertiesWithIterations(): void
{
$this->expectException(TypeError::class);
$this->expectExceptionMessage('must be of type Closure|array, int given');
$this->benchmark()->iterations(5)->compare(123);
}
public function testAsArrayWithIterations(): void
{
$this->expectException(ValueIsNotCallableException::class);
$this->expectExceptionMessage('The array value must be of type callable, integer given.');
$this->benchmark()->iterations(5)->compare([
'first' => 123,
'second' => 123,
]);
}
public function testAsPropertiesWithoutData(): void
{
$this->expectException(TypeError::class);
$this->expectExceptionMessage('must be of type Closure|array, int given');
$this->benchmark()->compare(123);
}
public function testAsArrayWithoutData(): void
{
$this->expectException(ValueIsNotCallableException::class);
$this->expectExceptionMessage('The array value must be of type callable, integer given.');
$this->benchmark()->compare([
'first' => 123,
'second' => 123,
]);
}
}