Exemplo n.º 1
0
 /**
  * @dataProvider dataLoadingJSAndCSS
  * @param string $scriptName
  * @param string $pathInfo
  * @param IUser|null $user
  * @param bool $scriptsAdded
  */
 public function testLoadingJSAndCSS($scriptName, $pathInfo, $user, $scriptsAdded)
 {
     $this->request->expects($this->any())->method('getScriptName')->willReturn($scriptName);
     $this->request->expects($this->any())->method('getPathInfo')->willReturn($pathInfo);
     $this->session->expects($this->once())->method('getUser')->willReturn($user);
     \OC_Util::$scripts = [];
     \OC_Util::$styles = [];
     include __DIR__ . '/../../appinfo/app.php';
     if ($scriptsAdded) {
         $this->assertNotEmpty(\OC_Util::$scripts);
         $this->assertNotEmpty(\OC_Util::$styles);
     } else {
         $this->assertEmpty(\OC_Util::$scripts);
         $this->assertEmpty(\OC_Util::$styles);
     }
 }
Exemplo n.º 2
0
 /**
  * @brief loads all apps
  * @param array $types
  * @return bool
  *
  * This function walks through the owncloud directory and loads all apps
  * it can find. A directory contains an app if the file /appinfo/app.php
  * exists.
  *
  * if $types is set, only apps of those types will be loaded
  */
 public static function loadApps($types = null)
 {
     // Load the enabled apps here
     $apps = self::getEnabledApps();
     // prevent app.php from printing output
     ob_start();
     foreach ($apps as $app) {
         if ((is_null($types) or self::isType($app, $types)) && !in_array($app, self::$loadedApps)) {
             self::loadApp($app);
             self::$loadedApps[] = $app;
         }
     }
     ob_end_clean();
     if (!defined('DEBUG') || !DEBUG) {
         if (is_null($types) && empty(OC_Util::$coreScripts) && empty(OC_Util::$coreStyles)) {
             OC_Util::$coreScripts = OC_Util::$scripts;
             OC_Util::$scripts = array();
             OC_Util::$coreStyles = OC_Util::$styles;
             OC_Util::$styles = array();
         }
     }
     // return
     return true;
 }
Exemplo n.º 3
0
 protected function tearDown()
 {
     parent::tearDown();
     \OC_Util::$scripts = [];
     \OC_Util::$styles = [];
 }