Code Duplication    Length = 18-21 lines in 3 locations

Tests/Transformer/ModelToElasticaAutoTransformerTest.php 3 locations

@@ 309-326 (lines=18) @@
306
        );
307
    }
308
309
    public function testNestedMapping()
310
    {
311
        $transformer = $this->getTransformer();
312
        $document = $transformer->transform(new POPO(), [
313
            'sub' => [
314
                'type' => 'nested',
315
                'properties' => ['foo' => []],
316
            ],
317
        ]);
318
        $data = $document->getData();
319
320
        $this->assertTrue(array_key_exists('sub', $data));
321
        $this->assertInternalType('array', $data['sub']);
322
        $this->assertSame([
323
             ['foo' => 'foo'],
324
             ['foo' => 'bar'],
325
           ], $data['sub']);
326
    }
327
328
    public function tesObjectMapping()
329
    {
@@ 328-345 (lines=18) @@
325
           ], $data['sub']);
326
    }
327
328
    public function tesObjectMapping()
329
    {
330
        $transformer = $this->getTransformer();
331
        $document = $transformer->transform(new POPO(), [
332
                'sub' => [
333
                    'type' => 'object',
334
                    'properties' => ['bar'],
335
                    ],
336
                ]);
337
        $data = $document->getData();
338
339
        $this->assertTrue(array_key_exists('sub', $data));
340
        $this->assertInternalType('array', $data['sub']);
341
        $this->assertSame([
342
             ['bar' => 'foo'],
343
             ['bar' => 'bar'],
344
           ], $data['sub']);
345
    }
346
347
    public function testObjectDoesNotRequireProperties()
348
    {
@@ 451-471 (lines=21) @@
448
        $this->assertSame('parent', $document->getParent());
449
    }
450
451
    public function testThatMappedObjectsDontNeedAnIdentifierField()
452
    {
453
        $transformer = $this->getTransformer();
454
        $document = $transformer->transform(new POPO(), [
455
            'objWithoutIdentifier' => [
456
                'type' => 'object',
457
                'properties' => [
458
                    'foo' => [],
459
                    'bar' => [],
460
                ],
461
            ],
462
        ]);
463
        $data = $document->getData();
464
465
        $this->assertTrue(array_key_exists('objWithoutIdentifier', $data));
466
        $this->assertInternalType('array', $data['objWithoutIdentifier']);
467
        $this->assertSame([
468
            'foo' => 'foo',
469
            'bar' => 'foo',
470
        ], $data['objWithoutIdentifier']);
471
    }
472
473
    public function testThatNestedObjectsDontNeedAnIdentifierField()
474
    {