diff --git a/src/ThemeInstaller.php b/src/ThemeInstaller.php index 1e254d6..bff6dfe 100644 --- a/src/ThemeInstaller.php +++ b/src/ThemeInstaller.php @@ -54,13 +54,6 @@ protected function getBaseInstallationPath() */ protected function getThemeName(PackageInterface $package) { - $name = $package->getPrettyName(); - $split = explode("/", $name); - - $splitNameToUse = explode("-", count($split) >= 2 ? $split[1] : $split[0]); - - return implode('', array_map('strtolower', array_filter($splitNameToUse, function ($value) { - return $value !== "theme"; - }))); + return str_replace('-theme', '', str_replace('-theme', '', $package->getPrettyName())); } } diff --git a/tests/ThemeInstallerTest.php b/tests/ThemeInstallerTest.php index a33f7bf..0f321f6 100644 --- a/tests/ThemeInstallerTest.php +++ b/tests/ThemeInstallerTest.php @@ -50,7 +50,7 @@ public function it_supports_vendor_not_included() { $mock = $this->getMockPackage('name'); - $this->assertEquals('themes/Name', $this->test->getInstallPath($mock)); + $this->assertEquals('themes/name', $this->test->getInstallPath($mock)); } /** @@ -59,7 +59,7 @@ public function it_supports_vendor_not_included() public function it_returns_themes_folder_by_default() { $mock = $this->getMockPackage('vendor/name-theme'); - $this->assertEquals('themes/Name', $this->test->getInstallPath($mock)); + $this->assertEquals('themes/vendor/name', $this->test->getInstallPath($mock)); } /** @@ -69,7 +69,7 @@ public function it_can_use_compound_theme_names() { $mock = $this->getMockPackage('vendor/compound-name-theme'); - $this->assertEquals('themes/CompoundName', $this->test->getInstallPath($mock)); + $this->assertEquals('themes/vendor/compound-name', $this->test->getInstallPath($mock)); } /** @@ -87,10 +87,10 @@ public function it_can_use_custom_path() $package = $this->getMockPackage('vendor/name-theme'); $this->composer->shouldReceive('getExtra') - ->andReturn(['theme-dir' => 'Custom']) + ->andReturn(['theme-dir' => 'custom']) ->getMock(); - $this->assertEquals('Custom/Name', $this->test->getInstallPath($package)); + $this->assertEquals('custom/vendor/name', $this->test->getInstallPath($package)); }