Code Duplication    Length = 14-27 lines in 4 locations

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

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

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

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