Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
},
"authors": [
{
"name": "Liam Hammett",
"email": "liam@liamhammett.com"
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"autoload": {
Expand All @@ -33,7 +33,7 @@
"Tests\\": "tests/"
},
"files": [
"tests/Support/FilesystemFakes.php"
"tests/Support/FilesystemFake.php"
]
},
"require": {
Expand Down
50 changes: 25 additions & 25 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Cpx\Support;
namespace Tests\Support;

/**
* Overrides the global rename() inside the Cpx\Support namespace so tests can
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Cpx\Packages\BinExecutable;
use Cpx\Process\ProcessRunner;
use Cpx\Runtime\Environment;
use Cpx\Support\FilesystemFake;
use Tests\Support\FilesystemFake;
use Cpx\Support\Interactivity;
use Laravel\Prompts\Output\BufferedConsoleOutput;
use Laravel\Prompts\Prompt;
Expand Down Expand Up @@ -87,7 +87,7 @@ protected function tearDown(): void

protected function temporaryDirectory(string $prefix = 'cpx-test'): string
{
$directory = sys_get_temp_dir().'/'.$prefix.'-'.bin2hex(random_bytes(8));
$directory = sys_get_temp_dir() . '/' . $prefix . '-' . bin2hex(random_bytes(8));

mkdir($directory, 0755, true);

Expand Down Expand Up @@ -186,7 +186,7 @@ protected function writeLocalPackageBinary(string $root, string $path, string $c

protected function writeLocalBinary(string $root, string $name, string $contents, ?string $binDir = null): string
{
$directory = "{$root}/".($binDir ?? 'vendor/bin');
$directory = "{$root}/" . ($binDir ?? 'vendor/bin');

if (! is_dir($directory)) {
mkdir($directory, 0755, true);
Expand Down
10 changes: 5 additions & 5 deletions tests/Unit/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Composer\Util\Filesystem as ComposerFilesystem;
use Cpx\Support\Filesystem;
use Cpx\Support\FilesystemFake;
use Tests\Support\FilesystemFake;

test('writeAtomic retries a transient rename failure', function () {
$directory = $this->temporaryDirectory('cpx-fs');
Expand All @@ -22,7 +22,7 @@

FilesystemFake::$failingRenames = 3;

expect(fn () => Filesystem::writeAtomic($path, 'contents'))
expect(fn() => Filesystem::writeAtomic($path, 'contents'))
->toThrow(RuntimeException::class, 'Unable to move');

expect(file_exists($path))->toBeFalse()
Expand Down Expand Up @@ -115,7 +115,7 @@
mkdir($escape, 0755, true);
file_put_contents("{$escape}/keep.txt", 'x');

expect(fn () => Filesystem::deleteDirectoryWithin("{$root}/../escape", $root))
expect(fn() => Filesystem::deleteDirectoryWithin("{$root}/../escape", $root))
->toThrow(RuntimeException::class);

expect(is_dir($escape))->toBeTrue()
Expand All @@ -132,7 +132,7 @@
file_put_contents("{$outside}/keep.txt", 'x');
symlink($outside, "{$root}/link");

expect(fn () => Filesystem::deleteDirectoryWithin("{$root}/link", $root))
expect(fn() => Filesystem::deleteDirectoryWithin("{$root}/link", $root))
->toThrow(RuntimeException::class);

expect(is_dir($outside))->toBeTrue()
Expand Down Expand Up @@ -191,7 +191,7 @@
mkdir($target, 0755, true);
file_put_contents("{$target}/old.txt", 'old');

expect(fn () => Filesystem::replaceDirectory("{$base}/missing", $target))
expect(fn() => Filesystem::replaceDirectory("{$base}/missing", $target))
->toThrow(RuntimeException::class, "Unable to move {$base}/missing to {$target}.");
});

Expand Down
Loading