Skip to content

Commit e881826

Browse files
fix: Missing vendor name in install path
1 parent aec3bce commit e881826

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

src/ThemeInstaller.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ protected function getBaseInstallationPath()
5454
*/
5555
protected function getThemeName(PackageInterface $package)
5656
{
57-
$name = $package->getPrettyName();
58-
$split = explode("/", $name);
59-
60-
$splitNameToUse = explode("-", count($split) >= 2 ? $split[1] : $split[0]);
61-
62-
return implode('', array_map('strtolower', array_filter($splitNameToUse, function ($value) {
63-
return $value !== "theme";
64-
})));
57+
return str_replace('-theme', '', str_replace('-theme', '', $package->getPrettyName()));
6558
}
6659
}

tests/ThemeInstallerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function it_supports_vendor_not_included()
5050
{
5151
$mock = $this->getMockPackage('name');
5252

53-
$this->assertEquals('themes/Name', $this->test->getInstallPath($mock));
53+
$this->assertEquals('themes/name', $this->test->getInstallPath($mock));
5454
}
5555

5656
/**
@@ -59,7 +59,7 @@ public function it_supports_vendor_not_included()
5959
public function it_returns_themes_folder_by_default()
6060
{
6161
$mock = $this->getMockPackage('vendor/name-theme');
62-
$this->assertEquals('themes/Name', $this->test->getInstallPath($mock));
62+
$this->assertEquals('themes/vendor/name', $this->test->getInstallPath($mock));
6363
}
6464

6565
/**
@@ -69,7 +69,7 @@ public function it_can_use_compound_theme_names()
6969
{
7070
$mock = $this->getMockPackage('vendor/compound-name-theme');
7171

72-
$this->assertEquals('themes/CompoundName', $this->test->getInstallPath($mock));
72+
$this->assertEquals('themes/vendor/compound-name', $this->test->getInstallPath($mock));
7373
}
7474

7575
/**
@@ -87,10 +87,10 @@ public function it_can_use_custom_path()
8787
$package = $this->getMockPackage('vendor/name-theme');
8888

8989
$this->composer->shouldReceive('getExtra')
90-
->andReturn(['theme-dir' => 'Custom'])
90+
->andReturn(['theme-dir' => 'custom'])
9191
->getMock();
9292

93-
$this->assertEquals('Custom/Name', $this->test->getInstallPath($package));
93+
$this->assertEquals('custom/vendor/name', $this->test->getInstallPath($package));
9494
}
9595

9696

0 commit comments

Comments
 (0)