Skip to content

Commit

Permalink
modified
Browse files Browse the repository at this point in the history
  • Loading branch information
thangnn committed Dec 10, 2024
1 parent f16f06d commit e652709
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,25 +149,20 @@ public function testGetToken()
* メールフォームへのリンクを取得
* @dataProvider linkProvider
*/
public function testLink($title, $contentsName, $expected)
public function testLink($title, $contentsName, $url, $expected)
{
ContentFactory::make(['plugin' => 'BcMail', 'type' => 'MailContent', 'name' => $contentsName, 'entity_id' => 1])->persist();
ContentFactory::make(['plugin' => 'BcMail', 'type' => 'MailContent', 'name' => $contentsName, 'url' => $url, 'entity_id' => 1])->persist();
$this->expectOutputString($expected);
$this->MailHelper->link($title, $contentsName);
}

public static function linkProvider()
{
return [
['タイトル', 'Members', '<a href="/bc-mail/mail">タイトル</a>'],
[' ', 'a', '<a href="/bc-mail/mail"> </a>'],
[' ', ' ', '<a href="/bc-mail/mail"> </a>'],
[' ', '///', '<a href="/bc-mail/mail"> </a>'],
[' ', '////a', '<a href="/bc-mail/mail"> </a>'],
[' ', '////a//a/aa', '<a href="/bc-mail/mail"> </a>'],
[' ', '/../../../../a', '<a href="/bc-mail/mail"> </a>'],
['', 'javascript:void(0);', '<a href="/bc-mail/mail"></a>'],
['<script>alert(1)</script>', '////a', '<a href="/bc-mail/mail">&lt;script&gt;alert(1)&lt;/script&gt;</a>']
['タイトル', '/Members/', '/a/', '<a href="/a/index">タイトル</a>'],
[' ', 'a', '/a/', '<a href="/a/index"> </a>'],
[' ', ' ', '', '<a href="/bc-mail/mail"> </a>'],
[' ', '///', '///', '<a href="/index"> </a>'],
];
}

Expand Down

0 comments on commit e652709

Please sign in to comment.