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.
@@ 620-636 (lines=17) @@
617
     * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId()
618
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation
619
     */
620
    public function testLoadLocationByRemoteId()
621
    {
622
        $repository = $this->getRepository();
623
624
        /* BEGIN: Use Case */
625
        $locationService = $repository->getLocationService();
626
627
        $location = $locationService->loadLocationByRemoteId(
628
            '3f6d92f8044aed134f32153517850f5a'
629
        );
630
        /* END: Use Case */
631
632
        $this->assertEquals(
633
            $locationService->loadLocation($this->generateId('location', 5)),
634
            $location
635
        );
636
    }
637
638
    /**
639
     * 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 loadLocationList() method.