MapSpec   A
last analyzed

Complexity

Total Complexity 22

Size/Duplication

Total Lines 628
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 9

Importance

Changes 0
Metric Value
dl 0
loc 628
rs 9.9193
c 0
b 0
f 0
wmc 22
lcom 1
cbo 9

19 Methods

Rating   Name   Duplication   Size   Complexity  
A constructorBehavior() 0 16 2
A isEmptyBehavior() 0 20 1
A clearBehavior() 0 15 1
B hasMethodsGroupBehavior() 0 31 1
B removeMethodsGroupBehavior() 0 36 1
B onEachBehavior() 0 35 1
A onEachRecursiveBehavior() 0 50 1
B filterBehavior() 0 28 2
B mapBehavior() 0 24 1
B reduceBehavior() 0 32 1
B keyMethodsGroupBehavior() 0 38 1
B countValuesFrequencyBehavior() 0 37 1
B calculateProductBehavior() 0 31 1
B popBehavior() 0 25 1
B shiftBehavior() 0 25 1
A keysToLoweCaseBehavior() 0 22 1
B keysToUpperCaseBehavior() 0 24 1
B chunkByBehavior() 0 27 1
B arrayAccessBehavior() 0 33 2
1
<?php
2
3
namespace PHPKitchen\Platform\Specs\Unit\Struct;
4
5
use PHPKitchen\Platform\Specs\Base\Spec;
6
use PHPKitchen\Platform\Struct\Collection;
7
use PHPKitchen\Platform\Struct\Map;
8
9
/**
10
 * Specification for {@link Map}
11
 *
12
 * @author Dmitry Kolodko <[email protected]>
13
 */
14
class MapSpec extends Spec {
15
    protected const INVALID_KEY_ERROR_MESSAGE = 'Map support only `string` keys.';
16
17
    /**
18
     * @test
19
     */
20
    public function constructorBehavior() {
21
22
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
23
        $I->describe('constructor `behavior`');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
24
25
        try {
26
            Map::of([1, 2, 3]);
27
            $errorMessage = 'Constructor validation failed';
28
        } catch (\Throwable $error) {
29
            $errorMessage = $error->getMessage();
30
        }
31
32
        $I->expectThat('Map reject arrays with non-string keys');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
33
        $I->seeString($errorMessage)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
34
          ->isEqualTo(self::INVALID_KEY_ERROR_MESSAGE);
35
    }
36
37
    /**
38
     * @test
39
     */
40
    public function isEmptyBehavior() {
41
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
42
43
        $I->describe('behavior of empty assert method');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
44
        $map = Map::of([
45
            'first' => 1,
46
            'second' => 2,
47
            'third' => 3,
48
        ]);
49
50
        $I->expectThat('collection with data considered as not empty');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
51
        $I->seeBool($map->isEmpty())
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
52
          ->isFalse();
53
54
        $map = Map::of([]);
55
56
        $I->expectThat('collection without data considered as empty');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
57
        $I->seeBool($map->isEmpty())
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
58
          ->isTrue();
59
    }
60
61
    /**
62
     * @test
63
     */
64
    public function clearBehavior() {
65
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
66
67
        $I->describe('behavior of collection cleaning method');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
68
        $map = Map::of([
69
            'first' => 1,
70
            'second' => 2,
71
            'third' => 3,
72
        ]);
73
        $map->clear();
74
75
        $I->expectThat('after cleaning collection become empty');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
76
        $I->seeBool($map->isEmpty())
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
77
          ->isTrue();
78
    }
79
80
    /**
81
     * @test
82
     */
83
    public function hasMethodsGroupBehavior() {
84
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
85
86
        $I->describe('behavior of "has" methods group');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
87
        $map = Map::of([
88
            'first' => 1,
89
            'second' => 2,
90
            'third' => 3,
91
            'null-element' => null,
92
        ]);
93
94
        $I->expectThat('`hasKey` returns `true` for existing and `false` for not existing keys');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
95
        $I->seeBool($map->hasKey($firstElementKey = 'first'))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
96
          ->isTrue();
97
        $I->seeBool($map->hasKey($notExistingKey = 'not-exists'))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
98
          ->isFalse();
99
100
        $I->expectThat('`has` returns `true` for existing and `false` for not existing element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
101
        $I->seeBool($map->has($secondElement = 2))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
102
          ->isTrue();
103
        $I->seeBool($map->has($notExistingElement = 56))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
104
          ->isFalse();
105
106
        $I->expectThat('`hasSet` returns `true` for set and `false` for not set and null elements at specified key');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
107
        $I->seeBool($map->hasSet($firstElementKey = 'first'))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
108
          ->isTrue();
109
        $I->seeBool($map->hasSet($nullElementKey = 'null-element'))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
110
          ->isFalse();
111
        $I->seeBool($map->hasSet($notExistingElementKey = 'not-exists'))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
112
          ->isFalse();
113
    }
114
115
    /**
116
     * @test
117
     */
118
    public function removeMethodsGroupBehavior() {
119
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
120
121
        $I->describe('behavior of "remove" methods group');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
122
        $map = Map::of([
123
            'first' => 1,
124
            'first-duplicate-1' => 3,
125
            'first-duplicate-2' => 3,
126
            'first-duplicate-3' => 3,
127
            'second-duplicate-1' => 4,
128
            'second-duplicate-2' => 4,
129
            'second-duplicate-3' => 4,
130
        ]);
131
132
        $I->expectThat('`removeAt` unset element with specified key');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
133
134
        $map->removeAt($firstElementKey = 'first');
135
        $I->seeBool($map->hasKey($firstElementKey = 'first'))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
136
          ->isFalse();
137
138
        $I->expectThat('`remove` unset first occurrences of specified element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
139
140
        $map->remove($elementWithDuplicates = 3);
141
        $I->seeBool($map->hasKey('first-duplicate-1'))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
142
          ->isFalse();
143
        $I->seeBool($map->hasKey('first-duplicate-2'))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
144
          ->isTrue();
145
        $I->seeBool($map->hasKey('first-duplicate-3'))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
146
          ->isTrue();
147
148
        $I->expectThat('`removeAll` unset all occurrences of specified element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
149
150
        $map->removeAll($secondDuplicate = 4);
151
        $I->seeBool($map->has($secondDuplicate = 4))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
152
          ->isFalse();
153
    }
154
155
    /**
156
     * @test
157
     */
158
    public function onEachBehavior() {
159
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
160
161
        $I->describe('`onEach` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
162
163
        $map = Map::of([
164
            'first' => 1,
165
            'second' => 2,
166
            'third' => 3,
167
        ]);
168
169
        $I->expectThat('callback does not modify elements passed by value');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
170
171
        $map->onEach(function ($element) {
172
            $element++;
173
        });
174
        $I->see($map)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
175
          ->isEqualTo(Map::of([
176
              'first' => 1,
177
              'second' => 2,
178
              'third' => 3,
179
          ]));
180
181
        $I->expectThat('callback can modify elements passed by link');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
182
183
        $map->onEach(function (&$element) {
184
            $element++;
185
        });
186
        $I->see($map)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
187
          ->isEqualTo(Map::of([
188
              'first' => 2,
189
              'second' => 3,
190
              'third' => 4,
191
          ]));
192
    }
193
194
    /**
195
     * @test
196
     */
197
    public function onEachRecursiveBehavior() {
198
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
199
200
        $I->describe('`onEachRecursive` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
201
202
        $map = Map::of([
203
            'first' => 1,
204
            'second' => 2,
205
            'third' => 3,
206
            'sub-collection' => [
207
                'first' => 1,
208
                'second' => 2,
209
                'third' => 3,
210
            ],
211
        ]);
212
213
        $I->expectThat('callback does not modify elements passed by value');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
214
215
        $map->onEachRecursive(function ($element) {
216
            $element++;
217
        });
218
        $I->see($map)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
219
          ->isEqualTo(Map::of([
220
              'first' => 1,
221
              'second' => 2,
222
              'third' => 3,
223
              'sub-collection' => [
224
                  'first' => 1,
225
                  'second' => 2,
226
                  'third' => 3,
227
              ],
228
          ]));
229
230
        $I->expectThat('callback can modify elements passed by link');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
231
232
        $map->onEachRecursive(function (&$element) {
233
            $element++;
234
        });
235
        $I->see($map)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
236
          ->isEqualTo(Map::of([
237
              'first' => 2,
238
              'second' => 3,
239
              'third' => 4,
240
              'sub-collection' => [
241
                  'first' => 2,
242
                  'second' => 3,
243
                  'third' => 4,
244
              ],
245
          ]));
246
    }
247
248
    /**
249
     * @test
250
     */
251
    public function filterBehavior() {
252
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
253
254
        $I->describe('`filter` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
255
256
        $map = Map::of([
257
            'first' => 1,
258
            'second' => 2,
259
            'third' => 3,
260
            'third-duplicate' => 3,
261
        ]);
262
263
        $I->expectThat('filter callable is able to change the collection ');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
264
265
        $filteredCollection = $map->filter(function ($element) {
266
            if ($element == 3) {
0 ignored issues
show
Unused Code introduced by
This if statement, and the following return statement can be replaced with return !($element == 3);.
Loading history...
267
                return false;
268
            };
269
270
            return true;
271
        });
272
        $I->lookAt('collection filtered from `3` elements');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
273
        $I->see($filteredCollection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
274
          ->isEqualTo(Map::of([
275
              'first' => 1,
276
              'second' => 2,
277
          ]));
278
    }
279
280
    /**
281
     * @test
282
     */
283
    public function mapBehavior() {
284
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
285
286
        $I->describe('`map` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
287
288
        $map = Map::of([
289
            'first' => 1,
290
            'second' => 2,
291
            'third' => 3,
292
        ]);
293
294
        $I->expectThat('map callable is able to change the collection ');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
295
296
        $mappedCollection = $map->map(function ($element) {
297
            return $element * $element;
298
        });
299
        $I->lookAt('collection mapped by `square` function');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
300
        $I->see($mappedCollection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
301
          ->isEqualTo(Map::of([
302
              'first' => 1,
303
              'second' => 4,
304
              'third' => 9,
305
          ]));
306
    }
307
308
    /**
309
     * @test
310
     */
311
    public function reduceBehavior() {
312
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
313
314
        $I->describe('`reduce` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
315
316
        $map = Map::of([
317
            'first' => 1,
318
            'second' => 2,
319
            'third' => 3,
320
        ]);
321
322
        $I->expectThat('reduce callable is able to traverse through collection');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
323
324
        $reduceValue = $map->reduce(function ($result, $element) {
325
            $result += $element;
326
327
            return $result;
328
        });
329
        $I->lookAt('reduce callable is able to traverse through collection with initial value set');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
330
        $I->seeNumber($reduceValue)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
331
          ->isEqualTo($sumOfCollection = 6);
332
        $I->expectThat('reduce callable is able to change the collection ');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
333
334
        $reduceValue = $map->reduce(function ($result, $element) {
335
            $result += $element;
336
337
            return $result;
338
        }, 4);
339
        $I->lookAt('collection value reduced by `sum` function with initial value');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
340
        $I->seeNumber($reduceValue)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
341
          ->isEqualTo($sumOfCollectionWithInitialValue = 10);
342
    }
343
344
    /**
345
     * @test
346
     */
347
    public function keyMethodsGroupBehavior() {
348
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
349
350
        $I->describe('`key` methods group behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
351
352
        $map = Map::of([
353
            'first' => 1,
354
            'second' => 2,
355
            'third' => 3,
356
            'first-third-duplicate' => 3,
357
            'second-third-duplicate' => 3,
358
        ]);
359
360
        $I->expectThat('`keyOf` return key of a first occurrence of given element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
361
362
        $firstKeyOfDuplicate = $map->keyOf(3);
363
        $I->lookAt('key of duplicated element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
364
        $I->seeNumber($firstKeyOfDuplicate)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
365
          ->isEqualTo('third');
366
367
        $I->expectThat('`lastKeyOf` return key of a last occurrence of given element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
368
369
        $lastKeyOfDuplicate = $map->lastKeyOf(3);
370
        $I->lookAt('last key of duplicated element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
371
        $I->seeNumber($lastKeyOfDuplicate)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
372
          ->isEqualTo('second-third-duplicate');
373
374
        $I->expectThat('`allKeysOf` return collection of keys of all occurrences of given element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
375
376
        $allKeysOfDuplicate = $map->allKeysOf(3);
377
        $I->lookAt('collection duplicated element keys');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
378
        $I->seeArray($allKeysOfDuplicate)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
379
          ->isEqualTo(Collection::of([
380
              'third',
381
              'first-third-duplicate',
382
              'second-third-duplicate',
383
          ]));
384
    }
385
386
    /**
387
     * @test
388
     */
389
    public function countValuesFrequencyBehavior() {
390
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
391
392
        $I->describe('`countValuesFrequency` methods group behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
393
394
        $map = Map::of([
395
            'first' => 1,
396
            'second' => 3,
397
            'first-second-duplicate' => 3,
398
            'second-second-duplicate' => 3,
399
            'Name' => 'Sam',
400
            'name' => 'sam',
401
        ]);
402
403
        $I->expectThat('`countValuesFrequency` honor string values case');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
404
405
        $caseSensitiveFrequency = $map->countValuesFrequency();
406
        $I->lookAt('case sensitive values frequency');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
407
        $I->see($caseSensitiveFrequency)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
408
          ->isEqualTo(Collection::of([
409
              3 => 3,
410
              1 => 1,
411
              'Sam' => 1,
412
              'sam' => 1,
413
          ]));
414
415
        $I->expectThat('`countValuesFrequency` honor string values case');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
416
417
        $caseSensitiveFrequency = $map->countValuesFrequencyIgnoringCase();
418
        $I->lookAt('case sensitive values frequency');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
419
        $I->see($caseSensitiveFrequency)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
420
          ->isEqualTo(Collection::of([
421
              3 => 3,
422
              1 => 1,
423
              'sam' => 2,
424
          ]));
425
    }
426
427
    /**
428
     * @test
429
     */
430
    public function calculateProductBehavior() {
431
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
432
433
        $I->describe('`calculateProduct` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
434
435
        $map = Map::of([
436
            'first' => 2,
437
            'second' => 4,
438
            'third' => 3,
439
        ]);
440
441
        $I->expectThat('numeric collection product can be calculated');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
442
443
        $mapProduct = $map->calculateProduct();
444
445
        $I->seeNumber($mapProduct)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
446
          ->isEqualTo(24);
447
448
        $map = Map::of([
449
            'first' => 2,
450
            'second' => 'hi',
451
            'third' => 'there',
452
        ]);
453
454
        $I->expectThat('mixed collection product can be calculated');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
455
456
        $mapProduct = $map->calculateProduct();
457
458
        $I->seeNumber($mapProduct)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
459
          ->isEqualTo(0);
460
    }
461
462
    /**
463
     * @test
464
     */
465
    public function popBehavior() {
466
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
467
468
        $I->describe('`pop` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
469
470
        $map = Map::of([
471
            'first' => 2,
472
            'second' => 4,
473
            'third' => 3,
474
        ]);
475
476
        $I->expectThat('`pop` ejects last element fro the collection');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
477
478
        $poppedElement = $map->pop();
479
480
        $I->lookAt('popped element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
481
        $I->seeNumber($poppedElement)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
482
          ->isEqualTo($lastCollectionElement = 3);
483
        $I->lookAt('collection without last(popped) element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
484
        $I->see($map)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
485
          ->isEqualTo(Map::of([
486
              'first' => 2,
487
              'second' => 4,
488
          ]));
489
    }
490
491
    /**
492
     * @test
493
     */
494
    public function shiftBehavior() {
495
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
496
497
        $I->describe('`shift` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
498
499
        $map = Map::of([
500
            'first' => 2,
501
            'second' => 4,
502
            'third' => 3,
503
        ]);
504
505
        $I->expectThat('`shift` ejects first element fro the collection');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
506
507
        $poppedElement = $map->shift();
508
509
        $I->lookAt('shifted element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
510
        $I->seeNumber($poppedElement)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
511
          ->isEqualTo($firstCollectionElement = 2);
512
        $I->lookAt('collection without first(shifted) element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
513
        $I->see($map)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
514
          ->isEqualTo(Map::of([
515
              'second' => 4,
516
              'third' => 3,
517
          ]));
518
    }
519
520
    /**
521
     * @test
522
     */
523
    public function keysToLoweCaseBehavior() {
524
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
525
526
        $I->describe('`keysToLowerCase` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
527
528
        $map = Map::of([
529
            'FIRST' => 2,
530
            'SecoND' => 4,
531
            'thirD' => 3,
532
        ]);
533
534
        $I->expectThat('`keysToLowerCase` convert all of the collection keys with any notation to lower case');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
535
536
        $map->keysToLowerCase();
537
538
        $I->see($map)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
539
          ->isEqualTo(Map::of([
540
              'first' => 2,
541
              'second' => 4,
542
              'third' => 3,
543
          ]));
544
    }
545
546
    /**
547
     * @test
548
     */
549
    public function keysToUpperCaseBehavior() {
550
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
551
552
        $I->describe('`keysToLowerCase` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
553
554
        $map = Map::of([
555
            'FIRST' => 2,
556
            'SecoND' => 4,
557
            'thirD' => 3,
558
            'forth' => 3,
559
        ]);
560
561
        $I->expectThat('`keysToLowerCase` convert all of the collection keys with any notation to lower case');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
562
563
        $map->keysToUpperCase();
564
565
        $I->see($map)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
566
          ->isEqualTo(Map::of([
567
              'FIRST' => 2,
568
              'SECOND' => 4,
569
              'THIRD' => 3,
570
              'FORTH' => 3,
571
          ]));
572
    }
573
574
    /**
575
     * @test
576
     */
577
    public function chunkByBehavior() {
578
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
579
580
        $I->describe('`chunkBy` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
581
582
        $map = Map::of([
583
            'FIRST' => 2,
584
            'SECOND' => 4,
585
            'THIRD' => 3,
586
            'FORTH' => 3,
587
        ]);
588
589
        $I->expectThat('`chunkBy` split collection on chunks with specified size.');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
590
591
        $chunks = $map->chunkBy(2);
592
        $I->see($chunks)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
593
          ->isEqualTo(Collection::of([
594
              Map::of([
595
                  'FIRST' => 2,
596
                  'SECOND' => 4,
597
              ]),
598
              Map::of([
599
                  'THIRD' => 3,
600
                  'FORTH' => 3,
601
              ]),
602
          ]));
603
    }
604
605
    /**
606
     * @test
607
     */
608
    public function arrayAccessBehavior() {
609
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
610
611
        $I->describe('array access behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
612
613
        $map = Map::of([]);
614
615
        $I->expectThat('map allows to set and read values through array access');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
616
617
        $map['first'] = 1;
618
619
        $I->see($map['first'])
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
620
          ->isEqualTo(1);
621
622
        $I->expectThat('not set keys return `null` and considered as not set');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
623
624
        $I->seeBool(isset($map['not-existing']))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
625
          ->isFalse();
626
        $I->see($map['not-existing'])
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
627
          ->isNull();
628
629
        $I->expectThat('Map reject non-string keys');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
630
631
        try {
632
            $map[] = 4;
633
            $errorMessage = 'Key validation failed';
634
        } catch (\Throwable $error) {
635
            $errorMessage = $error->getMessage();
636
        }
637
638
        $I->seeString($errorMessage)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
639
          ->isEqualTo(self::INVALID_KEY_ERROR_MESSAGE);
640
    }
641
}