Code Duplication    Length = 17-21 lines in 3 locations

eZ/Publish/API/Repository/Tests/LocationServiceTest.php 2 locations

@@ 36-56 (lines=21) @@
33
     *
34
     * @see \eZ\Publish\API\Repository\LocationService::newLocationCreateStruct()
35
     */
36
    public function testNewLocationCreateStruct()
37
    {
38
        $repository = $this->getRepository();
39
40
        $parentLocationId = $this->generateId('location', 1);
41
        /* BEGIN: Use Case */
42
        // $parentLocationId is the ID of an existing location
43
        $locationService = $repository->getLocationService();
44
45
        $locationCreate = $locationService->newLocationCreateStruct(
46
            $parentLocationId
47
        );
48
        /* END: Use Case */
49
50
        $this->assertInstanceOf(
51
            '\\eZ\\Publish\\API\\Repository\\Values\\Content\\LocationCreateStruct',
52
            $locationCreate
53
        );
54
55
        return $locationCreate;
56
    }
57
58
    /**
59
     * Test for the newLocationCreateStruct() method.
@@ 453-469 (lines=17) @@
450
     * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId()
451
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation
452
     */
453
    public function testLoadLocationByRemoteId()
454
    {
455
        $repository = $this->getRepository();
456
457
        /* BEGIN: Use Case */
458
        $locationService = $repository->getLocationService();
459
460
        $location = $locationService->loadLocationByRemoteId(
461
            '3f6d92f8044aed134f32153517850f5a'
462
        );
463
        /* END: Use Case */
464
465
        $this->assertEquals(
466
            $locationService->loadLocation($this->generateId('location', 5)),
467
            $location
468
        );
469
    }
470
471
    /**
472
     * Test for the loadLocationByRemoteId() method.

eZ/Publish/API/Repository/Tests/LocationServiceAuthorizationTest.php 1 location

@@ 130-147 (lines=18) @@
127
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
128
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation
129
     */
130
    public function testLoadLocationThrowsUnauthorizedException()
131
    {
132
        $repository = $this->getRepository();
133
134
        $editorsGroupId = $this->generateId('group', 13);
135
136
        /* BEGIN: Use Case */
137
        $locationService = $repository->getLocationService();
138
139
        $user = $this->createUserVersion1();
140
141
        // Set current user to newly created user
142
        $repository->setCurrentUser($user);
143
144
        // This call will fail with an "UnauthorizedException"
145
        $locationService->loadLocation($editorsGroupId);
146
        /* END: Use Case */
147
    }
148
149
    /**
150
     * Test for the loadLocationByRemoteId() method.