Conditions | 1 |
Paths | 1 |
Total Lines | 29 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | public function testContentLinkInjections() |
||
11 | { |
||
12 | $field = new DBText(); |
||
13 | |||
14 | // External links injection. |
||
15 | $field->setValue('<a href="http://newzealand.govt.nz">New Zealand Government</a>'); |
||
16 | $this->assertEquals( |
||
17 | $field->RichLinks(), |
||
18 | '<a class="external" rel="external" title="Open external link" ' |
||
19 | . 'href="http://newzealand.govt.nz">New Zealand Government' |
||
20 | .'<span class="nonvisual-indicator">(external link)</span></a>', |
||
21 | 'Injects attributes to external link without target.' |
||
22 | ); |
||
23 | |||
24 | $field->setValue('<a href="http://newzealand.govt.nz" target="_blank">New Zealand Government</a>'); |
||
25 | $this->assertEquals( |
||
26 | $field->RichLinks(), |
||
27 | '<a class="external" rel="external" title="Open external link" ' |
||
28 | . 'href="http://newzealand.govt.nz" target="_blank">New Zealand Government' |
||
29 | .'<span class="nonvisual-indicator">(external link)</span></a>', |
||
30 | 'Injects attributes to external link with target, while keeping the existing attributes.' |
||
31 | ); |
||
32 | |||
33 | // Check the normal links are not affected. |
||
34 | $field->setValue('<a href="[sitetree_link,id=1]">Internal</a>'); |
||
35 | $this->assertEquals( |
||
36 | $field->RichLinks(), |
||
37 | '<a href="[sitetree_link,id=1]">Internal</a>', |
||
38 | 'Regular link is not modified.' |
||
39 | ); |
||
42 |