ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilMailBodyPurifierTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 {
25  public static function bodyProvider(): array
26  {
27  return [
28  'Reply indicators are kept' => [
29  '> This is the original message' . chr(10) . '> Stretching over multiple lines',
30  '> This is the original message' . chr(10) . '> Stretching over multiple lines',
31  ],
32  'Reply indicators are kept, even if body contains (supported and unsupported) HTML' => [
33  '> This is the original <b>message</b>' . chr(10) . '> <section>Stretching</section> over multiple lines',
34  '> This is the original < b>message< /b>' . chr(10) . '> < section>Stretching< /section> over multiple lines',
35  ]
36  ];
37  }
38 
39  #[DataProvider('bodyProvider')]
40  public function testMailBodyPurifier(string $body, string $expected_body): void
41  {
42  $purifier = new ilMailBodyPurifier();
43 
44  $this->assertSame($expected_body, $purifier->purify($body));
45  }
46 
48  {
49  $purifier = new ilMailBodyPurifier();
50 
51  $this->assertStringNotContainsString(chr(13), $purifier->purify(chr(13)));
52  }
53 }
testMailBodyPurifier(string $body, string $expected_body)