blob: dc3dc7bdad913ba22e86e0f13beb6de75d2fadf3 (
plain)
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
48
49
50
51
52
|
<?php
namespace SMW\Tests\Elastic\QueryEngine;
use SMW\Elastic\QueryEngine\Excerpts;
/**
* @covers \SMW\Elastic\QueryEngine\Excerpts
* @group semantic-mediawiki
*
* @license GNU GPL v2+
* @since 3.0
*
* @author mwjames
*/
class ExcerptsTest extends \PHPUnit_Framework_TestCase {
public function testCanConstruct() {
$this->assertInstanceOf(
Excerpts::class,
new Excerpts()
);
}
public function testGetExcerpt_StrippedTagsOnString() {
$instance = new Excerpts();
$instance->addExcerpt( 'Foo', '<div style="display:none;">Foo<em>bar</em></div>' );
$this->assertEquals(
'Foo<em>bar</em>',
$instance->getExcerpt( 'Foo' )
);
}
public function testGetExcerpt_StrippedTagsOnArray() {
$instance = new Excerpts();
$instance->addExcerpt( 'Bar', [
'test_field' => [ '<div style="display:none;">Foo<em>bar</em></div>', 'Fooba<em>r</em>' ]
] );
$this->assertEquals(
'Foo<em>bar</em> Fooba<em>r</em>',
$instance->getExcerpt( 'Bar' )
);
}
}
|