Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Aug 11, 2023
1 parent aa823f6 commit 1a3c9c2
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"composer/semver": "^3.0",
"illuminate/console": "^10.17",
"illuminate/filesystem": "^10.17",
"orchestra/testbench-core": "^8.6"
"orchestra/testbench-core": "^8.6.2"
},
"require-dev": {
"laravel/pint": "^1.6",
"laravel/prompts": "^0.1.4",
"orchestra/testbench": "^8.6",
"orchestra/testbench": "^8.6.3",
"phpstan/phpstan": "^1.10.6",
"phpunit/phpunit": "^10.1"
},
Expand Down
13 changes: 13 additions & 0 deletions src/Commands/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Console\OutputStyle;
use Illuminate\Console\View\Components\Factory;
use Orchestra\Canvas\Core\Presets\Preset;
use Orchestra\Testbench\Foundation\Application as Testbench;
use Symfony\Component\Console\Command\Command as SymfonyConsole;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -61,6 +62,8 @@ protected function initialize(InputInterface $input, OutputInterface $output)
*/
public function run(InputInterface $input, OutputInterface $output): int
{
$this->laravel = Testbench::create(basePath: $this->preset->laravelPath());

Check failure on line 65 in src/Commands/Command.php

View workflow job for this annotation

GitHub Actions / PHP8.1 on ubuntu-latest (highest)

Access to an undefined property Orchestra\Canvas\Core\Commands\Command::$laravel.

return parent::run(
$this->input = $input,
$this->output = new OutputStyle($input, $output)
Expand All @@ -81,4 +84,14 @@ protected function resolveCommand($command)
: $command
);
}

/**
* Get the Laravel application instance.
*
* @return \Illuminate\Contracts\Foundation\Application
*/
public function getLaravel()
{
return $this->laravel;

Check failure on line 95 in src/Commands/Command.php

View workflow job for this annotation

GitHub Actions / PHP8.1 on ubuntu-latest (highest)

Access to an undefined property Orchestra\Canvas\Core\Commands\Command::$laravel.
}
}
8 changes: 8 additions & 0 deletions src/Presets/Laravel.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ public function name(): string
return 'laravel';
}

/**
* Get the path to the base working directory.
*/
public function laravelPath(): string
{
return $this->basePath();
}

/**
* Get the path to the source directory.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/Presets/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ public function name(): string
return 'package';
}

/**
* Get the path to the base working directory.
*/
public function laravelPath(): string
{
return sprintf('%s/orchestra/testbench-core/laravel', $this->vendorPath());
}

/**
* Get the path to the source directory.
*/
Expand Down
13 changes: 13 additions & 0 deletions src/Presets/Preset.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ public function basePath(): string
return $this->basePath;
}

/**
* Get the path to the base working directory.
*/
public function vendorPath(): string
{
return "{$this->basePath}/vendor";
}

/**
* Get the path to the resource directory.
*/
Expand Down Expand Up @@ -131,6 +139,11 @@ public function hasCustomStubPath(): bool
*/
abstract public function name(): string;

/**
* Get the path to the base working directory.
*/
abstract public function laravelPath(): string;

/**
* Get the path to the source directory.
*/
Expand Down

0 comments on commit 1a3c9c2

Please sign in to comment.