comparison core/modules/simpletest/tests/src/Unit/AssertContentTraitTest.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 /**
4 * @file
5 * Contains \Drupal\Tests\simpletest\Unit\AssertContentTraitTest.
6 */
7
8 namespace Drupal\Tests\simpletest\Unit;
9
10 use Drupal\simpletest\AssertContentTrait;
11 use Drupal\Tests\UnitTestCase;
12
13 /**
14 * @coversDefaultClass \Drupal\simpletest\AssertContentTrait
15 * @group simpletest
16 */
17 class AssertContentTraitTest extends UnitTestCase {
18
19 /**
20 * @covers ::getTextContent
21 */
22 public function testGetTextContent() {
23 $test = new TestClass();
24 $raw_content = <<<EOT
25
26 <Head>
27 <style>
28 @import url("foo.css");
29 </style>
30 </head>
31 <body>
32 bar
33 </body>
34 EOT;
35 $test->_setRawContent($raw_content);
36 $this->assertNotContains('foo', $test->_getTextContent());
37 $this->assertNotContains('<body>', $test->_getTextContent());
38 $this->assertContains('bar', $test->_getTextContent());
39 }
40
41 }
42
43 class TestClass {
44 use AssertContentTrait;
45
46 public function _setRawContent($content) {
47 $this->setRawContent($content);
48 }
49
50 public function _getTextContent() {
51 return $this->getTextContent();
52 }
53
54 }