Skip to content

Commit

Permalink
Forward methods using argument list function to make mocking easier
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Sep 8, 2024
1 parent 26bfbe1 commit 0ae4a02
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/framework/src/Facades/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static function unlinkIfExists(string $path): bool
*/
public static function getContents(string $path, bool $lock = false): string
{
return self::get($path, $lock);
return self::get(...func_get_args());
}

/**
Expand All @@ -126,7 +126,7 @@ public static function getContents(string $path, bool $lock = false): string
*/
public static function putContents(string $path, string $contents, bool $lock = false): bool|int
{
return self::put($path, $contents, $lock);
return self::put(...func_get_args());
}

protected static function filesystem(): \Illuminate\Filesystem\Filesystem
Expand Down
18 changes: 16 additions & 2 deletions packages/framework/tests/Feature/FilesystemFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,32 @@ public function testUnlinkIfExists()

public function testGetContents()
{
$this->createExpectation('get', 'string', Hyde::path('path'), false);
$this->createExpectation('get', 'string', Hyde::path('path'));

Filesystem::getContents('path');
}

public function testGetContentsWithLock()
{
$this->createExpectation('get', 'string', Hyde::path('path'), true);

Filesystem::getContents('path', true);
}

public function testPutContents()
{
$this->createExpectation('put', true, Hyde::path('path'), 'string', false);
$this->createExpectation('put', true, Hyde::path('path'), 'string');

Filesystem::putContents('path', 'string');
}

public function testPutContentsWithLock()
{
$this->createExpectation('put', true, Hyde::path('path'), 'string', true);

Filesystem::putContents('path', 'string', true);
}

public function testExists()
{
$this->createExpectation('exists', true, Hyde::path('path'));
Expand Down

0 comments on commit 0ae4a02

Please sign in to comment.