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

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