/
ContentHelperTest.html.php
47 lines (36 loc) · 1.27 KB
/
ContentHelperTest.html.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/*
* @copyright 2016 Mautic Contributors. All rights reserved
* @author Mautic, Inc.
*
* @link https://mautic.org
*
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
namespace Mautic\CoreBundle\Tests\Templating\Helper;
use Mautic\CoreBundle\Templating\Helper\ContentHelper;
use Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class ContentHelperTest extends \PHPUnit_Framework_TestCase
{
public function testAssetContext()
{
$dispatcherMock = $this->getMockBuilder(EventDispatcherInterface::class)
->disableOriginalConstructor()
->getMock();
$delegationMock = $this->getMockBuilder(DelegatingEngine::class)
->disableOriginalConstructor()
->getMock();
$contentHelper = new ContentHelper($dispatcherMock, $delegationMock);
$sample = '<h1>Hello World</h1>
<script>
console.log("do not mind me");
</script>';
$expected = '<h1>Hello World</h1>
[script]
console.log("do not mind me");
[/script]';
$result = $contentHelper->showScriptTags($sample);
$this->assertEquals($expected, $result);
}
}