Code Duplication    Length = 14-15 lines in 2 locations

tests/CwpControllerExtensionTest.php 2 locations

@@ 53-67 (lines=15) @@
50
        Injector::inst()->registerService($this->middlewareMock, CanonicalURLMiddleware::class);
51
    }
52
53
    public function testRedirectsSSLToDomain()
54
    {
55
        Config::modify()->set(Director::class, 'alternate_base_url', 'http://nothttps.local');
56
57
        // Expecting this to call forceSSL to forcedomain.org.
58
        $this->middlewareMock->expects($this->once())
59
            ->method('setForceSSL')
60
            ->with(true)
61
            ->will($this->returnSelf());
62
63
        Config::modify()->set(CwpControllerExtension::class, 'ssl_redirection_enabled', true);
64
        Config::modify()->set(CwpControllerExtension::class, 'ssl_redirection_force_domain', 'forcedomain.org');
65
66
        $this->controller->handleRequest($this->controller->getRequest());
67
    }
68
69
    public function testRedirectsSSLToCurrentDomain()
70
    {
@@ 69-82 (lines=14) @@
66
        $this->controller->handleRequest($this->controller->getRequest());
67
    }
68
69
    public function testRedirectsSSLToCurrentDomain()
70
    {
71
        Config::modify()->set(Director::class, 'alternate_base_url', 'http://nothttps.local');
72
73
        // Expecting this to call forceSSL to current domain.
74
        $this->middlewareMock->expects($this->once())
75
            ->method('setForceSSL')
76
            ->will($this->returnSelf());
77
78
        Config::modify()->set(CwpControllerExtension::class, 'ssl_redirection_enabled', true);
79
        Config::modify()->set(CwpControllerExtension::class, 'ssl_redirection_force_domain', false);
80
81
        $this->controller->handleRequest($this->controller->getRequest());
82
    }
83
84
    public function testRequiresLoginForTest()
85
    {