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