From 800c592986415ca530c6ed76bdc364ad67419934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Wed, 1 Dec 2021 19:08:58 +0100 Subject: [PATCH] Adapt tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- lib/private/legacy/OC_Util.php | 6 +++--- tests/lib/UtilTest.php | 23 +++++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 522875f21e5c5..0d6e628149c65 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -580,12 +580,12 @@ private static function generatePath($application, $directory, $file) { /** * add a javascript file * - * @deprecated 24.0.0 - * * @param string $application application id * @param string|null $file filename * @param bool $prepend prepend the Script to the beginning of the list * @return void + * + * @deprecated 24.0.0 */ public static function addScript($application, $file = null, $prepend = false) { $path = OC_Util::generatePath($application, 'js', $file); @@ -614,7 +614,7 @@ public static function addVendorScript($application, $file = null, $prepend = fa * add a translation JS file * * @deprecated 24.0.0 - * + * * @param string $application application id * @param string|null $languageCode language code, defaults to the current language * @param bool|null $prepend prepend the Script to the beginning of the list diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index ca7a4ad144233..75feb6b04d8d7 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -234,21 +234,24 @@ protected function tearDown(): void { } 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', + ], \OCP\Util::getScripts()); } public function testAddVendorScript() {