diff --git a/tests/Drupal8FinderTest.php b/tests/Drupal8FinderTest.php index ad84954..3b167c1 100644 --- a/tests/Drupal8FinderTest.php +++ b/tests/Drupal8FinderTest.php @@ -214,6 +214,43 @@ public function testDrupalComposerStructureWithRealFilesystem() $this->assertSame($root . '/vendor', $this->finder->getVendorDir()); } + public function testDrupalDefaultStructureWithRealFilesystemInSubdirectory() + { + $root = $this->tempdir(sys_get_temp_dir()); + mkdir($root . '/release'); + mkdir($root . '/release/1'); + mkdir($root . '/release/1/htdocs'); + mkdir($root . '/release/2'); + mkdir($root . '/release/2/htdocs'); + + $this->dumpToFileSystem(static::$fileStructure, $root . '/release/1/htdocs'); + $this->dumpToFileSystem(static::$fileStructure, $root . '/release/2/htdocs'); + + $this->symlink($root . '/release/2', $root . '/current'); + + $this->finder->locateRoot($root . '/current/htdocs'); + $this->assertSame($root . '/current/htdocs', $this->finder->getDrupalRoot()); + } + + public function testDrupalComposerStructureWithRealFilesystemInSubdirectory() + { + $root = $this->tempdir(sys_get_temp_dir()); + mkdir($root . '/release'); + mkdir($root . '/release/1'); + mkdir($root . '/release/2'); + + $this->dumpToFileSystem($this->getDrupalComposerStructure(), $root . '/release/1'); + $this->dumpToFileSystem($this->getDrupalComposerStructure(), $root . '/release/2'); + + $this->symlink($root . '/release/2', $root . '/current'); + + $this->finder->locateRoot($root . '/current'); + $this->assertSame($root . '/release/2/web', $this->finder->getDrupalRoot()); + + $this->finder->locateRoot($root . '/current/web'); + $this->assertSame($root . '/release/2/web', $this->finder->getDrupalRoot()); + } + public function testDrupalWithLinkedModule() { $root = $this->tempdir(sys_get_temp_dir());