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
|
<?php
namespace dokuwiki\plugin\bureaucracy\test;
/**
* @group plugin_bureaucracy
* @group plugins
*/
class bureaucracy_field_yesno_test extends BureaucracyTest
{
public function dataProvider()
{
return [
[
'cb:@@checkbox@@',
'"=Yes"',
'"!No"',
'1',
'cb:Yes',
[],
'default checked substitution',
],
[
'cb:@@checkbox@@',
'"=Yes"',
'"!No"',
'0',
'cb:No',
[],
'default unchecked substitution',
],
];
}
/**
* @dataProvider dataProvider
*
* @param string $templateSyntax
* @param $YesValue
* @param $NoValue
* @param $isChecked
* @param string $expectedWikiText
* @param string $expectedValidationErrors
* @param string $msg
*
*/
public function test_field_yesno(
$templateSyntax,
$YesValue,
$NoValue,
$isChecked,
$expectedWikiText,
$expectedValidationErrors,
$msg
) {
$actualValidationErrors = [];
$label = 'checkbox';
$actualWikiText = parent::send_form_action_template(
"yesno \"$label\" $YesValue $NoValue",
$templateSyntax,
$actualValidationErrors,
$isChecked
);
$this->assertEquals($expectedWikiText, $actualWikiText, $msg);
$this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg);
}
}
|