mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MNT Remove polyfill
This commit is contained in:
parent
3ab86f3d0a
commit
1b2a9a8926
@ -30,7 +30,6 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^9.5",
|
"phpunit/phpunit": "^9.5",
|
||||||
"dms/phpunit-arraysubset-asserts": "^0.3.0",
|
|
||||||
"squizlabs/php_codesniffer": "^3.0"
|
"squizlabs/php_codesniffer": "^3.0"
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
|
@ -5,7 +5,6 @@ use ReflectionClass;
|
|||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
|
|
||||||
use SilverStripe\Reports\Report;
|
use SilverStripe\Reports\Report;
|
||||||
use SilverStripe\Reports\ReportAdmin;
|
use SilverStripe\Reports\ReportAdmin;
|
||||||
use SilverStripe\Reports\Tests\ReportAdminTest\FakeReport;
|
use SilverStripe\Reports\Tests\ReportAdminTest\FakeReport;
|
||||||
@ -13,8 +12,6 @@ use SilverStripe\Reports\Tests\ReportAdminTest\FakeReport2;
|
|||||||
|
|
||||||
class ReportAdminTest extends SapphireTest
|
class ReportAdminTest extends SapphireTest
|
||||||
{
|
{
|
||||||
use ArraySubsetAsserts;
|
|
||||||
|
|
||||||
public function testBreadcrumbsAreGenerated()
|
public function testBreadcrumbsAreGenerated()
|
||||||
{
|
{
|
||||||
$noExtraCrumbs = FakeReport::create();
|
$noExtraCrumbs = FakeReport::create();
|
||||||
@ -23,15 +20,12 @@ class ReportAdminTest extends SapphireTest
|
|||||||
$breadcrumbs = $controller->BreadCrumbs();
|
$breadcrumbs = $controller->BreadCrumbs();
|
||||||
|
|
||||||
$this->assertCount(2, $breadcrumbs);
|
$this->assertCount(2, $breadcrumbs);
|
||||||
|
$map = $breadcrumbs[0]->toMap();
|
||||||
|
$this->assertSame('Reports', $map['Title']);
|
||||||
|
$this->assertSame('admin/reports/', $map['Link']);
|
||||||
|
|
||||||
$this->assertArraySubset([
|
$map = $breadcrumbs[1]->toMap();
|
||||||
'Title' => 'Reports',
|
$this->assertSame('Fake report', $map['Title']);
|
||||||
'Link' => 'admin/reports/',
|
|
||||||
], $breadcrumbs[0]->toMap(), true, 'Link to top level reports is within breadcrumbs');
|
|
||||||
|
|
||||||
$this->assertArraySubset([
|
|
||||||
'Title' => 'Fake report'
|
|
||||||
], $breadcrumbs[1]->toMap(), true, 'Current report is within breadcrumbs');
|
|
||||||
|
|
||||||
$extraCrumbs = FakeReport2::create();
|
$extraCrumbs = FakeReport2::create();
|
||||||
$controller = $this->mockController($extraCrumbs);
|
$controller = $this->mockController($extraCrumbs);
|
||||||
@ -39,19 +33,16 @@ class ReportAdminTest extends SapphireTest
|
|||||||
|
|
||||||
$this->assertCount(3, $breadcrumbs);
|
$this->assertCount(3, $breadcrumbs);
|
||||||
|
|
||||||
$this->assertArraySubset([
|
$map = $breadcrumbs[0]->toMap();
|
||||||
'Title' => 'Reports',
|
$this->assertSame('Reports', $map['Title']);
|
||||||
'Link' => 'admin/reports/',
|
$this->assertSame('admin/reports/', $map['Link']);
|
||||||
], $breadcrumbs[0]->toMap(), true, 'Link to top level reports is within breadcrumbs (again)');
|
|
||||||
|
|
||||||
$this->assertArraySubset([
|
$map = $breadcrumbs[1]->toMap();
|
||||||
'Title' => 'Fake report title',
|
$this->assertSame('Fake report title', $map['Title']);
|
||||||
'Link' => 'admin/reports/show/SilverStripe-Reports-Tests-ReportAdminTest-FakeReport',
|
$this->assertSame('admin/reports/show/SilverStripe-Reports-Tests-ReportAdminTest-FakeReport', $map['Link']);
|
||||||
], $breadcrumbs[1]->toMap(), true, 'Custom breadcrumb appears');
|
|
||||||
|
|
||||||
$this->assertArraySubset([
|
$map = $breadcrumbs[2]->toMap();
|
||||||
'Title' => 'Fake report two'
|
$this->assertSame('Fake report two', $map['Title']);
|
||||||
], $breadcrumbs[2]->toMap(), true, 'Current report is still within breadcrumbs');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user