Code Duplication    Length = 17-25 lines in 3 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/Location/Gateway/DoctrineDatabaseTest.php 2 locations

@@ 458-476 (lines=19) @@
455
        );
456
    }
457
458
    public function testSwapLocations()
459
    {
460
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php');
461
        $handler = $this->getLocationGateway();
462
        $handler->swap(70, 78);
463
464
        $query = $this->handler->createSelectQuery();
465
        $this->assertQueryResult(
466
            [
467
                [70, 76],
468
                [78, 68],
469
            ],
470
            $query
471
                ->select('node_id', 'contentobject_id')
472
                ->from('ezcontentobject_tree')
473
                ->where($query->expr->in('node_id', [70, 78]))
474
                ->orderBy('node_id')
475
        );
476
    }
477
478
    public function testCreateLocation()
479
    {
@@ 684-708 (lines=25) @@
681
    /**
682
     * @dataProvider getUpdateLocationData
683
     */
684
    public function testUpdateLocation($field, $value)
685
    {
686
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php');
687
        $handler = $this->getLocationGateway();
688
        $handler->update(
689
            new Location\UpdateStruct(
690
                [
691
                    'priority' => 23,
692
                    'remoteId' => 'someNewHash',
693
                    'sortField' => 4,
694
                    'sortOrder' => 4,
695
                ]
696
            ),
697
            70
698
        );
699
700
        $query = $this->handler->createSelectQuery();
701
        $this->assertQueryResult(
702
            [[$value]],
703
            $query
704
                ->select($field)
705
                ->from('ezcontentobject_tree')
706
                ->where($query->expr->in('node_id', [70]))
707
        );
708
    }
709
710
    public static function getNodeAssignmentValues()
711
    {

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

@@ 118-134 (lines=17) @@
115
    /**
116
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway\DoctrineDatabase::untrashLocation
117
     */
118
    public function testUntrashLocationNewParent()
119
    {
120
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php');
121
        $handler = $this->getLocationGateway();
122
        $handler->trashLocation(71);
123
124
        $handler->untrashLocation(71, 1);
125
126
        $query = $this->handler->createSelectQuery();
127
        $this->assertQueryResult(
128
            [['228', '1', '/1/228/']],
129
            $query
130
                ->select('node_id', 'parent_node_id', 'path_string')
131
                ->from('ezcontentobject_tree')
132
                ->where($query->expr->in('contentobject_id', [69]))
133
        );
134
    }
135
136
    /**
137
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway\DoctrineDatabase::untrashLocation