Skip to content

Commit

Permalink
Adapt tests
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Dec 2, 2021
1 parent 68734a1 commit 800c592
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
6 changes: 3 additions & 3 deletions lib/private/legacy/OC_Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
23 changes: 13 additions & 10 deletions tests/lib/UtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 800c592

Please sign in to comment.