130 : void
131 {
132 $settings_mock = $this->createMock(ilSetting::class);
133 $ini_mock = $this->createMock(ilIniFile::class);
134
135 $ref = new stdClass();
136 $ref->ref_id = 32;
137 $this->db_mock->expects($this->once())
138 ->method('fetchObject')
139 ->willReturn($ref);
140
141 $this->db_mock->expects($this->once())
142 ->method('fetchAssoc')
143 ->willReturn([]);
144
145 $default_whitelist = include __DIR__ . "/../defaults/default_whitelist.php";
146
147
148 $consecutive = [
149 ['suffix_custom_expl_black', 'bl001,bl002'],
150 ['suffix_repl_additional', 'docx,doc'],
151 ['suffix_custom_white_list', 'wl001,wl002']
152 ];
153 $settings_mock
154 ->expects($this->exactly(3))
155 ->method('get')
156 ->willReturnCallback(
157 function ($k) use (&$consecutive) {
158 [$expected, $return] = array_shift($consecutive);
159 $this->assertEquals($expected, $k);
160 return $return;
161 }
162 );
163
165 $this->assertSame(['bl001', 'bl002'], $settings->getBlackListedSuffixes());
166 $this->assertSame(['bl001', 'bl002'], $settings->getProhibited());
167 $this->assertEquals($default_whitelist, $settings->getDefaultWhitelist());
168 $this->assertSame(['docx', 'doc'], $settings->getWhiteListNegative());
169 $this->assertSame(['wl001', 'wl002'], $settings->getWhiteListPositive());
170
171 $whitelist = array_merge(
172 array_diff($default_whitelist, ['docx', 'doc']),
173 ['wl001', 'wl002', '']
174 );
175 $diff = array_diff($whitelist, $settings->getWhiteListedSuffixes());
176
177 $this->assertSame([], $diff);
178 $this->assertCount(0, $diff);
179 }