Slide 20
Slide 20 text
20
the test
the test
securityContext = Phake::mock('Symfony\Component\Security\Core\SecurityContextInterface');
$this->enabler = new CmsEnablerExtension($this->securityContext);
}
public function testChecksIfCmsShouldBeEnabled()
{
Phake::when($this->securityContext)->isGranted('ROLE_ADMIN', null)
->thenReturn(true);
$this->assertTrue($this->enabler->isEnabled());
Phake::verify($this->securityContext, Phake::times(1))->isGranted('ROLE_ADMIN', null);
}
}
securityContext = Phake::mock('Symfony\Component\Security\Core\SecurityContextInterface');
$this->enabler = new CmsEnablerExtension($this->securityContext);
}
public function testChecksIfCmsShouldBeEnabled()
{
Phake::when($this->securityContext)->isGranted('ROLE_ADMIN', null)
->thenReturn(true);
$this->assertTrue($this->enabler->isEnabled());
Phake::verify($this->securityContext, Phake::times(1))->isGranted('ROLE_ADMIN', null);
}
}