|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class CwpStatsReportTest extends SapphireTest { |
|
4
|
|
|
|
|
5
|
|
|
protected static $fixture_file = 'cwp-core/tests/CwpStatsReportTest.yml'; |
|
6
|
|
|
|
|
7
|
|
|
public function testCount() { |
|
8
|
|
|
// Publish all pages apart from page3. |
|
9
|
|
|
$this->objFromFixture('Page', 'page1')->doPublish(); |
|
10
|
|
|
$this->objFromFixture('Page', 'page2')->doPublish(); |
|
11
|
|
|
$this->objFromFixture('Page', 'page3')->doPublish(); |
|
12
|
|
|
|
|
13
|
|
|
// Add page5s to a subsite, if the module is installed. |
|
14
|
|
|
$page5s = $this->objFromFixture('Page', 'page5s'); |
|
15
|
|
|
if(class_exists('Subsite')) { |
|
16
|
|
|
$subsite = Subsite::create(); |
|
|
|
|
|
|
17
|
|
|
$subsite->Title = 'subsite'; |
|
18
|
|
|
$subsite->write(); |
|
19
|
|
|
|
|
20
|
|
|
$page5s->SubsiteID = $subsite->ID; |
|
21
|
|
|
$page5s->write(); |
|
22
|
|
|
} |
|
23
|
|
|
$page5s->doPublish(); |
|
24
|
|
|
|
|
25
|
|
|
$report = CwpStatsReport::create(); |
|
26
|
|
|
$records = $report->sourceRecords(array())->toArray(); |
|
27
|
|
|
$i = 0; |
|
28
|
|
|
$this->assertEquals($records[$i++]['Count'], 4, 'Four pages in total, across locales, subsites, live only.'); |
|
29
|
|
|
if(class_exists('Subsite')) { |
|
30
|
|
|
$this->assertEquals($records[$i++]['Count'], 3, 'Three pages in the main site, if subsites installed.'); |
|
31
|
|
|
$this->assertEquals($records[$i++]['Count'], 1, 'One page in the subsite, if subsites installed'); |
|
32
|
|
|
} |
|
33
|
|
|
$this->assertEquals($records[$i++]['Count'], 1, 'One file in total.'); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
} |
|
37
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths