[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/lib/plugins/usermanager/_test/ -> csv_export.test.php (source)

   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:arthur@example.com
  25       */
  26      function test_export() {
  27          $expected = 'User,"Real Name",Email,Groups
  28  testuser,"Arthur Dent",arthur@example.com,
  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",arthur@example.com,
  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  }