Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Classes/Core/ApplicationKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function registerBundles(): array
*/
public function getProjectDir(): string
{
return $this->getAndCreateApplicationStructure()->getApplicationRoot();
return $this->getAndCreateApplicationStructure()->getCorePackageRoot();
}

/**
Expand Down
14 changes: 13 additions & 1 deletion Classes/Core/ApplicationStructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
*/
class ApplicationStructure
{
/**
* Returns the absolute path to the phplist4-core package root.
*
* @return string the absolute path without the trailing slash.
*
* @throws \RuntimeException if there is no composer.json in the application root
*/
public function getCorePackageRoot(): string
{
return dirname(__DIR__, 2);
}

/**
* Returns the absolute path to the application root.
*
Expand All @@ -25,7 +37,7 @@ class ApplicationStructure
*/
public function getApplicationRoot(): string
{
$corePackagePath = dirname(__DIR__, 2);
$corePackagePath = $this->getCorePackageRoot();
$corePackageIsRootPackage = interface_exists('PhpList\\PhpList4\\Tests\\Support\\Interfaces\\TestMarker');
if ($corePackageIsRootPackage) {
$applicationRoot = $corePackagePath;
Expand Down
4 changes: 2 additions & 2 deletions Tests/Integration/Core/ApplicationKernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ protected function tearDown()
/**
* @test
*/
public function getProjectDirReturnsApplicationRoot()
public function getProjectDirReturnsCorePackacgeRoot()
{
self::assertSame(dirname(__DIR__, 3), $this->subject->getProjectDir());
}

/**
* @test
*/
public function getRootDirReturnsApplicationRoot()
public function getRootDirReturnsCorePackacgeRoot()
{
self::assertSame(dirname(__DIR__, 3), $this->subject->getRootDir());
}
Expand Down
8 changes: 8 additions & 0 deletions Tests/Unit/Core/ApplicationStructureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,12 @@ public function getApplicationRootReturnsCoreApplicationRoot()
{
self::assertSame(dirname(__DIR__, 3), $this->subject->getApplicationRoot());
}

/**
* @test
*/
public function getCorePackageRootReturnsCorePackageRoot()
{
self::assertSame(dirname(__DIR__, 3), $this->subject->getCorePackageRoot());
}
}