You are here

protected function StandardTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php \Drupal\Tests\editor\Unit\EditorXssFilter\StandardTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php, line 22

Class

StandardTest
@coversDefaultClass \Drupal\editor\EditorXssFilter\Standard @group editor

Namespace

Drupal\Tests\editor\Unit\EditorXssFilter

Code

protected function setUp() {

  // Mock text format configuration entity object.
  $this->format = $this
    ->getMockBuilder('\\Drupal\\filter\\Entity\\FilterFormat')
    ->disableOriginalConstructor()
    ->getMock();
  $this->format
    ->expects($this
    ->any())
    ->method('getFilterTypes')
    ->will($this
    ->returnValue([
    FilterInterface::TYPE_HTML_RESTRICTOR,
  ]));
  $restrictions = [
    'allowed' => [
      'p' => TRUE,
      'a' => TRUE,
      '*' => [
        'style' => FALSE,
        'on*' => FALSE,
      ],
    ],
  ];
  $this->format
    ->expects($this
    ->any())
    ->method('getHtmlRestrictions')
    ->will($this
    ->returnValue($restrictions));
}