Merge pull request #142 from creative-commoners/pulls/4/dms

MNT Remove polyfill
This commit is contained in:
Maxime Rainville 2021-11-09 10:57:04 +13:00 committed by GitHub
commit 6dd0627678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 23 deletions

View File

@ -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": {

View File

@ -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');
} }
/** /**