Source of file DashboardPanelTest.php
Size: 1,275 Bytes - Last Modified: 2021-12-23T10:10:18+00:00
/var/www/docs.ssmods.com/process/src/tests/unit/Model/DashboardPanelTest.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445 | <?php namespace Plastyk\Dashboard\Tests; use Plastyk\Dashboard\Panels\MoreInformationPanel; use SilverStripe\Dev\SapphireTest; use SilverStripe\Security\Member; class DashboardPanelTest extends SapphireTest { protected $usesDatabase = true; protected static $fixture_file = '../../fixtures/DashboardAdminTest.yml'; public function testCreateDashboardPanel() { $moreInformationPanel = new MoreInformationPanel(); $this->assertNotNull($moreInformationPanel); } public function testCanView() { $moreInformationPanel = MoreInformationPanel::singleton(); $this->assertTrue($moreInformationPanel->canView()); $nonPermittedUser = $this->objFromFixture(Member::class, 'user2'); $this->logInAs($nonPermittedUser); $this->assertFalse($moreInformationPanel->canView()); } public function testForTemplate() { $moreInformationPanel = MoreInformationPanel::singleton(); $this->assertContains('Custom dashboard panels are available', $moreInformationPanel->forTemplate()); $nonPermittedUser = $this->objFromFixture(Member::class, 'user2'); $this->logInAs($nonPermittedUser); $this->assertFalse($moreInformationPanel->forTemplate()); } } |