Code Duplication    Length = 31-32 lines in 2 locations

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

@@ 29-60 (lines=32) @@
26
     * at least returns an object, because this method is utilized in several
27
     * tests,.
28
     */
29
    protected function setUp()
30
    {
31
        parent::setUp();
32
33
        try {
34
            // RemoteId of the "Media" page of an eZ Publish demo installation
35
            $mediaRemoteId = 'a6e35cbcb7cd6ae4b691f3eee30cd262';
36
37
            // Load the ContentService
38
            $contentService = $this->getRepository()->getContentService();
39
40
            // Load a content info instance
41
            $contentInfo = $contentService->loadContentInfoByRemoteId(
42
                $mediaRemoteId
43
            );
44
45
            if (false === is_object($contentInfo)) {
46
                $this->markTestSkipped(
47
                    'This test cannot be executed, because the utilized ' .
48
                    'ContentService::loadContentInfoByRemoteId() does not ' .
49
                    'return an object.'
50
                );
51
            }
52
        } catch (Exception $e) {
53
            $this->markTestSkipped(
54
                'This test cannot be executed, because the utilized ' .
55
                'ContentService::loadContentInfoByRemoteId() failed with ' .
56
                PHP_EOL . PHP_EOL .
57
                $e
58
            );
59
        }
60
    }
61
62
    /**
63
     * Test for the newSectionCreateStruct() method.

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

@@ 27-57 (lines=31) @@
24
     * at least returns an object, because this method is utilized in several
25
     * tests.
26
     */
27
    protected function setUp()
28
    {
29
        parent::setUp();
30
31
        try {
32
            // Load the LocationService
33
            $locationService = $this->getRepository()->getLocationService();
34
35
            $membersUserGroupLocationId = 12;
36
37
            // Load a location instance
38
            $location = $locationService->loadLocation(
39
                $membersUserGroupLocationId
40
            );
41
42
            if (false === is_object($location)) {
43
                $this->markTestSkipped(
44
                    'This test cannot be executed, because the utilized ' .
45
                    'LocationService::loadLocation() does not ' .
46
                    'return an object.'
47
                );
48
            }
49
        } catch (Exception $e) {
50
            $this->markTestSkipped(
51
                'This test cannot be executed, because the utilized ' .
52
                'LocationService::loadLocation() failed with ' .
53
                PHP_EOL . PHP_EOL .
54
                $e->getTraceAsString()
55
            );
56
        }
57
    }
58
59
    /**
60
     * Test for the createUrlAlias() method.