Skip to content

Commit

Permalink
Merge branch '1.x' into 7.x
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Aug 26, 2024
2 parents 45a6e25 + dc40245 commit 82247eb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG-1.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

This changelog references the relevant changes (bug and security fixes) done to `orchestra/workbench`.

## 1.9.0

Released: 2024-08-26

### Changes

* Allows following methods on `Orchestra\Workbench\Workbench` to accept arrays:
- `laravelPath()`
- `packagePath()`
- `path()`

## 1.8.0

Released: 2024-08-13
Expand Down
22 changes: 7 additions & 15 deletions src/Workbench.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

use Illuminate\Support\Arr;

use function Orchestra\Testbench\join_paths;
use function Orchestra\Testbench\package_path;
use function Orchestra\Testbench\workbench_path;

/**
* @phpstan-import-type TWorkbenchConfig from \Orchestra\Testbench\Foundation\Config
*/
Expand All @@ -19,7 +15,7 @@ class Workbench
public static function laravelPath(array|string $path = ''): string
{
return app()->basePath(
join_paths(...Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path))
\Orchestra\Testbench\join_paths(...Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path))
);
}

Expand All @@ -28,23 +24,19 @@ public static function laravelPath(array|string $path = ''): string
*/
public static function packagePath(array|string $path = ''): string
{
if (\func_num_args() > 1) {
return package_path(...\func_get_args());
}

return package_path($path);
return \Orchestra\Testbench\package_path(
...Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path)
);
}

/**
* Get the path to the workbench folder.
*/
public static function path(array|string $path = ''): string
{
if (\func_num_args() > 1) {
return workbench_path(...\func_get_args());
}

return workbench_path($path);
return \Orchestra\Testbench\workbench_path(
...Arr::wrap(\func_num_args() > 1 ? \func_get_args() : $path)
);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/WorkbenchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public function it_can_resolve_package_path()
);

$this->assertSame(
realpath(__DIR__.'/../tests/WorkbenchTest.php'), Workbench::packagePath(['tests', 'WorkbenchTest.php'])
realpath(__FILE__), Workbench::packagePath('tests', 'WorkbenchTest.php')
);

$this->assertSame(
realpath(__DIR__.'/../tests/WorkbenchTest.php'), Workbench::packagePath('tests', 'WorkbenchTest.php')
realpath(__FILE__), Workbench::packagePath(['tests', 'WorkbenchTest.php'])
);
}

Expand All @@ -61,11 +61,11 @@ public function it_can_resolve_workbench_path()
);

$this->assertSame(
realpath(__DIR__.'/../workbench/dist/app.js'), Workbench::path(['dist', 'app.js'])
realpath(__DIR__.'/../workbench/dist/app.js'), Workbench::path('dist', 'app.js')
);

$this->assertSame(
realpath(__DIR__.'/../workbench/dist/app.js'), Workbench::path('dist', 'app.js')
realpath(__DIR__.'/../workbench/dist/app.js'), Workbench::path(['dist', 'app.js'])
);
}

Expand Down

0 comments on commit 82247eb

Please sign in to comment.