Completed
Push — adminicons ( 220b8a...d1a314 )
by Andreas
03:46
created

plugin_usermanager_csv_export_test   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1
1
<?php
2
3
/**
4
 * @group plugin_usermanager
5
 * @group admin_plugins
6
 * @group plugins
7
 * @group bundled_plugins
8
 */
9
require_once(dirname(__FILE__).'/mocks.class.php');
10
11
class plugin_usermanager_csv_export_test extends DokuWikiTest {
12
13
    protected  $usermanager;
14
15
    function setUp() {
16
        $this->usermanager = new admin_mock_usermanager();
17
        parent::setUp();
18
    }
19
20
    /**
21
     * based on standard test user/conf setup
22
     *
23
     * users per _test/conf/users.auth.php
24
     * expected to be: testuser:179ad45c6ce2cb97cf1029e212046e81:Arthur Dent:[email protected]
25
     */
26
    function test_export() {
27
        $expected = 'User,"Real Name",Email,Groups
28
testuser,"Arthur Dent",[email protected],
29
';
30
        $this->assertEquals($expected, $this->usermanager->tryExport());
31
    }
32
33
    /**
34
     * when configured to use a different locale, the column headings in the first line of the
35
     * exported csv data should reflect the langauge strings of that locale
36
     */
37
    function test_export_withlocale(){
38
        global $conf;
39
        $old_conf = $conf;
40
        $conf['lang'] = 'de';
41
42
        $this->usermanager->localised = false;
43
        $this->usermanager->setupLocale();
44
45
        $conf = $old_conf;
46
47
        $expected = 'Benutzername,"Voller Name",E-Mail,Gruppen
48
testuser,"Arthur Dent",[email protected],
49
';
50
        $this->assertEquals($expected, $this->usermanager->tryExport());
51
    }
52
/*
53
    function test_export_withfilter(){
54
        $this->markTestIncomplete(
55
            'This test has not been implemented yet.'
56
        );
57
    }
58
*/
59
}
60