File tree Expand file tree Collapse file tree 4 files changed +88
-4
lines changed Expand file tree Collapse file tree 4 files changed +88
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
declare (strict_types=1 );
4
4
5
- namespace CommitGlobal \Enums \Tests ;
5
+ namespace CommitGlobal \Enums \Tests \ IntBackedEnum ;
6
6
7
7
use CommitGlobal \Enums \Tests \Fixtures \IntBackedEnum ;
8
8
use Orchestra \Testbench \TestCase ;
9
9
use PHPUnit \Framework \Attributes \Test ;
10
10
11
- class ArrayableIntTest extends TestCase
11
+ class ArrayableTest extends TestCase
12
12
{
13
13
#[Test]
14
14
public function it_can_list_names_of_an_int_backed_enum (): void
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace CommitGlobal \Enums \Tests \IntBackedEnum ;
6
+
7
+ use CommitGlobal \Enums \Tests \Fixtures \IntBackedEnum ;
8
+ use Orchestra \Testbench \TestCase ;
9
+ use PHPUnit \Framework \Attributes \Test ;
10
+
11
+ class ComparableTest extends TestCase
12
+ {
13
+ #[Test]
14
+ public function it_can_compare_int_backed_enum_instances (): void
15
+ {
16
+ $ this ->assertTrue (IntBackedEnum::ONE ->is (IntBackedEnum::ONE ));
17
+ $ this ->assertTrue (IntBackedEnum::TWO ->is (IntBackedEnum::TWO ));
18
+ $ this ->assertTrue (IntBackedEnum::THREE ->is (IntBackedEnum::THREE ));
19
+ $ this ->assertTrue (IntBackedEnum::FOUR ->is (IntBackedEnum::FOUR ));
20
+ $ this ->assertTrue (IntBackedEnum::FIVE ->is (IntBackedEnum::FIVE ));
21
+ }
22
+
23
+ #[Test]
24
+ public function it_can_compare_int_backed_enum_values (): void
25
+ {
26
+ $ this ->assertTrue (IntBackedEnum::ONE ->is (1 ));
27
+ $ this ->assertTrue (IntBackedEnum::TWO ->is (2 ));
28
+ $ this ->assertTrue (IntBackedEnum::THREE ->is (3 ));
29
+ $ this ->assertTrue (IntBackedEnum::FOUR ->is (4 ));
30
+ $ this ->assertTrue (IntBackedEnum::FIVE ->is (5 ));
31
+ }
32
+
33
+ #[Test]
34
+ public function it_can_compare_int_backed_enum_with_null (): void
35
+ {
36
+ $ this ->assertTrue (IntBackedEnum::ONE ->isNot (null ));
37
+ $ this ->assertTrue (IntBackedEnum::TWO ->isNot (null ));
38
+ $ this ->assertTrue (IntBackedEnum::THREE ->isNot (null ));
39
+ $ this ->assertTrue (IntBackedEnum::FOUR ->isNot (null ));
40
+ $ this ->assertTrue (IntBackedEnum::FIVE ->isNot (null ));
41
+ }
42
+ }
Original file line number Diff line number Diff line change 2
2
3
3
declare (strict_types=1 );
4
4
5
- namespace CommitGlobal \Enums \Tests ;
5
+ namespace CommitGlobal \Enums \Tests \ StringBackedEnum ;
6
6
7
7
use CommitGlobal \Enums \Tests \Fixtures \StringBackedEnum ;
8
8
use Orchestra \Testbench \TestCase ;
9
9
use PHPUnit \Framework \Attributes \Test ;
10
10
11
- class ArrayableStringTest extends TestCase
11
+ class ArrayableTest extends TestCase
12
12
{
13
13
#[Test]
14
14
public function it_can_list_names_of_a_string_backed_enum (): void
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace CommitGlobal \Enums \Tests \StringBackedEnum ;
6
+
7
+ use CommitGlobal \Enums \Tests \Fixtures \StringBackedEnum ;
8
+ use Orchestra \Testbench \TestCase ;
9
+ use PHPUnit \Framework \Attributes \Test ;
10
+
11
+ class ComparableTest extends TestCase
12
+ {
13
+ #[Test]
14
+ public function it_can_compare_string_backed_enum_instances (): void
15
+ {
16
+ $ this ->assertTrue (StringBackedEnum::A->is (StringBackedEnum::A));
17
+ $ this ->assertTrue (StringBackedEnum::B->is (StringBackedEnum::B));
18
+ $ this ->assertTrue (StringBackedEnum::C->is (StringBackedEnum::C));
19
+ $ this ->assertTrue (StringBackedEnum::D->is (StringBackedEnum::D));
20
+ $ this ->assertTrue (StringBackedEnum::E->is (StringBackedEnum::E));
21
+ }
22
+
23
+ #[Test]
24
+ public function it_can_compare_string_backed_enum_values (): void
25
+ {
26
+ $ this ->assertTrue (StringBackedEnum::A->is ('a ' ));
27
+ $ this ->assertTrue (StringBackedEnum::B->is ('b ' ));
28
+ $ this ->assertTrue (StringBackedEnum::C->is ('c ' ));
29
+ $ this ->assertTrue (StringBackedEnum::D->is ('d ' ));
30
+ $ this ->assertTrue (StringBackedEnum::E->is ('e ' ));
31
+ }
32
+
33
+ #[Test]
34
+ public function it_can_compare_string_backed_enum_with_null (): void
35
+ {
36
+ $ this ->assertTrue (StringBackedEnum::A->isNot (null ));
37
+ $ this ->assertTrue (StringBackedEnum::B->isNot (null ));
38
+ $ this ->assertTrue (StringBackedEnum::C->isNot (null ));
39
+ $ this ->assertTrue (StringBackedEnum::D->isNot (null ));
40
+ $ this ->assertTrue (StringBackedEnum::E->isNot (null ));
41
+ }
42
+ }
You can’t perform that action at this time.
0 commit comments