3
3
namespace Illuminated \Helpers \Tests \array ;
4
4
5
5
use Illuminated \Helpers \Tests \TestCase ;
6
+ use PHPUnit \Framework \Attributes \Test ;
6
7
7
8
class ArrayExceptValueTest extends TestCase
8
9
{
9
- /** @test */
10
- public function it_returns_array_itself_after_excluding_not_existing_value ()
10
+ #[Test]
11
+ public function it_returns_array_itself_after_excluding_not_existing_value (): void
11
12
{
12
13
$ this ->assertEquals ([], array_except_value ([], null ));
13
14
$ this ->assertEquals ([], array_except_value ([], 'foo ' ));
14
15
$ this ->assertEquals (['foo ' , 'bar ' , 'baz ' ], array_except_value (['foo ' , 'bar ' , 'baz ' ], 'bax ' ));
15
16
}
16
17
17
- /** @test */
18
- public function it_preserves_keys_after_excluding_value ()
18
+ #[Test]
19
+ public function it_preserves_keys_after_excluding_value (): void
19
20
{
20
21
$ this ->assertEquals (
21
22
[0 => 'foo ' , 2 => 'baz ' ],
22
23
array_except_value (['foo ' , 'bar ' , 'baz ' ], 'bar ' )
23
24
);
24
25
}
25
26
26
- /** @test */
27
- public function it_excludes_all_occurrences_of_the_value ()
27
+ #[Test]
28
+ public function it_excludes_all_occurrences_of_the_value (): void
28
29
{
29
30
$ this ->assertEquals (
30
31
[0 => 'foo ' , 4 => 'bar ' ],
31
32
array_except_value (['foo ' , 'baz ' , 'baz ' , 'baz ' , 'bar ' ], 'baz ' )
32
33
);
33
34
}
34
35
35
- /** @test */
36
- public function it_can_exclude_null_value ()
36
+ #[Test]
37
+ public function it_can_exclude_null_value (): void
37
38
{
38
39
$ this ->assertEquals (['foo ' , 'bar ' , 'baz ' ], array_except_value (['foo ' , 'bar ' , 'baz ' , null ], null ));
39
40
}
40
41
41
- /** @test */
42
- public function it_can_exclude_boolean_true_value ()
42
+ #[Test]
43
+ public function it_can_exclude_boolean_true_value (): void
43
44
{
44
45
$ this ->assertEquals (['foo ' , 'bar ' , 'baz ' ], array_except_value (['foo ' , 'bar ' , 'baz ' , true , true ], true ));
45
46
}
46
47
47
- /** @test */
48
- public function it_can_exclude_boolean_false_value ()
48
+ #[Test]
49
+ public function it_can_exclude_boolean_false_value (): void
49
50
{
50
51
$ this ->assertEquals (
51
52
['foo ' , 'bar ' , 'baz ' , 5 => null ],
52
53
array_except_value (['foo ' , 'bar ' , 'baz ' , false , false , null ], false )
53
54
);
54
55
}
55
56
56
- /** @test */
57
- public function it_can_exclude_integer_value ()
57
+ #[Test]
58
+ public function it_can_exclude_integer_value (): void
58
59
{
59
60
$ this ->assertEquals (
60
61
[0 => 23 , 2 => 14 , 3 => 11 ],
61
62
array_except_value ([23 , 17 , 14 , 11 ], 17 )
62
63
);
63
64
}
64
65
65
- /** @test */
66
- public function it_can_exclude_float_value ()
66
+ #[Test]
67
+ public function it_can_exclude_float_value (): void
67
68
{
68
69
$ this ->assertEquals (
69
70
[0 => 23.3 , 1 => 17.2 , 3 => 11.1 ],
70
71
array_except_value ([23.3 , 17.2 , 14.5 , 11.1 ], 14.5 )
71
72
);
72
73
}
73
74
74
- /** @test */
75
- public function it_can_exclude_string_value ()
75
+ #[Test]
76
+ public function it_can_exclude_string_value (): void
76
77
{
77
78
$ this ->assertEquals (['foo ' , 'bar ' ], array_except_value (['foo ' , 'bar ' , 'baz ' ], 'baz ' ));
78
79
}
79
80
80
- /** @test */
81
- public function it_can_exclude_multiple_different_values ()
81
+ #[Test]
82
+ public function it_can_exclude_multiple_different_values (): void
82
83
{
83
84
$ array = ['foo ' , 'bar ' , 'baz ' , 'bax ' ];
84
85
$ this ->assertEquals ([1 => 'bar ' , 2 => 'baz ' ], array_except_value ($ array , ['foo ' , 'bax ' ]));
85
86
}
86
87
87
- /** @test */
88
- public function it_works_with_associative_array_and_single_value ()
88
+ #[Test]
89
+ public function it_works_with_associative_array_and_single_value (): void
89
90
{
90
91
$ array = [
91
92
'foo ' => 'bar ' ,
@@ -95,8 +96,8 @@ public function it_works_with_associative_array_and_single_value()
95
96
$ this ->assertEquals (['foo ' => 'bar ' , 'foz ' => 'faz ' ], array_except_value ($ array , 'bax ' ));
96
97
}
97
98
98
- /** @test */
99
- public function it_works_with_associative_array_and_multiple_values ()
99
+ #[Test]
100
+ public function it_works_with_associative_array_and_multiple_values (): void
100
101
{
101
102
$ array = [
102
103
'foo ' => 'bar ' ,
0 commit comments