Code Duplication    Length = 20-25 lines in 2 locations

tests/FwlibTest/Validator/Constraint/UrlTest.php 1 location

@@ 53-77 (lines=25) @@
50
    }
51
52
53
    public static function setUpBeforeClass()
54
    {
55
        $utilContainer = UtilContainer::getInstance();
56
        self::$originalHttpUtil = $utilContainer->getHttp();
57
58
        $urlTest = new UrlTest;
59
        $httpUtil = $urlTest->getMock(
60
            HttpUtil::class,
61
            ['getSelfHostUrl', 'getSelfUrlWithoutQueryString']
62
        );
63
64
        $httpUtil->expects($urlTest->any())
65
            ->method('getSelfHostUrl')
66
            ->willReturnCallback(function () {
67
                return UrlTest::$selfHostUrl;
68
            });
69
70
        $httpUtil->expects($urlTest->any())
71
            ->method('getSelfUrlWithoutQueryString')
72
            ->willReturnCallback(function () {
73
                return UrlTest::$selfUrlWithoutParameter;
74
            });
75
76
        $utilContainer->register('Http', $httpUtil);
77
    }
78
79
80
    public static function tearDownAfterClass()

tests/FwlibTest/Web/UrlGeneratorTraitTest.php 1 location

@@ 44-63 (lines=20) @@
41
    }
42
43
44
    public static function setUpBeforeClass()
45
    {
46
        $utilContainer = UtilContainer::getInstance();
47
48
        self::$httpUtilBackup = $utilContainer->getHttp();
49
50
        $testCase = new self;
51
        $httpUtil = $testCase->getMock(
52
            HttpUtil::class,
53
            ['getSelfUrl', 'getGets']
54
        );
55
        $httpUtil->expects($testCase->any())
56
            ->method('getSelfUrl')
57
            ->willReturn(self::$selfUrl);
58
        $httpUtil->expects($testCase->any())
59
            ->method('getGets')
60
            ->willReturn(self::$selfGetParameters);
61
62
        $utilContainer->register('Http', $httpUtil);
63
    }
64
65
66
    public static function tearDownAfterClass()