Shopware\PluginCreator\Services\WorkingDirectoryProvider\LegacyOutputDirectoryProvider::getPath PHP Method

getPath() public method

public getPath ( ) : string
return string
    public function getPath()
    {
        if ($this->rootDetector->isRoot($this->getCwd())) {
            return $this->getCwd() . '/' . self::LEGACY_PLUGIN_DIR . '/' . $this->namespace . '/' . $this->name . '/';
        }
        return $this->getCwd() . '/' . $this->name . '/';
    }

Usage Example

 public function testGetLegacyPathIfNotExecutedFromShopwareRoot()
 {
     $expectedPath = getcwd() . '/' . self::PLUGIN_NAME . '/';
     $shopwareRootDetectorStub = $this->getMock(ShopwareRootDetector::class);
     $shopwareRootDetectorStub->method('isRoot')->willReturn(false);
     $legacyOutputDirectoryProvider = new LegacyOutputDirectoryProvider($shopwareRootDetectorStub, self::PLUGIN_NAME, LegacyOutputDirectoryProvider::FRONTEND_NAMESPACE);
     $path = $legacyOutputDirectoryProvider->getPath();
     $this->assertEquals($expectedPath, $path);
 }