Code Duplication    Length = 14-27 lines in 4 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/Gateway/DoctrineDatabaseTest.php 1 location

@@ 859-872 (lines=14) @@
856
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::load
857
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase\QueryBuilder
858
     */
859
    public function testLoadNonExistentTranslation()
860
    {
861
        $this->insertDatabaseFixture(
862
            __DIR__ . '/../_fixtures/contentobjects.php'
863
        );
864
865
        $gateway = $this->getDatabaseGateway();
866
        $res = $gateway->load(226, 2, array('de-DE'));
867
868
        $this->assertEquals(
869
            0,
870
            count($res)
871
        );
872
    }
873
874
    /**
875
     * Asserts that $columnKey in $actualRows exactly contains $expectedValues.

eZ/Publish/Core/Persistence/Legacy/Tests/Content/Type/Gateway/DoctrineDatabaseTest.php 3 locations

@@ 390-416 (lines=27) @@
387
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::getLoadTypeQuery
388
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::selectColumns
389
     */
390
    public function testLoadTypeData()
391
    {
392
        $this->insertDatabaseFixture(
393
            __DIR__ . '/_fixtures/existing_types.php'
394
        );
395
396
        $gateway = $this->getGateway();
397
        $rows = $gateway->loadTypeData(1, 0);
398
399
        $this->assertEquals(
400
            5,
401
            count($rows)
402
        );
403
        $this->assertEquals(
404
            45,
405
            count($rows[0])
406
        );
407
408
        /*
409
         * Store mapper fixture
410
         *
411
        file_put_contents(
412
            dirname( __DIR__ ) . '/_fixtures/map_load_type.php',
413
            "<?php\n\nreturn " . var_export( $rows, true ) . ";\n"
414
        );
415
         */
416
    }
417
418
    /**
419
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::loadTypeDataByIdentifier
@@ 423-440 (lines=18) @@
420
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::getLoadTypeQuery
421
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::selectColumns
422
     */
423
    public function testLoadTypeDataByIdentifier()
424
    {
425
        $this->insertDatabaseFixture(
426
            __DIR__ . '/_fixtures/existing_types.php'
427
        );
428
429
        $gateway = $this->getGateway();
430
        $rows = $gateway->loadTypeDataByIdentifier('folder', 0);
431
432
        $this->assertEquals(
433
            5,
434
            count($rows)
435
        );
436
        $this->assertEquals(
437
            45,
438
            count($rows[0])
439
        );
440
    }
441
442
    /**
443
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::loadTypeDataByRemoteId
@@ 447-464 (lines=18) @@
444
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::getLoadTypeQuery
445
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::selectColumns
446
     */
447
    public function testLoadTypeDataByRemoteId()
448
    {
449
        $this->insertDatabaseFixture(
450
            __DIR__ . '/_fixtures/existing_types.php'
451
        );
452
453
        $gateway = $this->getGateway();
454
        $rows = $gateway->loadTypeDataByRemoteId('a3d405b81be900468eb153d774f4f0d2', 0);
455
456
        $this->assertEquals(
457
            5,
458
            count($rows)
459
        );
460
        $this->assertEquals(
461
            45,
462
            count($rows[0])
463
        );
464
    }
465
466
    /**
467
     * Returns the expected data from creating a type.