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