Code Duplication    Length = 17-19 lines in 3 locations

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

@@ 71-88 (lines=18) @@
68
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
69
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation
70
     */
71
    public function testLoadLocationThrowsUnauthorizedException()
72
    {
73
        $repository = $this->getRepository();
74
75
        $editorsGroupId = $this->generateId('group', 13);
76
77
        /* BEGIN: Use Case */
78
        $locationService = $repository->getLocationService();
79
80
        $user = $this->createUserVersion1();
81
82
        // Set current user to newly created user
83
        $repository->setCurrentUser($user);
84
85
        // This call will fail with an "UnauthorizedException"
86
        $locationService->loadLocation($editorsGroupId);
87
        /* END: Use Case */
88
    }
89
90
    /**
91
     * Test for the loadLocationByRemoteId() method.
@@ 97-115 (lines=19) @@
94
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
95
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocationByRemoteId
96
     */
97
    public function testLoadLocationByRemoteIdThrowsUnauthorizedException()
98
    {
99
        $repository = $this->getRepository();
100
101
        /* BEGIN: Use Case */
102
        // remoteId of the "Editors" location in an eZ Publish demo installation
103
        $editorsRemoteId = 'f7dda2854fc68f7c8455d9cb14bd04a9';
104
105
        $locationService = $repository->getLocationService();
106
107
        $user = $this->createUserVersion1();
108
109
        // Set current user to newly created user
110
        $repository->setCurrentUser($user);
111
112
        // This call will fail with an "UnauthorizedException"
113
        $locationService->loadLocationByRemoteId($editorsRemoteId);
114
        /* END: Use Case */
115
    }
116
117
    /**
118
     * Test for the loadLocations() method.

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

@@ 496-512 (lines=17) @@
493
     * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId()
494
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation
495
     */
496
    public function testLoadLocationByRemoteId()
497
    {
498
        $repository = $this->getRepository();
499
500
        /* BEGIN: Use Case */
501
        $locationService = $repository->getLocationService();
502
503
        $location = $locationService->loadLocationByRemoteId(
504
            '3f6d92f8044aed134f32153517850f5a'
505
        );
506
        /* END: Use Case */
507
508
        $this->assertEquals(
509
            $locationService->loadLocation($this->generateId('location', 5)),
510
            $location
511
        );
512
    }
513
514
    /**
515
     * Test for the loadLocationByRemoteId() method.