Fast404Test.php in Fast 404 8.2
File
tests/src/Unit/Fast404Test.php
View source
<?php
namespace Drupal\Tests\fast404\Unit;
use Drupal\Tests\UnitTestCase;
class Fast404Test extends UnitTestCase {
protected function getFast404() {
$requestStub = $this
->getMockBuilder('\\Symfony\\Component\\HttpFoundation\\Request')
->disableOriginalConstructor()
->getMock();
$fast404 = $this
->getMockBuilder('\\Drupal\\fast404\\Fast404')
->setConstructorArgs([
$requestStub,
])
->setMethods([
'isCli',
])
->getMock();
$fast404
->method('isCli')
->willReturn(FALSE);
return $fast404;
}
public function testBlockPath() {
$fast404 = $this
->getFast404();
$this
->assertEquals(FALSE, $fast404
->isPathBlocked());
$fast404
->blockPath();
$this
->assertEquals(TRUE, $fast404
->isPathBlocked());
}
public function testIsPathBlocked() {
$fast404 = $this
->getFast404();
$this
->assertEquals(FALSE, $fast404
->isPathBlocked());
$fast404
->method('isCli')
->willReturn(TRUE);
$this
->assertEquals(FALSE, $fast404
->isPathBlocked());
}
}