2023-05-14 20:31:20 +02:00
< ? php
2023-05-14 20:32:34 +02:00
/**
2024-01-02 21:57:26 +01:00
* @ copyright Copyright ( C ) 2010 - 2024 , the Friendica project
2023-05-14 20:32:34 +02:00
*
* @ license GNU AGPL version 3 or any later version
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation , either version 3 of the
* License , or ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU Affero General Public License for more details .
*
* You should have received a copy of the GNU Affero General Public License
* along with this program . If not , see < https :// www . gnu . org / licenses />.
*
*/
2023-05-14 20:31:20 +02:00
namespace Friendica\Test\src\Navigation\Notifications\Entity ;
use Friendica\Navigation\Notifications\Entity\Notify ;
use Friendica\Test\FixtureTest ;
class NotifyTest extends FixtureTest
{
public function dataFormatNotify () : array
{
return [
'xss-notify' => [
2023-05-14 20:34:42 +02:00
'name' => 'Whiskers' ,
'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>' ,
2023-05-14 20:31:20 +02:00
'assertion' => '<span class="contactname">Whiskers</span> commented in the thread "If my username causes a pop up in a piece of software, that softwar…" from <script>alert("Tek");</script>' ,
],
];
}
/**
* @ dataProvider dataFormatNotify
*/
public function testFormatNotify ( string $name , string $message , string $assertion )
{
self :: assertEquals ( $assertion , Notify :: formatMessage ( $name , $message ));
}
}