Passed
Pull Request — master (#12)
by Robbie
04:58 queued 01:01
created

SitemapPageTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testSitemapShowsNavigationTitleNotNormalTitle() 0 6 1
1
<?php
2
3
namespace CWP\CWP\Tests\PageTypes;
4
5
6
7
8
use SilverStripe\Core\Config\Config;
9
use SilverStripe\View\SSViewer;
10
use SilverStripe\Dev\CSSContentParser;
11
use SilverStripe\Dev\FunctionalTest;
12
13
14
class SitemapPageTest extends FunctionalTest {
15
16
	protected static $fixture_file = 'SitemapPageTest.yml';
17
18
	protected static $use_draft_site = true;
19
20
	public function setUp()
21
	{
22
		parent::setUp();
23
24
		Config::inst()->update(SSViewer::class, 'theme', 'starter');
0 ignored issues
show
Bug introduced by
The method update() does not exist on SilverStripe\Config\Coll...nfigCollectionInterface. It seems like you code against a sub-type of SilverStripe\Config\Coll...nfigCollectionInterface such as SilverStripe\Config\Coll...\MemoryConfigCollection. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
		Config::inst()->/** @scrutinizer ignore-call */ update(SSViewer::class, 'theme', 'starter');
Loading history...
25
	}
26
27
	/**
28
	 * Note: this test depends on the "starter" theme being installed and configured as default
29
	 */
30
	public function testSitemapShowsNavigationTitleNotNormalTitle() {
31
		$response = $this->get('sitemap');
32
		$parser = new CSSContentParser($response->getBody());
33
		$elements = $parser->getBySelector('.sitemap li.first .sitemap-link');
34
		$this->assertNotEmpty($elements);
35
		$this->assertEquals('Top page nav 1', (string) $elements[0]);
36
	}
37
}
38