public function testFindFiles() { $this->createTempFiles(); $path = $this->path; $filesFound = find_files($path, 0, '*'); $this->assertSame(7, count($filesFound)); $jsFilesFound = find_js_files($path); $this->assertSame(2, count($jsFilesFound)); $htmlFilesFound = find_html_files($path); $this->assertSame(2, count($htmlFilesFound)); $phpFilesFound = find_php_files($path); $this->assertSame(2, count($phpFilesFound)); // Including subdirectories $filesFound = find_files($path, 0, '*', true); $this->assertSame(10, count($filesFound)); $jsFilesFound = find_js_files($path, true); $this->assertSame(3, count($jsFilesFound)); $htmlFilesFound = find_html_files($path, true); $this->assertSame(3, count($htmlFilesFound)); $phpFilesFound = find_php_files($path, true); $this->assertSame(3, count($phpFilesFound)); $this->assertInternalType('array', find_templates()); $this->removeTempFiles(); }
/** * Scan for uis. * @return array */ private static function uis() { self::requireConstants('APPLICATION_PATH', __FUNCTION__); $uiBasePath = APPLICATION_PATH . '/customs'; $uiDirectory = $uiBasePath . '/uis'; $uis = []; if (!file_exists($uiDirectory)) { return $uis; } $filePaths = find_js_files($uiDirectory, true); foreach ($filePaths as $path) { $uiPath = trim(substr($path, strlen($uiBasePath)), '/'); $uis[] = substr($uiPath, 0, -3); } return $uis; }