Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileActionsTest: static provider methods #6092

Merged
merged 1 commit into from
Dec 30, 2023
Merged
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
28 changes: 14 additions & 14 deletions tests/Cms/Files/FileActionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
class FileActionsTest extends TestCase
{
protected $app;
protected $tmp;
protected $tmp = __DIR__ . '/tmp';

public function setUp(): void
{
Dir::make($this->tmp = __DIR__ . '/tmp');
$this->app = $this->app();
Dir::make($this->tmp);
$this->app = static::app();
}

public function tearDown(): void
Expand All @@ -25,11 +25,11 @@ public function tearDown(): void
Dir::remove($this->tmp);
}

public function app()
public static function app(): App
{
return new App([
'roots' => [
'index' => $this->tmp
'index' => __DIR__ . '/tmp'
],
'site' => [
'children' => [
Expand Down Expand Up @@ -58,9 +58,9 @@ public function app()
]);
}

public function appWithLanguages()
public static function appWithLanguages()
{
return $this->app()->clone([
return static::app()->clone([
'languages' => [
[
'code' => 'en',
Expand All @@ -75,19 +75,19 @@ public function appWithLanguages()
]);
}

public function parentProvider()
public static function parentProvider()
{
$app = $this->app();
$app = static::app();

return [
[$app->site()],
[$app->site()->children()->first()]
];
}

public function fileProvider()
public static function fileProvider(): array
{
$app = $this->app();
$app = static::app();

return [
[$app->site()->file()],
Expand Down Expand Up @@ -118,9 +118,9 @@ public function testChangeName(File $file)
$this->assertFileDoesNotExist($file->storage()->contentFile('published', 'default'));
}

public function fileProviderMultiLang()
public static function fileProviderMultiLang(): array
{
$app = $this->appWithLanguages();
$app = static::appWithLanguages();

return [
[$app->site()->file()],
Expand All @@ -133,7 +133,7 @@ public function fileProviderMultiLang()
*/
public function testChangeNameMultiLang(File $file)
{
$app = $this->appWithLanguages();
$app = static::appWithLanguages();
$app->impersonate('kirby');

// create an empty dummy file
Expand Down