|
2 | 2 |
|
3 | 3 | declare(strict_types=1);
|
4 | 4 |
|
5 |
| - |
6 | 5 | use ReturnEarly\LaravelEnums\Tests\IntEnum;
|
7 | 6 | use ReturnEarly\LaravelEnums\Tests\StringEnum;
|
8 | 7 |
|
9 |
| -test('int enums can be called statically for a value', function() { |
| 8 | +test('int enums can be called statically for a value', function () { |
10 | 9 | $this->assertEquals(1, IntEnum::ONE());
|
11 | 10 | });
|
12 | 11 |
|
13 |
| - |
14 |
| -test('string enums can be called statically for a value', function() { |
| 12 | +test('string enums can be called statically for a value', function () { |
15 | 13 | $this->assertEquals('A', StringEnum::A());
|
16 | 14 | });
|
17 | 15 |
|
18 |
| - |
19 |
| -test('an enum can be checked with is', function() { |
| 16 | +test('an enum can be checked with is', function () { |
20 | 17 | $this->assertTrue(IntEnum::ONE->is(IntEnum::ONE));
|
21 | 18 | $this->assertFalse(IntEnum::ONE->is(IntEnum::TWO));
|
22 | 19 | });
|
23 | 20 |
|
24 |
| - |
25 |
| -test('an enum can be checked with is not', function() { |
| 21 | +test('an enum can be checked with is not', function () { |
26 | 22 | $this->assertTrue(IntEnum::ONE->isNot(IntEnum::TWO));
|
27 | 23 | $this->assertFalse(IntEnum::ONE->isNot(IntEnum::ONE));
|
28 | 24 | });
|
29 | 25 |
|
30 |
| - |
31 |
| -test('an int enum can check if its value is between others', function() { |
| 26 | +test('an int enum can check if its value is between others', function () { |
32 | 27 | $this->assertTrue(IntEnum::TWO->isBetween(IntEnum::ONE, IntEnum::THREE));
|
33 | 28 | $this->assertFalse(IntEnum::ONE->isBetween(IntEnum::TWO, IntEnum::THREE));
|
34 | 29 | });
|
35 | 30 |
|
36 |
| - |
37 |
| -test('an int enum can check if the collection contains its value', function() { |
| 31 | +test('an int enum can check if the collection contains its value', function () { |
38 | 32 | $this->assertTrue(IntEnum::contains('2'));
|
39 | 33 | });
|
40 | 34 |
|
41 |
| -test('an enum can manifest as a collection', function() { |
| 35 | +test('an enum can manifest as a collection', function () { |
42 | 36 | $this->assertEquals(
|
43 | 37 | [
|
44 | 38 | IntEnum::ONE,
|
|
49 | 43 | );
|
50 | 44 | });
|
51 | 45 |
|
52 |
| -test('an enum can get its values as a collection', function() { |
| 46 | +test('an enum can get its values as a collection', function () { |
53 | 47 | $this->assertEquals(
|
54 | 48 | [
|
55 | 49 | 1,
|
|
60 | 54 | );
|
61 | 55 | });
|
62 | 56 |
|
63 |
| -test('an enum can get its names as a collection', function() { |
| 57 | +test('an enum can get its names as a collection', function () { |
64 | 58 | $this->assertEquals(
|
65 | 59 | [
|
66 | 60 | 'ONE',
|
|
71 | 65 | );
|
72 | 66 | });
|
73 | 67 |
|
74 |
| -test('an enum can get its values as a select array', function() { |
| 68 | +test('an enum can get its values as a select array', function () { |
75 | 69 | $this->assertEquals(
|
76 | 70 | [
|
77 | 71 | 1 => 'ONE',
|
|
82 | 76 | );
|
83 | 77 | });
|
84 | 78 |
|
85 |
| -test('an enum can get its values between two others excluding those others', function() { |
| 79 | +test('an enum can get its values between two others excluding those others', function () { |
86 | 80 | expect(IntEnum::valuesBetween(IntEnum::ONE, IntEnum::THREE, false)->toArray())
|
87 | 81 | ->toHaveCount(1);
|
88 | 82 | });
|
89 | 83 |
|
90 |
| -test('an enum can get its values between two others including those others', function() { |
| 84 | +test('an enum can get its values between two others including those others', function () { |
91 | 85 | expect(IntEnum::valuesBetween(IntEnum::ONE, IntEnum::THREE, true)->toArray())
|
92 | 86 | ->toHaveCount(3);
|
93 | 87 | });
|
94 | 88 |
|
95 |
| -test('an enum can check if it is any of a list of enums', function() { |
| 89 | +test('an enum can check if it is any of a list of enums', function () { |
96 | 90 | $this->assertTrue(IntEnum::ONE->isAny([IntEnum::ONE, IntEnum::TWO]));
|
97 | 91 | $this->assertFalse(IntEnum::ONE->isAny([IntEnum::TWO, IntEnum::THREE]));
|
98 | 92 | });
|
99 | 93 |
|
100 |
| -test('an enum can be created from a value', function() { |
| 94 | +test('an enum can be created from a value', function () { |
101 | 95 | $this->assertEquals(IntEnum::ONE, IntEnum::fromValue(1));
|
102 | 96 | });
|
103 | 97 |
|
104 |
| -test('an enum can be created from another enum', function() { |
| 98 | +test('an enum can be created from another enum', function () { |
105 | 99 | $this->assertEquals(IntEnum::ONE, IntEnum::fromValue(IntEnum::ONE));
|
106 | 100 | });
|
107 | 101 |
|
108 |
| -test('an enum can get its name', function() { |
| 102 | +test('an enum can get its name', function () { |
109 | 103 | $this->assertEquals('ONE', IntEnum::ONE->name());
|
110 | 104 | });
|
111 | 105 |
|
112 |
| -test('an enum can get its value', function() { |
| 106 | +test('an enum can get its value', function () { |
113 | 107 | $this->assertEquals(1, IntEnum::ONE->value());
|
114 | 108 | });
|
115 | 109 |
|
116 |
| -test('a missing method throws a bad method call exception', function() { |
| 110 | +test('a missing method throws a bad method call exception', function () { |
117 | 111 | $this->expectException(BadMethodCallException::class);
|
118 | 112 | IntEnum::FOUR();
|
119 | 113 | });
|
0 commit comments