diff --git a/Module/ModuleManager.php b/Module/ModuleManager.php index a0f108d32..e2c6c3adc 100644 --- a/Module/ModuleManager.php +++ b/Module/ModuleManager.php @@ -660,11 +660,11 @@ final class ModuleManager */ public function installApplications(string $from) : void { - if (!\is_dir($this->modulePath . $from . '/Application')) { + if (!\is_dir($this->modulePath . $from . '/Admin/Install/Application')) { return; } - $dirs = \scandir($this->modulePath . $from . '/Application'); + $dirs = \scandir($this->modulePath . $from . '/Admin/Install/Application'); if ($dirs === false) { return; } diff --git a/tests/System/File/FileUtilsTest.php b/tests/System/File/FileUtilsTest.php index 0f390112e..53c61c54b 100644 --- a/tests/System/File/FileUtilsTest.php +++ b/tests/System/File/FileUtilsTest.php @@ -89,4 +89,26 @@ class FileUtilsTest extends \PHPUnit\Framework\TestCase \unlink(__DIR__ . '/UTF-8.txt'); } } + + /** + * @testdox The file information can be resolved from a path + * @covers phpOMS\System\File\FileUtils + * @group framework + */ + public function testPathInfo() : void + { + self::assertEquals(__DIR__, FileUtils::mb_pathinfo(__DIR__ . '/FileUtilsTest.php', \PATHINFO_DIRNAME)); + self::assertEquals(\basename(__DIR__ . '/FileUtilsTest.php'), FileUtils::mb_pathinfo(__DIR__ . '/FileUtilsTest.php', \PATHINFO_BASENAME)); + self::assertEquals('php', FileUtils::mb_pathinfo(__DIR__ . '/FileUtilsTest.php', \PATHINFO_EXTENSION)); + self::assertEquals('FileUtilsTest', FileUtils::mb_pathinfo(__DIR__ . '/FileUtilsTest.php', \PATHINFO_FILENAME)); + self::assertEquals( + [ + 'dirname' => __DIR__, + 'basename' => \basename(__DIR__ . '/FileUtilsTest.php'), + 'extension' => 'php', + 'filename' => 'FileUtilsTest', + ], + FileUtils::mb_pathinfo(__DIR__ . '/FileUtilsTest.php', \PATHINFO_FILENAME) + ); + } } diff --git a/tests/System/File/Ftp/DirectoryTest.php b/tests/System/File/Ftp/DirectoryTest.php index f59e5c417..a522af538 100644 --- a/tests/System/File/Ftp/DirectoryTest.php +++ b/tests/System/File/Ftp/DirectoryTest.php @@ -871,4 +871,28 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase self::assertEquals(__DIR__ . '/dirtest', $dir->current()->getDirPath()); } + + /** + * @covers phpOMS\System\File\Ftp\Directory + * @group framework + */ + public function testNodeValid() : void + { + $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); + $dir->next(); + + self::assertTrue($dir->valid()); + } + + /** + * @covers phpOMS\System\File\Ftp\Directory + * @group framework + */ + public function testNodeInvalid() : void + { + $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); + $dir->next()->next()->next()->next()->next()->next()->next(); + + self::assertFalse($dir->valid()); + } } diff --git a/tests/Uri/UriFactoryTest.php b/tests/Uri/UriFactoryTest.php index bb6d151ae..70be20c60 100644 --- a/tests/Uri/UriFactoryTest.php +++ b/tests/Uri/UriFactoryTest.php @@ -224,4 +224,31 @@ class UriFactoryTest extends \PHPUnit\Framework\TestCase self::assertEquals($unescaped, UriFactory::build($escaped)); } + + /** + * @testdox In case of missing ? for query the builder automatically fixes it + * @covers phpOMS\Uri\UriFactory + * @group framework + */ + public function testMissingQueryIdentifier() : void + { + $uri = 'http://www.test-uri.com/path/here?id=123&ab=c#fragi'; + + UriFactory::setupUriBuilder(new HttpUri($uri)); + + self::assertEquals($uri, UriFactory::build('{/base}{/rootPath}{/}&id={?id}&ab={?ab}#{#}')); + } + + /** + * @testdox In case of missing ? for query the builder automatically fixes it + * @covers phpOMS\Uri\UriFactory + * @group framework + */ + public function testNormalUrlParsing() : void + { + $uri = 'http://www.test-uri.com/path/here?id=123&ab=c#fragi'; + $expected = 'http://www.test-uri.com/path/here?id=123&ab=c#fragi'; + + self::assertEquals($expected, UriFactory::build($uri)); + } }