Code Duplication    Length = 25-25 lines in 2 locations

tests/ObjectBiMapTest.php 2 locations

@@ 218-242 (lines=25) @@
215
     * @expectedException \Pinepain\ObjectMaps\Exceptions\OverflowException
216
     * @expectedExceptionMessage Key with such value already exists
217
     */
218
    public function testKeyValuesOutOfSyncPutFails()
219
    {
220
        $key_1   = new stdClass();
221
        $value_1 = new stdClass();
222
223
        $key_2   = new stdClass();
224
        $value_2 = new stdClass();
225
226
        $keys_map   = new ObjectMap();
227
        $values_map = new ObjectMap();
228
229
        $keys_map->put($key_1, $value_1);
230
        $values_map->put($value_2, $key_2);
231
232
        $map = new class($keys_map, $values_map) extends ObjectBiMap
233
        {
234
            public function __construct(ObjectMapInterface $keys, ObjectMapInterface $values)
235
            {
236
                $this->keys   = $keys;
237
                $this->values = $values;
238
            }
239
        };
240
241
        $map->put($key_2, $value_2);
242
    }
243
244
    /**
245
     * @expectedException \Pinepain\ObjectMaps\Exceptions\OutOfBoundsException
@@ 248-272 (lines=25) @@
245
     * @expectedException \Pinepain\ObjectMaps\Exceptions\OutOfBoundsException
246
     * @expectedExceptionMessage Key with such value not found
247
     */
248
    public function testKeyValuesOutOfSyncRemoveFails()
249
    {
250
        $key_1   = new stdClass();
251
        $value_1 = new stdClass();
252
253
        $key_2   = new stdClass();
254
        $value_2 = new stdClass();
255
256
        $keys_map   = new ObjectMap();
257
        $values_map = new ObjectMap();
258
259
        $keys_map->put($key_1, $value_1);
260
        $values_map->put($value_2, $key_2);
261
262
        $map = new class($keys_map, $values_map) extends ObjectBiMap
263
        {
264
            public function __construct(ObjectMapInterface $keys, ObjectMapInterface $values)
265
            {
266
                $this->keys   = $keys;
267
                $this->values = $values;
268
            }
269
        };
270
271
        $map->remove($key_1);
272
    }
273
}
274