RootURLControllerTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGetHomepageLink() 0 8 1
1
<?php
2
3
namespace SilverStripe\CMS\Tests\Controllers;
4
5
use SilverStripe\CMS\Model\SiteTree;
6
use SilverStripe\CMS\Controllers\RootURLController;
7
use SilverStripe\Core\Config\Config;
8
use SilverStripe\Dev\SapphireTest;
9
10
class RootURLControllerTest extends SapphireTest
11
{
12
    protected static $fixture_file = 'RootURLControllerTest.yml';
13
14
    public function testGetHomepageLink()
15
    {
16
        $default = $this->objFromFixture(SiteTree::class, 'home');
0 ignored issues
show
Unused Code introduced by
The assignment to $default is dead and can be removed.
Loading history...
17
18
        Config::modify()->set(SiteTree::class, 'nested_urls', false);
19
        $this->assertEquals('home', RootURLController::get_homepage_link());
20
        Config::modify()->set(SiteTree::class, 'nested_urls', true);
21
        $this->assertEquals('home', RootURLController::get_homepage_link());
22
    }
23
}
24