Skip to content

Commit

Permalink
refactor(test): FileStoreDriverTest to pass tests in Windows (forbidd…
Browse files Browse the repository at this point in the history
…en letters in folder name)

Anonymous class has static::class = ".../FileStoreDriverTest.php:14$49". Char ":" is forbidden in folder names in Windows.
  • Loading branch information
varemel committed Nov 5, 2023
1 parent 8320024 commit 563434b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 24 deletions.
28 changes: 4 additions & 24 deletions tests/Unit/Storage/FileStoreDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@
use DefStudio\Telegraph\Concerns\HasStorage;
use DefStudio\Telegraph\Contracts\Storable;
use DefStudio\Telegraph\Models\TelegraphChat;
use DefStudio\Telegraph\Tests\Unit\Storage\TestStorable;
use Illuminate\Support\Str;

beforeEach(function () {
Storage::fake();
});

it('can store and retrieve data', function (string $key, mixed $value) {
$class = new class () implements Storable {
use HasStorage;

public function storageKey(): string
{
return 'foo';
}
};
$class = new TestStorable();

$class->storage('file')->set($key, $value);

Expand All @@ -43,14 +37,7 @@ public function storageKey(): string
]);

it('can store and retrieve a model', function () {
$class = new class () implements Storable {
use HasStorage;

public function storageKey(): string
{
return 'foo';
}
};
$class = new TestStorable();

$model = TelegraphChat::factory()->create();

Expand All @@ -75,14 +62,7 @@ public function storageKey(): string
});

it('can store and retrieve a nested model', function () {
$class = new class () implements Storable {
use HasStorage;

public function storageKey(): string
{
return 'foo';
}
};
$class = new TestStorable();

$models = TelegraphChat::factory()->count(4)->create();

Expand Down
15 changes: 15 additions & 0 deletions tests/Unit/Storage/TestStorable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace DefStudio\Telegraph\Tests\Unit\Storage;

use DefStudio\Telegraph\Concerns\HasStorage;
use DefStudio\Telegraph\Contracts\Storable;

class TestStorable implements Storable {
use HasStorage;

public function storageKey(): string
{
return 'foo';
}
}

0 comments on commit 563434b

Please sign in to comment.