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