-
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.28 KB
/
ArrayableTest.php
File metadata and controls
51 lines (42 loc) · 1.28 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\StringBackedEnum;
use CommitGlobal\Enums\Tests\Fixtures\StringBackedEnum;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\Test;
class ArrayableTest extends TestCase
{
#[Test]
public function it_can_list_names_of_a_string_backed_enum(): void
{
$names = StringBackedEnum::names();
$expected = ['A', 'B', 'C', 'D', 'E'];
$this->assertIsArray($names);
$this->assertCount(5, $names);
$this->assertSame($expected, $names);
}
#[Test]
public function it_can_list_values_of_a_string_backed_enum(): void
{
$values = StringBackedEnum::values();
$expected = ['a', 'b', 'c', 'd', 'e'];
$this->assertIsArray($values);
$this->assertCount(5, $values);
$this->assertSame($expected, $values);
}
#[Test]
public function it_can_list_options_of_a_string_backed_enum(): void
{
$options = StringBackedEnum::options();
$expected = [
'a' => 'A',
'b' => 'B',
'c' => 'C',
'd' => 'D',
'e' => 'E',
];
$this->assertIsArray($options);
$this->assertCount(5, $options);
$this->assertSame($expected, $options);
}
}