mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
Adapt tests
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
71a3528510
commit
791d57051a
2 changed files with 17 additions and 10 deletions
|
|
@ -232,6 +232,8 @@ class Util {
|
|||
|
||||
/**
|
||||
* Return the list of scripts injected to the page
|
||||
* @return array
|
||||
* @since 24.0.0
|
||||
*/
|
||||
public static function getScripts(): array {
|
||||
// merging first and last data set
|
||||
|
|
|
|||
|
|
@ -225,30 +225,35 @@ class UtilTest extends \Test\TestCase {
|
|||
|
||||
\OC_Util::$scripts = [];
|
||||
\OC_Util::$styles = [];
|
||||
self::invokePrivate(\OCP\Util::class, 'scripts', [[]]);
|
||||
}
|
||||
protected function tearDown(): void {
|
||||
parent::tearDown();
|
||||
|
||||
\OC_Util::$scripts = [];
|
||||
\OC_Util::$styles = [];
|
||||
self::invokePrivate(\OCP\Util::class, 'scripts', [[]]);
|
||||
}
|
||||
|
||||
public function testAddScript() {
|
||||
\OC_Util::addScript('core', 'myFancyJSFile1');
|
||||
\OC_Util::addScript('myApp', 'myFancyJSFile2');
|
||||
\OC_Util::addScript('core', 'myFancyJSFile0', true);
|
||||
\OC_Util::addScript('core', 'myFancyJSFile10', true);
|
||||
\OCP\Util::addScript('core', 'myFancyJSFile1');
|
||||
\OCP\Util::addScript('files', 'myFancyJSFile2', 'core');
|
||||
\OCP\Util::addScript('myApp', 'myFancyJSFile3');
|
||||
\OCP\Util::addScript('core', 'myFancyJSFile4');
|
||||
// after itself
|
||||
\OCP\Util::addScript('core', 'myFancyJSFile5', 'core');
|
||||
// add duplicate
|
||||
\OC_Util::addScript('core', 'myFancyJSFile1');
|
||||
\OCP\Util::addScript('core', 'myFancyJSFile1');
|
||||
|
||||
$this->assertEquals([
|
||||
'core/js/myFancyJSFile10',
|
||||
'core/js/myFancyJSFile0',
|
||||
'core/js/myFancyJSFile1',
|
||||
'core/js/myFancyJSFile4',
|
||||
'files/js/myFancyJSFile2',
|
||||
'core/js/myFancyJSFile5',
|
||||
'files/l10n/en',
|
||||
'myApp/l10n/en',
|
||||
'myApp/js/myFancyJSFile2',
|
||||
], \OC_Util::$scripts);
|
||||
$this->assertEquals([], \OC_Util::$styles);
|
||||
'myApp/js/myFancyJSFile3',
|
||||
], array_values(\OCP\Util::getScripts()));
|
||||
}
|
||||
|
||||
public function testAddVendorScript() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue