Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/simpletest/tests/src/Unit/SimpletestUiPrinterTest.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Tests\simpletest\Unit; | |
4 | |
5 use Drupal\Tests\Listeners\SimpletestUiPrinter; | |
6 use Drupal\Tests\UnitTestCase; | |
7 | |
8 /** | |
9 * @coversDefaultClass \Drupal\Tests\Listeners\SimpletestUiPrinter | |
10 * | |
11 * @group simpletest | |
12 */ | |
13 class SimpletestUiPrinterTest extends UnitTestCase { | |
14 | |
15 /** | |
16 * Data provider for testWrite(). | |
17 * | |
18 * @return string[] | |
19 * Array of data for testWrite(). | |
20 * - Expected output from SimpletestUiPrinter->write(). | |
21 * - Buffer to pass into SimpletestUiPrinter->write(). | |
22 */ | |
23 public function provideBuffer() { | |
24 return [ | |
25 ['&"'<>', '&"\'<>'], | |
26 ['<a href="http:////www.example.com" target="_blank" title="http:////www.example.com">http:////www.example.com</a>', 'http:////www.example.com'], | |
27 ['this is some text <a href="http://www.example.com/" target="_blank" title="http://www.example.com/">http://www.example.com/</a> with a link in it.', 'this is some text http://www.example.com/ with a link in it.'], | |
28 ["HTML output was generated<br />\n", "HTML output was generated\n"], | |
29 ]; | |
30 } | |
31 | |
32 /** | |
33 * @covers ::write | |
34 * | |
35 * @dataProvider provideBuffer | |
36 */ | |
37 public function testWrite($expected, $buffer) { | |
38 $printer = new SimpletestUiPrinter(); | |
39 // Set up our expectation. | |
40 $this->expectOutputString($expected); | |
41 // Write the buffer. | |
42 $printer->write($buffer); | |
43 } | |
44 | |
45 } |