]> git.mxchange.org Git - friendica.git/blob - tests/src/Navigation/Notifications/Entity/NotifyTest.php
2021759e09dcf1685e7bc0a34a8ce6d788c51bd5
[friendica.git] / tests / src / Navigation / Notifications / Entity / NotifyTest.php
1 <?php
2
3 namespace Friendica\Test\src\Navigation\Notifications\Entity;
4
5 use Friendica\Navigation\Notifications\Entity\Notify;
6 use Friendica\Test\FixtureTest;
7
8 class NotifyTest extends FixtureTest
9 {
10         public function dataFormatNotify(): array
11         {
12                 return [
13                         'xss-notify' => [
14                                 'name' => 'Whiskers',
15                                 'message' => '{0} commented in the thread "If my username causes a pop up in a piece of software, that softwar…" from <script>alert("Tek");</script>',
16                                 'assertion' => '<span class="contactname">Whiskers</span> commented in the thread &quot;If my username causes a pop up in a piece of software, that softwar…&quot; from &lt;script&gt;alert(&quot;Tek&quot;);&lt;/script&gt;',
17                         ],
18                 ];
19         }
20
21         /**
22          * @dataProvider dataFormatNotify
23          */
24         public function testFormatNotify(string $name, string $message, string $assertion)
25         {
26                 self::assertEquals($assertion, Notify::formatMessage($name, $message));
27         }
28 }