Skip to content

Commit

Permalink
FileactionsTest: static provider methods
Browse files Browse the repository at this point in the history
  • Loading branch information
distantnative committed Dec 27, 2023
1 parent 9ddc04d commit 466f6b0
Showing 1 changed file with 14 additions and 14 deletions.
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

0 comments on commit 466f6b0

Please sign in to comment.