-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayableTest.php
More file actions
51 lines (42 loc) · 1.27 KB
/
ArrayableTest.php
File metadata and controls
51 lines (42 loc) · 1.27 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
<?php
declare(strict_types=1);
namespace CommitGlobal\Enums\Tests\IntBackedEnum;
use CommitGlobal\Enums\Tests\Fixtures\IntBackedEnum;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\Test;
class ArrayableTest extends TestCase
{
#[Test]
public function it_can_list_names_of_an_int_backed_enum(): void
{
$names = IntBackedEnum::names();
$expected = ['ONE', 'TWO', 'THREE', 'FOUR', 'FIVE'];
$this->assertIsArray($names);
$this->assertCount(5, $names);
$this->assertSame($expected, $names);
}
#[Test]
public function it_can_list_values_of_an_int_backed_enum(): void
{
$values = IntBackedEnum::values();
$expected = [1, 2, 3, 4, 5];
$this->assertIsArray($values);
$this->assertCount(5, $values);
$this->assertSame($expected, $values);
}
#[Test]
public function it_can_list_options_of_an_int_backed_enum(): void
{
$options = IntBackedEnum::options();
$expected = [
1 => 'one',
2 => 'two',
3 => 'three',
4 => 'four',
5 => 'five',
];
$this->assertIsArray($options);
$this->assertCount(5, $options);
$this->assertSame($expected, $options);
}
}