Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / simpletest / tests / src / Unit / AssertContentTraitTest.php
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 }