-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathValidateSearchTest.php
More file actions
72 lines (67 loc) · 2.58 KB
/
Copy pathValidateSearchTest.php
File metadata and controls
72 lines (67 loc) · 2.58 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
*
* @package phpBB Translation Validator
* @copyright (c) 2014 phpBB Ltd.
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace Phpbb\TranslationValidator\Tests\FileValidator;
use Phpbb\TranslationValidator\Output\Output;
class ValidateSearchTest extends TestBase
{
public function validateSearchSynonymsFileData()
{
return array(
array('search_synonyms/valid.php', array()),
array('search_synonyms/no_synonyms.php', array(
Output::FATAL . '-Must only contain the synonyms-array-search_synonyms/no_synonyms.php-',
)),
array('search_synonyms/invalid_synonyms.php', array(
Output::FATAL . '-Must only contain the synonyms-array-search_synonyms/invalid_synonyms.php-',
)),
array('search_synonyms/additional_variable.php', array(
Output::FATAL . '-Must only contain the synonyms-array-search_synonyms/additional_variable.php-',
)),
array('search_synonyms/invalid_synonym.php', array(
Output::FATAL . '-Must only contain entries of type string => string: s:3:"bar"; => i:1;-search_synonyms/invalid_synonym.php-',
Output::FATAL . '-Must only contain entries of type string => string: i:0; => s:4:"this";-search_synonyms/invalid_synonym.php-',
Output::FATAL . '-Must only contain entries of type string => string: i:1; => i:2;-search_synonyms/invalid_synonym.php-',
)),
);
}
/**
* @dataProvider validateSearchSynonymsFileData
*/
public function testValidateSearchSynonymsFile($file, $expected)
{
$this->validator->validateSearchSynonymsFile($file);
$this->assertOutputMessages($expected);
}
public function validateSearchIgnoreWordsFileData()
{
return array(
array('search_ignore_words/valid.php', array()),
array('search_ignore_words/no_words.php', array(
Output::FATAL . '-Must only contain the words-array-search_ignore_words/no_words.php-',
)),
array('search_ignore_words/invalid_words.php', array(
Output::FATAL . '-Must only contain the words-array-search_ignore_words/invalid_words.php-',
)),
array('search_ignore_words/additional_variable.php', array(
Output::FATAL . '-Must only contain the words-array-search_ignore_words/additional_variable.php-',
)),
array('search_ignore_words/invalid_word.php', array(
Output::FATAL . '-Must only contain entries of type string: i:0;-search_ignore_words/invalid_word.php-',
)),
);
}
/**
* @dataProvider validateSearchIgnoreWordsFileData
*/
public function testValidateSearchIgnoreWordsFile($file, $expected)
{
$this->validator->validateSearchIgnoreWordsFile($file);
$this->assertOutputMessages($expected);
}
}