App\Services\Deployment\DeployerRecipeFileBuilder::pathInfo PHP Method

pathInfo() public method

Set a recipe file path info.
public pathInfo ( ) : DeployerRecipeFileBuilder
return DeployerRecipeFileBuilder $this
    public function pathInfo()
    {
        $id = md5(uniqid(rand(), true));
        $baseName = "recipe_{$id}.php";
        $fullPath = storage_path("app/{$baseName}");
        $this->deployerFile->setBaseName($baseName);
        $this->deployerFile->setFullPath($fullPath);
        return $this;
    }

Usage Example

 public function test_Should_BuildDeployerRecipeFile()
 {
     $this->mockFilesystem->shouldReceive('delete')->once();
     $this->mockFilesystem->shouldReceive('put')->once();
     $recipeFileBuilder = new DeployerRecipeFileBuilder($this->mockFilesystem, new DeployerFile());
     $recipeFileBuilder->setRecipe($this->mockRecipeModel);
     $result = $recipeFileBuilder->pathInfo()->put()->getResult();
     $this->assertStringMatchesFormat('recipe_%x.php', $result->getBaseName());
     $this->assertStringMatchesFormat(storage_path("app/recipe_%x.php"), $result->getFullPath());
 }