Fast404Test.php in Fast 404 8
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
->assertAttributeEquals(FALSE, 'respond404', $fast404);
$fast404
->blockPath();
$this
->assertAttributeEquals(TRUE, 'respond404', $fast404);
}
public function testIsPathBlocked() {
$fast404 = $this
->getFast404();
$this
->assertEquals(FALSE, $fast404
->isPathBlocked());
$fast404
->method('isCli')
->willReturn(TRUE);
$this
->assertEquals(FALSE, $fast404
->isPathBlocked());
}
}