mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
58 lines
1.1 KiB
PHP
58 lines
1.1 KiB
PHP
<?php
|
|
|
|
class ReportTest extends SapphireTest {
|
|
|
|
function testCanSortBy() {
|
|
$report = new SSReportTest_FakeTest();
|
|
$this->assertTrue($report->sourceQuery(array())->canSortBy('Title ASC'));
|
|
$this->assertTrue($report->sourceQuery(array())->canSortBy('Title DESC'));
|
|
$this->assertTrue($report->sourceQuery(array())->canSortBy('Title'));
|
|
}
|
|
|
|
function testGetReports() {
|
|
$reports = SS_Report::get_reports();
|
|
$this->assertNotNull($reports, "Reports returned");
|
|
Debug::Show($reports);
|
|
}
|
|
}
|
|
|
|
class ReportTest_FakeTest extends SS_Report implements TestOnly {
|
|
function title() {
|
|
return 'Report title';
|
|
}
|
|
function columns() {
|
|
return array(
|
|
"Title" => array(
|
|
"title" => "Page Title"
|
|
)
|
|
);
|
|
}
|
|
function sourceRecords($params, $sort, $limit) {
|
|
return new ArrayList();
|
|
}
|
|
|
|
function sort() {
|
|
return 100;
|
|
}
|
|
}
|
|
|
|
|
|
class ReportTest_FakeTest2 extends SS_Report implements TestOnly {
|
|
function title() {
|
|
return 'Report title';
|
|
}
|
|
function columns() {
|
|
return array(
|
|
"Title" => array(
|
|
"title" => "Page Title"
|
|
)
|
|
);
|
|
}
|
|
function sourceRecords($params, $sort, $limit) {
|
|
return new ArrayList();
|
|
}
|
|
|
|
function sort() {
|
|
return 98;
|
|
}
|
|
} |