public function testEngineResolvesCorrectPackagePaths()
 {
     $engine = $this->getEngine();
     $paths = ['test/package' => $this->normalizePath(template_storage_path() . 'test/package/', true), 'test/package:2.3' => $this->normalizePath(template_storage_path() . 'test/package_{2.3}/', true), 'test/package:6.3' => $this->normalizePath(template_storage_path() . 'test/package_{6.3}/', true), 'newup/package' => $this->normalizePath(template_storage_path() . 'newup/package/', true), 'newup/test:32' => $this->normalizePath(template_storage_path() . 'newup/test_{32}/', true), 'newup/test:dev' => $this->normalizePath(template_storage_path() . 'newup/test_{dev}/', true)];
     foreach ($paths as $packageName => $expectedPath) {
         $this->assertEquals($expectedPath, $engine->resolvePackagePath($packageName));
     }
 }
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->bind(FilesystemContract::class, Filesystem::class);
     $this->app->singleton(StorageEngine::class, function () {
         return new TemplateStorageEngine(app(FilesystemContract::class), app(Composer::class), template_storage_path(), app(Log::class));
     });
     $this->app->singleton(SearchableStorageEngine::class, StorageEngine::class);
     $this->app->singleton(AutoLoaderManager::class, function () {
         return new AutoLoaderManager(app(FilesystemContract::class), app(), app(Log::class));
     });
 }
Beispiel #3
0
 /**
  * Gets the path to a stored package.
  *
  * @param $packageName
  *
  * @return mixed
  */
 public function resolvePackagePath($packageName)
 {
     $packageVersion = $this->getPackageVersion($packageName);
     $packageName = $this->getCleanPackageNameString($packageName);
     $packagePath = template_storage_path() . $packageName;
     if ($packageVersion !== null) {
         $packagePath .= '_{' . $packageVersion . '}' . DIRECTORY_SEPARATOR;
     }
     return $this->normalizePath($packagePath, true);
 }