-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDictionaryLoadingTest.php
More file actions
38 lines (28 loc) · 1.07 KB
/
Copy pathDictionaryLoadingTest.php
File metadata and controls
38 lines (28 loc) · 1.07 KB
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
<?php
/**
* Created by PhpStorm.
* User: sh
* Date: 20.12.17
* Time: 23:45
*/
namespace Tests\Shdev\FlashText\KeywordProcessor;
use Shdev\FlashText\KeywordProcessor;
class DictionaryLoadingTest extends \PHPUnit_Framework_TestCase
{
public function testDictionaryLoading()
{
$keywordProcessor= new KeywordProcessor();
$keywordAssocArray = [
'java' => ['java_2e', 'java programing'],
'product management' => ['product management techniques', 'product management'],
];
$keywordProcessor->addKeywordsFromAssocArray($keywordAssocArray);
$sentence = 'I know java_2e and product management techniques';
$keywordsExtracted= $keywordProcessor->extractKeywords($sentence);
$this->assertEquals(['java', 'product management'], $keywordsExtracted,
'Failed file format one test');
$sentenceNew= $keywordProcessor->replaceKeywords($sentence);
$this->assertEquals('I know java and product management', $sentenceNew,
'Failed file format one test');
}
}