[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/_test/tests/inc/ -> styleutils_cssstyleini.test.php (source)

   1  <?php
   2  
   3  class styleutils_cssstyleini_test extends DokuWikiTest {
   4  
   5      function test_mergedstyleini() {
   6          $util = new \dokuwiki\StyleUtils('dokuwiki', false, true);
   7  
   8          $expected = array (
   9              'stylesheets' =>
  10                  array (
  11                      'screen' =>
  12                          array (
  13                              DOKU_CONF . 'tpl/dokuwiki/css/_tests.less' => '/./',
  14                              DOKU_INC . 'lib/tpl/dokuwiki/css/content.less' => '/./lib/tpl/dokuwiki/',
  15                          ),
  16                  ),
  17              'replacements' =>
  18                  array (
  19                      '__text__' => '#333',
  20                      '__background__' => '#f2ecec',
  21                      '__custom_variable__' => '#5e4040',
  22                      '__custom_variable_two__' => 'url(' . DOKU_BASE . 'test/foo.png)',
  23                  ),
  24          );
  25  
  26          $actual = $util->cssStyleini();
  27  
  28          // check that all stylesheet levels are present
  29          $this->assertArrayHasKey('all', $actual['stylesheets']);
  30          $this->assertArrayHasKey('print', $actual['stylesheets']);
  31  
  32          // check an original stylesheet and an additional one
  33          $this->assertArraySubset($expected['stylesheets']['screen'], $actual['stylesheets']['screen']);
  34  
  35          // merged config has an original value (text), an overridden value (background) and a new custom replacement (custom_variable)
  36          $this->assertArraySubset($expected['replacements'], $actual['replacements']);
  37      }
  38  }