protected function CasHelperTest::setUp in CAS 8
Same name and namespace in other branches
- 2.x tests/src/Unit/Service/CasHelperTest.php \Drupal\Tests\cas\Unit\Service\CasHelperTest::setUp()
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ Service/ CasHelperTest.php, line 54
Class
- CasHelperTest
- CasHelper unit tests.
Namespace
Drupal\Tests\cas\Unit\ServiceCode
protected function setUp() {
parent::setUp();
$this->loggerFactory = $this
->createMock('\\Drupal\\Core\\Logger\\LoggerChannelFactory');
$this->loggerChannel = $this
->getMockBuilder('\\Drupal\\Core\\Logger\\LoggerChannel')
->disableOriginalConstructor()
->getMock();
$this->loggerFactory
->expects($this
->any())
->method('get')
->with('cas')
->will($this
->returnValue($this->loggerChannel));
$this->token = $this
->prophesize(Token::class);
$this->token
->replace('Use <a href="[cas:login-url]">CAS login</a>')
->willReturn('Use <a href="/caslogin">CAS login</a>');
$this->token
->replace('<script>alert("Hacked!");</script>')
->willReturn('<script>alert("Hacked!");</script>');
}