Code Duplication    Length = 17-21 lines in 3 locations

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

@@ 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.

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.
@@ 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.