');
});
-it('imports plugin with files in root directory', function (): void {
+it('imports plugin with files in root directory', function () {
$user = User::factory()->create();
$zipContent = createMockZipFile([
@@ -73,17 +73,17 @@ it('imports plugin with files in root directory', function (): void {
->and($plugin->name)->toBe('Test Plugin');
});
-it('throws exception for invalid zip file', function (): void {
+it('throws exception for invalid zip file', function () {
$user = User::factory()->create();
$zipFile = UploadedFile::fake()->createWithContent('invalid.zip', 'not a zip file');
$pluginImportService = new PluginImportService();
- expect(fn (): Plugin => $pluginImportService->importFromZip($zipFile, $user))
+ expect(fn () => $pluginImportService->importFromZip($zipFile, $user))
->toThrow(Exception::class, 'Could not open the ZIP file.');
});
-it('throws exception for missing required files', function (): void {
+it('throws exception for missing required files', function () {
$user = User::factory()->create();
$zipContent = createMockZipFile([
@@ -94,11 +94,11 @@ it('throws exception for missing required files', function (): void {
$zipFile = UploadedFile::fake()->createWithContent('test-plugin.zip', $zipContent);
$pluginImportService = new PluginImportService();
- expect(fn (): Plugin => $pluginImportService->importFromZip($zipFile, $user))
+ expect(fn () => $pluginImportService->importFromZip($zipFile, $user))
->toThrow(Exception::class, 'Invalid ZIP structure. Required files settings.yml and full.liquid are missing.');
});
-it('sets default values when settings are missing', function (): void {
+it('sets default values when settings are missing', function () {
$user = User::factory()->create();
$zipContent = createMockZipFile([
@@ -117,7 +117,7 @@ it('sets default values when settings are missing', function (): void {
->and($plugin->polling_verb)->toBe('get'); // default value
});
-it('handles blade markup language correctly', function (): void {
+it('handles blade markup language correctly', function () {
$user = User::factory()->create();
$zipContent = createMockZipFile([
@@ -133,7 +133,7 @@ it('handles blade markup language correctly', function (): void {
expect($plugin->markup_language)->toBe('blade');
});
-it('imports plugin from monorepo with zip_entry_path parameter', function (): void {
+it('imports plugin from monorepo with zip_entry_path parameter', function () {
$user = User::factory()->create();
// Create a mock ZIP file with plugin in a subdirectory
@@ -152,7 +152,7 @@ it('imports plugin from monorepo with zip_entry_path parameter', function (): vo
->and($plugin->name)->toBe('Test Plugin');
});
-it('imports plugin from monorepo with src subdirectory', function (): void {
+it('imports plugin from monorepo with src subdirectory', function () {
$user = User::factory()->create();
// Create a mock ZIP file with plugin in a subdirectory with src folder
@@ -171,7 +171,7 @@ it('imports plugin from monorepo with src subdirectory', function (): void {
->and($plugin->name)->toBe('Test Plugin');
});
-it('imports plugin from monorepo with shared.liquid in subdirectory', function (): void {
+it('imports plugin from monorepo with shared.liquid in subdirectory', function () {
$user = User::factory()->create();
$zipContent = createMockZipFile([
@@ -189,7 +189,7 @@ it('imports plugin from monorepo with shared.liquid in subdirectory', function (
->and($plugin->render_markup)->toContain('
');
});
-it('imports plugin from URL with zip_entry_path parameter', function (): void {
+it('imports plugin from URL with zip_entry_path parameter', function () {
$user = User::factory()->create();
// Create a mock ZIP file with plugin in a subdirectory
@@ -214,10 +214,12 @@ it('imports plugin from URL with zip_entry_path parameter', function (): void {
->and($plugin->user_id)->toBe($user->id)
->and($plugin->name)->toBe('Test Plugin');
- Http::assertSent(fn ($request): bool => $request->url() === 'https://github.com/example/repo/archive/refs/heads/main.zip');
+ Http::assertSent(function ($request) {
+ return $request->url() === 'https://github.com/example/repo/archive/refs/heads/main.zip';
+ });
});
-it('imports plugin from URL with zip_entry_path and src subdirectory', function (): void {
+it('imports plugin from URL with zip_entry_path and src subdirectory', function () {
$user = User::factory()->create();
// Create a mock ZIP file with plugin in a subdirectory with src folder
@@ -243,7 +245,7 @@ it('imports plugin from URL with zip_entry_path and src subdirectory', function
->and($plugin->name)->toBe('Test Plugin');
});
-it('imports plugin from GitHub monorepo with repository-named directory', function (): void {
+it('imports plugin from GitHub monorepo with repository-named directory', function () {
$user = User::factory()->create();
// Create a mock ZIP file that simulates GitHub's ZIP structure with repository-named directory
@@ -271,7 +273,7 @@ it('imports plugin from GitHub monorepo with repository-named directory', functi
->and($plugin->name)->toBe('Test Plugin'); // Should be from example-plugin, not other-plugin
});
-it('finds required files in simple ZIP structure', function (): void {
+it('finds required files in simple ZIP structure', function () {
$user = User::factory()->create();
// Create a simple ZIP file with just one plugin
@@ -290,7 +292,7 @@ it('finds required files in simple ZIP structure', function (): void {
->and($plugin->name)->toBe('Test Plugin');
});
-it('finds required files in GitHub monorepo structure with zip_entry_path', function (): void {
+it('finds required files in GitHub monorepo structure with zip_entry_path', function () {
$user = User::factory()->create();
// Create a mock ZIP file that simulates GitHub's ZIP structure
@@ -311,7 +313,7 @@ it('finds required files in GitHub monorepo structure with zip_entry_path', func
->and($plugin->name)->toBe('Test Plugin'); // Should be from example-plugin, not other-plugin
});
-it('imports specific plugin from monorepo zip with zip_entry_path parameter', function (): void {
+it('imports specific plugin from monorepo zip with zip_entry_path parameter', function () {
$user = User::factory()->create();
// Create a mock ZIP file with 2 plugins in a monorepo structure
diff --git a/tests/Feature/PluginInlineTemplatesTest.php b/tests/Feature/PluginInlineTemplatesTest.php
index 76b29d7..fb35344 100644
--- a/tests/Feature/PluginInlineTemplatesTest.php
+++ b/tests/Feature/PluginInlineTemplatesTest.php
@@ -5,7 +5,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
-test('renders plugin with inline templates', function (): void {
+test('renders plugin with inline templates', function () {
$plugin = Plugin::factory()->create([
'name' => 'Test Plugin',
'markup_language' => 'liquid',
@@ -61,16 +61,16 @@ LIQUID
// Should render both templates
// Check for any of the facts (since random number generation is non-deterministic)
$this->assertTrue(
- str_contains((string) $result, 'Fact 1') ||
- str_contains((string) $result, 'Fact 2') ||
- str_contains((string) $result, 'Fact 3')
+ str_contains($result, 'Fact 1') ||
+ str_contains($result, 'Fact 2') ||
+ str_contains($result, 'Fact 3')
);
$this->assertStringContainsString('Test Plugin', $result);
$this->assertStringContainsString('Please try to enjoy each fact equally', $result);
$this->assertStringContainsString('class="view view--full"', $result);
});
-test('renders plugin with inline templates using with syntax', function (): void {
+test('renders plugin with inline templates using with syntax', function () {
$plugin = Plugin::factory()->create([
'name' => 'Test Plugin',
'markup_language' => 'liquid',
@@ -127,16 +127,16 @@ LIQUID
// Should render both templates
// Check for any of the facts (since random number generation is non-deterministic)
$this->assertTrue(
- str_contains((string) $result, 'Fact 1') ||
- str_contains((string) $result, 'Fact 2') ||
- str_contains((string) $result, 'Fact 3')
+ str_contains($result, 'Fact 1') ||
+ str_contains($result, 'Fact 2') ||
+ str_contains($result, 'Fact 3')
);
$this->assertStringContainsString('Test Plugin', $result);
$this->assertStringContainsString('Please try to enjoy each fact equally', $result);
$this->assertStringContainsString('class="view view--full"', $result);
});
-test('renders plugin with simple inline template', function (): void {
+test('renders plugin with simple inline template', function () {
$plugin = Plugin::factory()->create([
'markup_language' => 'liquid',
'render_markup' => <<<'LIQUID'
@@ -162,7 +162,7 @@ LIQUID
$this->assertStringContainsString('class="simple"', $result);
});
-test('renders plugin with liquid filter find_by', function (): void {
+test('renders plugin with liquid filter find_by', function () {
$plugin = Plugin::factory()->create([
'markup_language' => 'liquid',
'render_markup' => <<<'LIQUID'
@@ -194,7 +194,7 @@ LIQUID
$this->assertStringContainsString('class="user"', $result);
});
-test('renders plugin with liquid filter find_by and fallback', function (): void {
+test('renders plugin with liquid filter find_by and fallback', function () {
$plugin = Plugin::factory()->create([
'markup_language' => 'liquid',
'render_markup' => <<<'LIQUID'
@@ -216,7 +216,7 @@ LIQUID
$this->assertStringContainsString('Not Found', $result);
});
-test('renders plugin with liquid filter group_by', function (): void {
+test('renders plugin with liquid filter group_by', function () {
$plugin = Plugin::factory()->create([
'markup_language' => 'liquid',
'render_markup' => <<<'LIQUID'
diff --git a/tests/Feature/PluginLiquidFilterTest.php b/tests/Feature/PluginLiquidFilterTest.php
index bc0fc18..fb429ae 100644
--- a/tests/Feature/PluginLiquidFilterTest.php
+++ b/tests/Feature/PluginLiquidFilterTest.php
@@ -14,7 +14,7 @@ use Keepsuit\Liquid\Environment;
* to:
* {% assign _temp_xxx = collection | filter: "key", "value" %}{% for item in _temp_xxx %}
*/
-test('where filter works when assigned to variable first', function (): void {
+test('where filter works when assigned to variable first', function () {
$plugin = Plugin::factory()->create([
'markup_language' => 'liquid',
'render_markup' => <<<'LIQUID'
@@ -42,7 +42,7 @@ LIQUID
$this->assertStringNotContainsString('"type":"L"', $result);
});
-test('where filter works directly in for loop with preprocessing', function (): void {
+test('where filter works directly in for loop with preprocessing', function () {
$plugin = Plugin::factory()->create([
'markup_language' => 'liquid',
'render_markup' => <<<'LIQUID'
@@ -68,7 +68,7 @@ LIQUID
$this->assertStringNotContainsString('"type":"L"', $result);
});
-test('where filter works directly in for loop with multiple matches', function (): void {
+test('where filter works directly in for loop with multiple matches', function () {
$plugin = Plugin::factory()->create([
'markup_language' => 'liquid',
'render_markup' => <<<'LIQUID'
@@ -95,7 +95,7 @@ LIQUID
$this->assertStringNotContainsString('"type":"L"', $result);
});
-it('encodes arrays for url_encode as JSON with spaces after commas and then percent-encodes', function (): void {
+it('encodes arrays for url_encode as JSON with spaces after commas and then percent-encodes', function () {
/** @var Environment $env */
$env = app('liquid.environment');
$env->filterRegistry->register(StandardFilters::class);
@@ -109,7 +109,7 @@ it('encodes arrays for url_encode as JSON with spaces after commas and then perc
expect($output)->toBe('%5B%22common%22%2C%22obscure%22%5D');
});
-it('keeps scalar url_encode behavior intact', function (): void {
+it('keeps scalar url_encode behavior intact', function () {
/** @var Environment $env */
$env = app('liquid.environment');
$env->filterRegistry->register(StandardFilters::class);
diff --git a/tests/Feature/PluginRequiredConfigurationTest.php b/tests/Feature/PluginRequiredConfigurationTest.php
index 83be449..552b996 100644
--- a/tests/Feature/PluginRequiredConfigurationTest.php
+++ b/tests/Feature/PluginRequiredConfigurationTest.php
@@ -6,7 +6,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
-test('hasMissingRequiredConfigurationFields returns true when required field is null', function (): void {
+test('hasMissingRequiredConfigurationFields returns true when required field is null', function () {
$user = User::factory()->create();
$configurationTemplate = [
@@ -39,7 +39,7 @@ test('hasMissingRequiredConfigurationFields returns true when required field is
expect($plugin->hasMissingRequiredConfigurationFields())->toBeTrue();
});
-test('hasMissingRequiredConfigurationFields returns false when all required fields are set', function (): void {
+test('hasMissingRequiredConfigurationFields returns false when all required fields are set', function () {
$user = User::factory()->create();
$configurationTemplate = [
@@ -73,7 +73,7 @@ test('hasMissingRequiredConfigurationFields returns false when all required fiel
expect($plugin->hasMissingRequiredConfigurationFields())->toBeFalse();
});
-test('hasMissingRequiredConfigurationFields returns false when no custom fields exist', function (): void {
+test('hasMissingRequiredConfigurationFields returns false when no custom fields exist', function () {
$user = User::factory()->create();
$plugin = Plugin::factory()->create([
@@ -85,7 +85,7 @@ test('hasMissingRequiredConfigurationFields returns false when no custom fields
expect($plugin->hasMissingRequiredConfigurationFields())->toBeFalse();
});
-test('hasMissingRequiredConfigurationFields returns true when explicitly required field is null', function (): void {
+test('hasMissingRequiredConfigurationFields returns true when explicitly required field is null', function () {
$user = User::factory()->create();
$configurationTemplate = [
@@ -111,7 +111,7 @@ test('hasMissingRequiredConfigurationFields returns true when explicitly require
expect($plugin->hasMissingRequiredConfigurationFields())->toBeTrue();
});
-test('hasMissingRequiredConfigurationFields returns true when required field is empty string', function (): void {
+test('hasMissingRequiredConfigurationFields returns true when required field is empty string', function () {
$user = User::factory()->create();
$configurationTemplate = [
@@ -137,7 +137,7 @@ test('hasMissingRequiredConfigurationFields returns true when required field is
expect($plugin->hasMissingRequiredConfigurationFields())->toBeTrue();
});
-test('hasMissingRequiredConfigurationFields returns true when required array field is empty', function (): void {
+test('hasMissingRequiredConfigurationFields returns true when required array field is empty', function () {
$user = User::factory()->create();
$configurationTemplate = [
@@ -164,7 +164,7 @@ test('hasMissingRequiredConfigurationFields returns true when required array fie
expect($plugin->hasMissingRequiredConfigurationFields())->toBeTrue();
});
-test('hasMissingRequiredConfigurationFields returns false when author_bio field is present but other required field is set', function (): void {
+test('hasMissingRequiredConfigurationFields returns false when author_bio field is present but other required field is set', function () {
$user = User::factory()->create();
$configurationTemplate = [
@@ -193,7 +193,7 @@ test('hasMissingRequiredConfigurationFields returns false when author_bio field
expect($plugin->hasMissingRequiredConfigurationFields())->toBeFalse();
});
-test('hasMissingRequiredConfigurationFields returns false when field has default value', function (): void {
+test('hasMissingRequiredConfigurationFields returns false when field has default value', function () {
$user = User::factory()->create();
$configurationTemplate = [
@@ -217,7 +217,7 @@ test('hasMissingRequiredConfigurationFields returns false when field has default
expect($plugin->hasMissingRequiredConfigurationFields())->toBeFalse();
});
-test('hasMissingRequiredConfigurationFields returns true when required xhrSelect field is missing', function (): void {
+test('hasMissingRequiredConfigurationFields returns true when required xhrSelect field is missing', function () {
$user = User::factory()->create();
$configurationTemplate = [
@@ -242,7 +242,7 @@ test('hasMissingRequiredConfigurationFields returns true when required xhrSelect
expect($plugin->hasMissingRequiredConfigurationFields())->toBeTrue();
});
-test('hasMissingRequiredConfigurationFields returns false when required xhrSelect field is set', function (): void {
+test('hasMissingRequiredConfigurationFields returns false when required xhrSelect field is set', function () {
$user = User::factory()->create();
$configurationTemplate = [
diff --git a/tests/Feature/PluginWebhookTest.php b/tests/Feature/PluginWebhookTest.php
index 22d1d54..70fa53a 100644
--- a/tests/Feature/PluginWebhookTest.php
+++ b/tests/Feature/PluginWebhookTest.php
@@ -3,7 +3,7 @@
use App\Models\Plugin;
use Illuminate\Support\Str;
-test('webhook updates plugin data for webhook strategy', function (): void {
+test('webhook updates plugin data for webhook strategy', function () {
// Create a plugin with webhook strategy
$plugin = Plugin::factory()->create([
'data_strategy' => 'webhook',
@@ -26,7 +26,7 @@ test('webhook updates plugin data for webhook strategy', function (): void {
]);
});
-test('webhook returns 400 for non-webhook strategy plugins', function (): void {
+test('webhook returns 400 for non-webhook strategy plugins', function () {
// Create a plugin with non-webhook strategy
$plugin = Plugin::factory()->create([
'data_strategy' => 'polling',
@@ -43,7 +43,7 @@ test('webhook returns 400 for non-webhook strategy plugins', function (): void {
->assertJson(['error' => 'Plugin does not use webhook strategy']);
});
-test('webhook returns 400 when merge_variables is missing', function (): void {
+test('webhook returns 400 when merge_variables is missing', function () {
// Create a plugin with webhook strategy
$plugin = Plugin::factory()->create([
'data_strategy' => 'webhook',
@@ -58,7 +58,7 @@ test('webhook returns 400 when merge_variables is missing', function (): void {
->assertJson(['error' => 'Request must contain merge_variables key']);
});
-test('webhook returns 404 for non-existent plugin', function (): void {
+test('webhook returns 404 for non-existent plugin', function () {
// Make request with non-existent plugin UUID
$response = $this->postJson('/api/custom_plugins/'.Str::uuid(), [
'merge_variables' => ['new' => 'data'],
diff --git a/tests/Feature/Settings/PasswordUpdateTest.php b/tests/Feature/Settings/PasswordUpdateTest.php
index 0e33955..3252860 100644
--- a/tests/Feature/Settings/PasswordUpdateTest.php
+++ b/tests/Feature/Settings/PasswordUpdateTest.php
@@ -6,7 +6,7 @@ use Livewire\Volt\Volt;
uses(Illuminate\Foundation\Testing\RefreshDatabase::class);
-test('password can be updated', function (): void {
+test('password can be updated', function () {
$user = User::factory()->create([
'password' => Hash::make('password'),
]);
@@ -24,7 +24,7 @@ test('password can be updated', function (): void {
expect(Hash::check('new-password', $user->refresh()->password))->toBeTrue();
});
-test('correct password must be provided to update password', function (): void {
+test('correct password must be provided to update password', function () {
$user = User::factory()->create([
'password' => Hash::make('password'),
]);
diff --git a/tests/Feature/Settings/ProfileUpdateTest.php b/tests/Feature/Settings/ProfileUpdateTest.php
index cbf424c..48ea114 100644
--- a/tests/Feature/Settings/ProfileUpdateTest.php
+++ b/tests/Feature/Settings/ProfileUpdateTest.php
@@ -5,13 +5,13 @@ use Livewire\Volt\Volt;
uses(Illuminate\Foundation\Testing\RefreshDatabase::class);
-test('profile page is displayed', function (): void {
+test('profile page is displayed', function () {
$this->actingAs($user = User::factory()->create());
$this->get('/settings/profile')->assertOk();
});
-test('profile information can be updated', function (): void {
+test('profile information can be updated', function () {
$user = User::factory()->create();
$this->actingAs($user);
@@ -30,7 +30,7 @@ test('profile information can be updated', function (): void {
expect($user->email_verified_at)->toBeNull();
});
-test('email verification status is unchanged when email address is unchanged', function (): void {
+test('email verification status is unchanged when email address is unchanged', function () {
$user = User::factory()->create();
$this->actingAs($user);
@@ -45,7 +45,7 @@ test('email verification status is unchanged when email address is unchanged', f
expect($user->refresh()->email_verified_at)->not->toBeNull();
});
-test('user can delete their account', function (): void {
+test('user can delete their account', function () {
$user = User::factory()->create();
$this->actingAs($user);
@@ -62,7 +62,7 @@ test('user can delete their account', function (): void {
expect(auth()->check())->toBeFalse();
});
-test('correct password must be provided to delete account', function (): void {
+test('correct password must be provided to delete account', function () {
$user = User::factory()->create();
$this->actingAs($user);
diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php
index 963bc0c..44a4f33 100644
--- a/tests/Unit/ExampleTest.php
+++ b/tests/Unit/ExampleTest.php
@@ -1,5 +1,5 @@
toBeTrue();
});
diff --git a/tests/Unit/Liquid/Filters/DataTest.php b/tests/Unit/Liquid/Filters/DataTest.php
index abd4114..bdf649f 100644
--- a/tests/Unit/Liquid/Filters/DataTest.php
+++ b/tests/Unit/Liquid/Filters/DataTest.php
@@ -2,14 +2,14 @@
use App\Liquid\Filters\Data;
-test('json filter converts arrays to JSON', function (): void {
+test('json filter converts arrays to JSON', function () {
$filter = new Data();
$array = ['foo' => 'bar', 'baz' => 'qux'];
expect($filter->json($array))->toBe('{"foo":"bar","baz":"qux"}');
});
-test('json filter converts objects to JSON', function (): void {
+test('json filter converts objects to JSON', function () {
$filter = new Data();
$object = new stdClass();
$object->foo = 'bar';
@@ -18,7 +18,7 @@ test('json filter converts objects to JSON', function (): void {
expect($filter->json($object))->toBe('{"foo":"bar","baz":"qux"}');
});
-test('json filter handles nested structures', function (): void {
+test('json filter handles nested structures', function () {
$filter = new Data();
$nested = [
'foo' => 'bar',
@@ -31,7 +31,7 @@ test('json filter handles nested structures', function (): void {
expect($filter->json($nested))->toBe('{"foo":"bar","nested":{"baz":"qux","items":[1,2,3]}}');
});
-test('json filter handles scalar values', function (): void {
+test('json filter handles scalar values', function () {
$filter = new Data();
expect($filter->json('string'))->toBe('"string"');
@@ -40,21 +40,21 @@ test('json filter handles scalar values', function (): void {
expect($filter->json(null))->toBe('null');
});
-test('json filter preserves unicode characters', function (): void {
+test('json filter preserves unicode characters', function () {
$filter = new Data();
$data = ['message' => 'Hello, 世界'];
expect($filter->json($data))->toBe('{"message":"Hello, 世界"}');
});
-test('json filter does not escape slashes', function (): void {
+test('json filter does not escape slashes', function () {
$filter = new Data();
$data = ['url' => 'https://example.com/path'];
expect($filter->json($data))->toBe('{"url":"https://example.com/path"}');
});
-test('find_by filter finds object by key-value pair', function (): void {
+test('find_by filter finds object by key-value pair', function () {
$filter = new Data();
$collection = [
['name' => 'Ryan', 'age' => 35],
@@ -66,7 +66,7 @@ test('find_by filter finds object by key-value pair', function (): void {
expect($result)->toBe(['name' => 'Ryan', 'age' => 35]);
});
-test('find_by filter returns null when no match found', function (): void {
+test('find_by filter returns null when no match found', function () {
$filter = new Data();
$collection = [
['name' => 'Ryan', 'age' => 35],
@@ -78,7 +78,7 @@ test('find_by filter returns null when no match found', function (): void {
expect($result)->toBeNull();
});
-test('find_by filter returns fallback when no match found', function (): void {
+test('find_by filter returns fallback when no match found', function () {
$filter = new Data();
$collection = [
['name' => 'Ryan', 'age' => 35],
@@ -90,7 +90,7 @@ test('find_by filter returns fallback when no match found', function (): void {
expect($result)->toBe('Not Found');
});
-test('find_by filter finds by age', function (): void {
+test('find_by filter finds by age', function () {
$filter = new Data();
$collection = [
['name' => 'Ryan', 'age' => 35],
@@ -102,7 +102,7 @@ test('find_by filter finds by age', function (): void {
expect($result)->toBe(['name' => 'Sara', 'age' => 29]);
});
-test('find_by filter handles empty collection', function (): void {
+test('find_by filter handles empty collection', function () {
$filter = new Data();
$collection = [];
@@ -110,7 +110,7 @@ test('find_by filter handles empty collection', function (): void {
expect($result)->toBeNull();
});
-test('find_by filter handles collection with non-array items', function (): void {
+test('find_by filter handles collection with non-array items', function () {
$filter = new Data();
$collection = [
'not an array',
@@ -122,7 +122,7 @@ test('find_by filter handles collection with non-array items', function (): void
expect($result)->toBe(['name' => 'Ryan', 'age' => 35]);
});
-test('find_by filter handles items without the specified key', function (): void {
+test('find_by filter handles items without the specified key', function () {
$filter = new Data();
$collection = [
['age' => 35],
@@ -134,7 +134,7 @@ test('find_by filter handles items without the specified key', function (): void
expect($result)->toBe(['name' => 'Ryan', 'age' => 35]);
});
-test('group_by filter groups collection by age', function (): void {
+test('group_by filter groups collection by age', function () {
$filter = new Data();
$collection = [
['name' => 'Ryan', 'age' => 35],
@@ -153,7 +153,7 @@ test('group_by filter groups collection by age', function (): void {
]);
});
-test('group_by filter groups collection by name', function (): void {
+test('group_by filter groups collection by name', function () {
$filter = new Data();
$collection = [
['name' => 'Ryan', 'age' => 35],
@@ -172,7 +172,7 @@ test('group_by filter groups collection by name', function (): void {
]);
});
-test('group_by filter handles empty collection', function (): void {
+test('group_by filter handles empty collection', function () {
$filter = new Data();
$collection = [];
@@ -180,7 +180,7 @@ test('group_by filter handles empty collection', function (): void {
expect($result)->toBe([]);
});
-test('group_by filter handles collection with non-array items', function (): void {
+test('group_by filter handles collection with non-array items', function () {
$filter = new Data();
$collection = [
'not an array',
@@ -197,7 +197,7 @@ test('group_by filter handles collection with non-array items', function (): voi
]);
});
-test('group_by filter handles items without the specified key', function (): void {
+test('group_by filter handles items without the specified key', function () {
$filter = new Data();
$collection = [
['age' => 35],
@@ -217,7 +217,7 @@ test('group_by filter handles items without the specified key', function (): voi
]);
});
-test('group_by filter handles mixed data types as keys', function (): void {
+test('group_by filter handles mixed data types as keys', function () {
$filter = new Data();
$collection = [
['name' => 'Ryan', 'active' => true],
@@ -238,7 +238,7 @@ test('group_by filter handles mixed data types as keys', function (): void {
]);
});
-test('sample filter returns a random element from array', function (): void {
+test('sample filter returns a random element from array', function () {
$filter = new Data();
$array = ['1', '2', '3', '4', '5'];
@@ -246,7 +246,7 @@ test('sample filter returns a random element from array', function (): void {
expect($result)->toBeIn($array);
});
-test('sample filter returns a random element from string array', function (): void {
+test('sample filter returns a random element from string array', function () {
$filter = new Data();
$array = ['cat', 'dog'];
@@ -254,7 +254,7 @@ test('sample filter returns a random element from string array', function (): vo
expect($result)->toBeIn($array);
});
-test('sample filter returns null for empty array', function (): void {
+test('sample filter returns null for empty array', function () {
$filter = new Data();
$array = [];
@@ -262,7 +262,7 @@ test('sample filter returns null for empty array', function (): void {
expect($result)->toBeNull();
});
-test('sample filter returns the only element from single element array', function (): void {
+test('sample filter returns the only element from single element array', function () {
$filter = new Data();
$array = ['single'];
@@ -270,7 +270,7 @@ test('sample filter returns the only element from single element array', functio
expect($result)->toBe('single');
});
-test('sample filter works with mixed data types', function (): void {
+test('sample filter works with mixed data types', function () {
$filter = new Data();
$array = [1, 'string', true, null, ['nested']];
@@ -278,7 +278,7 @@ test('sample filter works with mixed data types', function (): void {
expect($result)->toBeIn($array);
});
-test('parse_json filter parses JSON string to array', function (): void {
+test('parse_json filter parses JSON string to array', function () {
$filter = new Data();
$jsonString = '[{"a":1,"b":"c"},"d"]';
@@ -286,7 +286,7 @@ test('parse_json filter parses JSON string to array', function (): void {
expect($result)->toBe([['a' => 1, 'b' => 'c'], 'd']);
});
-test('parse_json filter parses simple JSON object', function (): void {
+test('parse_json filter parses simple JSON object', function () {
$filter = new Data();
$jsonString = '{"name":"John","age":30,"city":"New York"}';
@@ -294,7 +294,7 @@ test('parse_json filter parses simple JSON object', function (): void {
expect($result)->toBe(['name' => 'John', 'age' => 30, 'city' => 'New York']);
});
-test('parse_json filter parses JSON array', function (): void {
+test('parse_json filter parses JSON array', function () {
$filter = new Data();
$jsonString = '["apple","banana","cherry"]';
@@ -302,7 +302,7 @@ test('parse_json filter parses JSON array', function (): void {
expect($result)->toBe(['apple', 'banana', 'cherry']);
});
-test('parse_json filter parses nested JSON structure', function (): void {
+test('parse_json filter parses nested JSON structure', function () {
$filter = new Data();
$jsonString = '{"users":[{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}],"total":2}';
@@ -316,7 +316,7 @@ test('parse_json filter parses nested JSON structure', function (): void {
]);
});
-test('parse_json filter handles primitive values', function (): void {
+test('parse_json filter handles primitive values', function () {
$filter = new Data();
expect($filter->parse_json('"hello"'))->toBe('hello');
diff --git a/tests/Unit/Liquid/Filters/DateTest.php b/tests/Unit/Liquid/Filters/DateTest.php
index d967951..5813e10 100644
--- a/tests/Unit/Liquid/Filters/DateTest.php
+++ b/tests/Unit/Liquid/Filters/DateTest.php
@@ -3,28 +3,28 @@
use App\Liquid\Filters\Date;
use Carbon\Carbon;
-test('days_ago filter returns correct date', function (): void {
+test('days_ago filter returns correct date', function () {
$filter = new Date();
$threeDaysAgo = Carbon::now()->subDays(3)->toDateString();
expect($filter->days_ago(3))->toBe($threeDaysAgo);
});
-test('days_ago filter handles string input', function (): void {
+test('days_ago filter handles string input', function () {
$filter = new Date();
$fiveDaysAgo = Carbon::now()->subDays(5)->toDateString();
expect($filter->days_ago('5'))->toBe($fiveDaysAgo);
});
-test('days_ago filter with zero days returns today', function (): void {
+test('days_ago filter with zero days returns today', function () {
$filter = new Date();
$today = Carbon::now()->toDateString();
expect($filter->days_ago(0))->toBe($today);
});
-test('days_ago filter with large number works correctly', function (): void {
+test('days_ago filter with large number works correctly', function () {
$filter = new Date();
$hundredDaysAgo = Carbon::now()->subDays(100)->toDateString();
diff --git a/tests/Unit/Liquid/Filters/LocalizationTest.php b/tests/Unit/Liquid/Filters/LocalizationTest.php
index a52623f..2ba3dd2 100644
--- a/tests/Unit/Liquid/Filters/LocalizationTest.php
+++ b/tests/Unit/Liquid/Filters/LocalizationTest.php
@@ -2,7 +2,7 @@
use App\Liquid\Filters\Localization;
-test('l_date formats date with default format', function (): void {
+test('l_date formats date with default format', function () {
$filter = new Localization();
$date = '2025-01-11';
@@ -15,7 +15,7 @@ test('l_date formats date with default format', function (): void {
expect($result)->toContain('11');
});
-test('l_date formats date with custom format', function (): void {
+test('l_date formats date with custom format', function () {
$filter = new Localization();
$date = '2025-01-11';
@@ -27,7 +27,7 @@ test('l_date formats date with custom format', function (): void {
// We can't check for 'Jan' specifically as it might be localized
});
-test('l_date handles DateTime objects', function (): void {
+test('l_date handles DateTime objects', function () {
$filter = new Localization();
$date = new DateTimeImmutable('2025-01-11');
@@ -36,32 +36,32 @@ test('l_date handles DateTime objects', function (): void {
expect($result)->toContain('2025-01-11');
});
-test('l_word translates common words', function (): void {
+test('l_word translates common words', function () {
$filter = new Localization();
expect($filter->l_word('today', 'de'))->toBe('heute');
});
-test('l_word returns original word if no translation exists', function (): void {
+test('l_word returns original word if no translation exists', function () {
$filter = new Localization();
expect($filter->l_word('hello', 'es-ES'))->toBe('hello');
expect($filter->l_word('world', 'ko'))->toBe('world');
});
-test('l_word is case-insensitive', function (): void {
+test('l_word is case-insensitive', function () {
$filter = new Localization();
expect($filter->l_word('TODAY', 'de'))->toBe('heute');
});
-test('l_word returns original word for unknown locales', function (): void {
+test('l_word returns original word for unknown locales', function () {
$filter = new Localization();
expect($filter->l_word('today', 'unknown-locale'))->toBe('today');
});
-test('l_date handles locale parameter', function (): void {
+test('l_date handles locale parameter', function () {
$filter = new Localization();
$date = '2025-01-11';
@@ -73,7 +73,7 @@ test('l_date handles locale parameter', function (): void {
expect($result)->toContain('11');
});
-test('l_date handles null locale parameter', function (): void {
+test('l_date handles null locale parameter', function () {
$filter = new Localization();
$date = '2025-01-11';
@@ -85,7 +85,7 @@ test('l_date handles null locale parameter', function (): void {
expect($result)->toContain('11');
});
-test('l_date handles different date formats with locale', function (): void {
+test('l_date handles different date formats with locale', function () {
$filter = new Localization();
$date = '2025-01-11';
@@ -96,7 +96,7 @@ test('l_date handles different date formats with locale', function (): void {
expect($result)->toContain('11');
});
-test('l_date handles DateTimeInterface objects with locale', function (): void {
+test('l_date handles DateTimeInterface objects with locale', function () {
$filter = new Localization();
$date = new DateTimeImmutable('2025-01-11');
@@ -108,29 +108,29 @@ test('l_date handles DateTimeInterface objects with locale', function (): void {
expect($result)->toContain('11');
});
-test('l_date handles invalid date gracefully', function (): void {
+test('l_date handles invalid date gracefully', function () {
$filter = new Localization();
$invalidDate = 'invalid-date';
// This should throw an exception or return a default value
// The exact behavior depends on Carbon's implementation
- expect(fn (): string => $filter->l_date($invalidDate))->toThrow(Exception::class);
+ expect(fn () => $filter->l_date($invalidDate))->toThrow(Exception::class);
});
-test('l_word handles empty string', function (): void {
+test('l_word handles empty string', function () {
$filter = new Localization();
expect($filter->l_word('', 'de'))->toBe('');
});
-test('l_word handles special characters', function (): void {
+test('l_word handles special characters', function () {
$filter = new Localization();
// Test with a word that has special characters
expect($filter->l_word('café', 'de'))->toBe('café');
});
-test('l_word handles numeric strings', function (): void {
+test('l_word handles numeric strings', function () {
$filter = new Localization();
expect($filter->l_word('123', 'de'))->toBe('123');
diff --git a/tests/Unit/Liquid/Filters/NumbersTest.php b/tests/Unit/Liquid/Filters/NumbersTest.php
index 42deffb..7ce736a 100644
--- a/tests/Unit/Liquid/Filters/NumbersTest.php
+++ b/tests/Unit/Liquid/Filters/NumbersTest.php
@@ -2,7 +2,7 @@
use App\Liquid\Filters\Numbers;
-test('number_with_delimiter formats numbers with commas by default', function (): void {
+test('number_with_delimiter formats numbers with commas by default', function () {
$filter = new Numbers();
expect($filter->number_with_delimiter(1234))->toBe('1,234');
@@ -10,21 +10,21 @@ test('number_with_delimiter formats numbers with commas by default', function ()
expect($filter->number_with_delimiter(0))->toBe('0');
});
-test('number_with_delimiter handles custom delimiters', function (): void {
+test('number_with_delimiter handles custom delimiters', function () {
$filter = new Numbers();
expect($filter->number_with_delimiter(1234, '.'))->toBe('1.234');
expect($filter->number_with_delimiter(1000000, ' '))->toBe('1 000 000');
});
-test('number_with_delimiter handles decimal values with custom separators', function (): void {
+test('number_with_delimiter handles decimal values with custom separators', function () {
$filter = new Numbers();
expect($filter->number_with_delimiter(1234.57, ' ', ','))->toBe('1 234,57');
expect($filter->number_with_delimiter(1234.5, '.', ','))->toBe('1.234,50');
});
-test('number_to_currency formats numbers with dollar sign by default', function (): void {
+test('number_to_currency formats numbers with dollar sign by default', function () {
$filter = new Numbers();
expect($filter->number_to_currency(1234))->toBe('$1,234');
@@ -32,14 +32,14 @@ test('number_to_currency formats numbers with dollar sign by default', function
expect($filter->number_to_currency(0))->toBe('$0');
});
-test('number_to_currency handles custom currency symbols', function (): void {
+test('number_to_currency handles custom currency symbols', function () {
$filter = new Numbers();
expect($filter->number_to_currency(1234, '£'))->toBe('£1,234');
expect($filter->number_to_currency(152350.69, '€'))->toBe('€152,350.69');
});
-test('number_to_currency handles custom delimiters and separators', function (): void {
+test('number_to_currency handles custom delimiters and separators', function () {
$filter = new Numbers();
$result1 = $filter->number_to_currency(1234.57, '£', '.', ',');
@@ -51,56 +51,56 @@ test('number_to_currency handles custom delimiters and separators', function ():
expect($result2)->toContain('€');
});
-test('number_with_delimiter handles string numbers', function (): void {
+test('number_with_delimiter handles string numbers', function () {
$filter = new Numbers();
expect($filter->number_with_delimiter('1234'))->toBe('1,234');
expect($filter->number_with_delimiter('1234.56'))->toBe('1,234.56');
});
-test('number_with_delimiter handles negative numbers', function (): void {
+test('number_with_delimiter handles negative numbers', function () {
$filter = new Numbers();
expect($filter->number_with_delimiter(-1234))->toBe('-1,234');
expect($filter->number_with_delimiter(-1234.56))->toBe('-1,234.56');
});
-test('number_with_delimiter handles zero', function (): void {
+test('number_with_delimiter handles zero', function () {
$filter = new Numbers();
expect($filter->number_with_delimiter(0))->toBe('0');
expect($filter->number_with_delimiter(0.0))->toBe('0.00');
});
-test('number_with_delimiter handles very small numbers', function (): void {
+test('number_with_delimiter handles very small numbers', function () {
$filter = new Numbers();
expect($filter->number_with_delimiter(0.01))->toBe('0.01');
expect($filter->number_with_delimiter(0.001))->toBe('0.00');
});
-test('number_to_currency handles string numbers', function (): void {
+test('number_to_currency handles string numbers', function () {
$filter = new Numbers();
expect($filter->number_to_currency('1234'))->toBe('$1,234');
expect($filter->number_to_currency('1234.56'))->toBe('$1,234.56');
});
-test('number_to_currency handles negative numbers', function (): void {
+test('number_to_currency handles negative numbers', function () {
$filter = new Numbers();
expect($filter->number_to_currency(-1234))->toBe('-$1,234');
expect($filter->number_to_currency(-1234.56))->toBe('-$1,234.56');
});
-test('number_to_currency handles zero', function (): void {
+test('number_to_currency handles zero', function () {
$filter = new Numbers();
expect($filter->number_to_currency(0))->toBe('$0');
expect($filter->number_to_currency(0.0))->toBe('$0.00');
});
-test('number_to_currency handles currency code conversion', function (): void {
+test('number_to_currency handles currency code conversion', function () {
$filter = new Numbers();
expect($filter->number_to_currency(1234, '$'))->toBe('$1,234');
@@ -108,7 +108,7 @@ test('number_to_currency handles currency code conversion', function (): void {
expect($filter->number_to_currency(1234, '£'))->toBe('£1,234');
});
-test('number_to_currency handles German locale formatting', function (): void {
+test('number_to_currency handles German locale formatting', function () {
$filter = new Numbers();
// When delimiter is '.' and separator is ',', it should use German locale
@@ -116,21 +116,21 @@ test('number_to_currency handles German locale formatting', function (): void {
expect($result)->toContain('1.234,56');
});
-test('number_with_delimiter handles different decimal separators', function (): void {
+test('number_with_delimiter handles different decimal separators', function () {
$filter = new Numbers();
expect($filter->number_with_delimiter(1234.56, ',', ','))->toBe('1,234,56');
expect($filter->number_with_delimiter(1234.56, ' ', ','))->toBe('1 234,56');
});
-test('number_to_currency handles very large numbers', function (): void {
+test('number_to_currency handles very large numbers', function () {
$filter = new Numbers();
expect($filter->number_to_currency(1000000))->toBe('$1,000,000');
expect($filter->number_to_currency(1000000.50))->toBe('$1,000,000.50');
});
-test('number_with_delimiter handles very large numbers', function (): void {
+test('number_with_delimiter handles very large numbers', function () {
$filter = new Numbers();
expect($filter->number_with_delimiter(1000000))->toBe('1,000,000');
diff --git a/tests/Unit/Liquid/Filters/StringMarkupTest.php b/tests/Unit/Liquid/Filters/StringMarkupTest.php
index bfd1a07..b3498c3 100644
--- a/tests/Unit/Liquid/Filters/StringMarkupTest.php
+++ b/tests/Unit/Liquid/Filters/StringMarkupTest.php
@@ -2,35 +2,35 @@
use App\Liquid\Filters\StringMarkup;
-test('pluralize returns singular form with count 1', function (): void {
+test('pluralize returns singular form with count 1', function () {
$filter = new StringMarkup();
expect($filter->pluralize('book', 1))->toBe('1 book');
expect($filter->pluralize('person', 1))->toBe('1 person');
});
-test('pluralize returns plural form with count greater than 1', function (): void {
+test('pluralize returns plural form with count greater than 1', function () {
$filter = new StringMarkup();
expect($filter->pluralize('book', 2))->toBe('2 books');
expect($filter->pluralize('person', 4))->toBe('4 people');
});
-test('pluralize handles irregular plurals correctly', function (): void {
+test('pluralize handles irregular plurals correctly', function () {
$filter = new StringMarkup();
expect($filter->pluralize('child', 3))->toBe('3 children');
expect($filter->pluralize('sheep', 5))->toBe('5 sheep');
});
-test('pluralize uses default count of 2 when not specified', function (): void {
+test('pluralize uses default count of 2 when not specified', function () {
$filter = new StringMarkup();
expect($filter->pluralize('book'))->toBe('2 books');
expect($filter->pluralize('person'))->toBe('2 people');
});
-test('markdown_to_html converts basic markdown to HTML', function (): void {
+test('markdown_to_html converts basic markdown to HTML', function () {
$filter = new StringMarkup();
$markdown = 'This is *italic* and **bold**.';
@@ -42,7 +42,7 @@ test('markdown_to_html converts basic markdown to HTML', function (): void {
expect($result)->toContain('
bold');
});
-test('markdown_to_html converts links correctly', function (): void {
+test('markdown_to_html converts links correctly', function () {
$filter = new StringMarkup();
$markdown = 'This is [a link](https://example.com).';
@@ -51,7 +51,7 @@ test('markdown_to_html converts links correctly', function (): void {
expect($result)->toContain('
a link');
});
-test('markdown_to_html handles fallback when Parsedown is not available', function (): void {
+test('markdown_to_html handles fallback when Parsedown is not available', function () {
// Create a mock that simulates Parsedown not being available
$filter = new class extends StringMarkup
{
@@ -68,28 +68,28 @@ test('markdown_to_html handles fallback when Parsedown is not available', functi
expect($result)->toBe('This is *italic* and [a link](https://example.com).');
});
-test('strip_html removes HTML tags', function (): void {
+test('strip_html removes HTML tags', function () {
$filter = new StringMarkup();
$html = '
This is bold and italic.
';
expect($filter->strip_html($html))->toBe('This is bold and italic.');
});
-test('strip_html preserves text content', function (): void {
+test('strip_html preserves text content', function () {
$filter = new StringMarkup();
$html = '
Hello, world!
';
expect($filter->strip_html($html))->toBe('Hello, world!');
});
-test('strip_html handles nested tags', function (): void {
+test('strip_html handles nested tags', function () {
$filter = new StringMarkup();
$html = '
Paragraph with nested tags.
';
expect($filter->strip_html($html))->toBe('Paragraph with nested tags.');
});
-test('markdown_to_html handles CommonMarkException gracefully', function (): void {
+test('markdown_to_html handles CommonMarkException gracefully', function () {
$filter = new StringMarkup();
// Create a mock that throws CommonMarkException
@@ -113,7 +113,7 @@ test('markdown_to_html handles CommonMarkException gracefully', function (): voi
expect($result)->toBeNull();
});
-test('markdown_to_html handles empty string', function (): void {
+test('markdown_to_html handles empty string', function () {
$filter = new StringMarkup();
$result = $filter->markdown_to_html('');
@@ -121,7 +121,7 @@ test('markdown_to_html handles empty string', function (): void {
expect($result)->toBe('');
});
-test('markdown_to_html handles complex markdown', function (): void {
+test('markdown_to_html handles complex markdown', function () {
$filter = new StringMarkup();
$markdown = "# Heading\n\nThis is a paragraph with **bold** and *italic* text.\n\n- List item 1\n- List item 2\n\n[Link](https://example.com)";
@@ -135,34 +135,34 @@ test('markdown_to_html handles complex markdown', function (): void {
expect($result)->toContain('
Link');
});
-test('strip_html handles empty string', function (): void {
+test('strip_html handles empty string', function () {
$filter = new StringMarkup();
expect($filter->strip_html(''))->toBe('');
});
-test('strip_html handles string without HTML tags', function (): void {
+test('strip_html handles string without HTML tags', function () {
$filter = new StringMarkup();
$text = 'This is plain text without any HTML tags.';
expect($filter->strip_html($text))->toBe($text);
});
-test('strip_html handles self-closing tags', function (): void {
+test('strip_html handles self-closing tags', function () {
$filter = new StringMarkup();
$html = '
Text with
line break and
horizontal rule.';
expect($filter->strip_html($html))->toBe('Text with line break and horizontal rule.');
});
-test('pluralize handles zero count', function (): void {
+test('pluralize handles zero count', function () {
$filter = new StringMarkup();
expect($filter->pluralize('book', 0))->toBe('0 books');
expect($filter->pluralize('person', 0))->toBe('0 people');
});
-test('pluralize handles negative count', function (): void {
+test('pluralize handles negative count', function () {
$filter = new StringMarkup();
expect($filter->pluralize('book', -1))->toBe('-1 book');
diff --git a/tests/Unit/Liquid/Filters/UniquenessTest.php b/tests/Unit/Liquid/Filters/UniquenessTest.php
index 76840e1..291f312 100644
--- a/tests/Unit/Liquid/Filters/UniquenessTest.php
+++ b/tests/Unit/Liquid/Filters/UniquenessTest.php
@@ -2,7 +2,7 @@
use App\Liquid\Filters\Uniqueness;
-test('append_random appends a random string with 4 characters', function (): void {
+test('append_random appends a random string with 4 characters', function () {
$filter = new Uniqueness();
$result = $filter->append_random('chart-');
diff --git a/tests/Unit/Models/DeviceLogTest.php b/tests/Unit/Models/DeviceLogTest.php
index f28f4cd..37e128f 100644
--- a/tests/Unit/Models/DeviceLogTest.php
+++ b/tests/Unit/Models/DeviceLogTest.php
@@ -6,7 +6,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
-test('device log belongs to a device', function (): void {
+test('device log belongs to a device', function () {
$device = Device::factory()->create();
$log = DeviceLog::factory()->create(['device_id' => $device->id]);
@@ -14,7 +14,7 @@ test('device log belongs to a device', function (): void {
->and($log->device->id)->toBe($device->id);
});
-test('device log casts log_entry to array', function (): void {
+test('device log casts log_entry to array', function () {
Device::factory()->create();
$log = DeviceLog::factory()->create([
'log_entry' => [
@@ -29,7 +29,7 @@ test('device log casts log_entry to array', function (): void {
->and($log->log_entry['level'])->toBe('info');
});
-test('device log casts device_timestamp to datetime', function (): void {
+test('device log casts device_timestamp to datetime', function () {
Device::factory()->create();
$timestamp = now();
$log = DeviceLog::factory()->create([
@@ -40,7 +40,7 @@ test('device log casts device_timestamp to datetime', function (): void {
->and($log->device_timestamp->timestamp)->toBe($timestamp->timestamp);
});
-test('device log factory creates valid data', function (): void {
+test('device log factory creates valid data', function () {
Device::factory()->create();
$log = DeviceLog::factory()->create();
@@ -50,7 +50,7 @@ test('device log factory creates valid data', function (): void {
->and($log->log_entry)->toHaveKeys(['creation_timestamp', 'device_status_stamp', 'log_id', 'log_message', 'log_codeline', 'log_sourcefile', 'additional_info']);
});
-test('device log can be created with minimal required fields', function (): void {
+test('device log can be created with minimal required fields', function () {
$device = Device::factory()->create();
$log = DeviceLog::create([
'device_id' => $device->id,
diff --git a/tests/Unit/Models/DeviceModelTest.php b/tests/Unit/Models/DeviceModelTest.php
index 8c2b6e9..24904d6 100644
--- a/tests/Unit/Models/DeviceModelTest.php
+++ b/tests/Unit/Models/DeviceModelTest.php
@@ -4,7 +4,7 @@ declare(strict_types=1);
use App\Models\DeviceModel;
-test('device model has required attributes', function (): void {
+test('device model has required attributes', function () {
$deviceModel = DeviceModel::factory()->create([
'name' => 'Test Model',
'width' => 800,
@@ -28,7 +28,7 @@ test('device model has required attributes', function (): void {
expect($deviceModel->offset_y)->toBe(0);
});
-test('device model casts attributes correctly', function (): void {
+test('device model casts attributes correctly', function () {
$deviceModel = DeviceModel::factory()->create([
'width' => '800',
'height' => '480',
@@ -50,61 +50,61 @@ test('device model casts attributes correctly', function (): void {
expect($deviceModel->offset_y)->toBeInt();
});
-test('get color depth attribute returns correct format for bit depth 2', function (): void {
+test('get color depth attribute returns correct format for bit depth 2', function () {
$deviceModel = DeviceModel::factory()->create(['bit_depth' => 2]);
expect($deviceModel->getColorDepthAttribute())->toBe('2bit');
});
-test('get color depth attribute returns correct format for bit depth 4', function (): void {
+test('get color depth attribute returns correct format for bit depth 4', function () {
$deviceModel = DeviceModel::factory()->create(['bit_depth' => 4]);
expect($deviceModel->getColorDepthAttribute())->toBe('4bit');
});
-test('get color depth attribute returns 4bit for bit depth greater than 4', function (): void {
+test('get color depth attribute returns 4bit for bit depth greater than 4', function () {
$deviceModel = DeviceModel::factory()->create(['bit_depth' => 8]);
expect($deviceModel->getColorDepthAttribute())->toBe('4bit');
});
-test('get color depth attribute returns null when bit depth is null', function (): void {
+test('get color depth attribute returns null when bit depth is null', function () {
$deviceModel = new DeviceModel(['bit_depth' => null]);
expect($deviceModel->getColorDepthAttribute())->toBeNull();
});
-test('get scale level attribute returns null for width 800 or less', function (): void {
+test('get scale level attribute returns null for width 800 or less', function () {
$deviceModel = DeviceModel::factory()->create(['width' => 800]);
expect($deviceModel->getScaleLevelAttribute())->toBeNull();
});
-test('get scale level attribute returns large for width between 801 and 1000', function (): void {
+test('get scale level attribute returns large for width between 801 and 1000', function () {
$deviceModel = DeviceModel::factory()->create(['width' => 900]);
expect($deviceModel->getScaleLevelAttribute())->toBe('large');
});
-test('get scale level attribute returns xlarge for width between 1001 and 1400', function (): void {
+test('get scale level attribute returns xlarge for width between 1001 and 1400', function () {
$deviceModel = DeviceModel::factory()->create(['width' => 1200]);
expect($deviceModel->getScaleLevelAttribute())->toBe('xlarge');
});
-test('get scale level attribute returns xxlarge for width greater than 1400', function (): void {
+test('get scale level attribute returns xxlarge for width greater than 1400', function () {
$deviceModel = DeviceModel::factory()->create(['width' => 1500]);
expect($deviceModel->getScaleLevelAttribute())->toBe('xxlarge');
});
-test('get scale level attribute returns null when width is null', function (): void {
+test('get scale level attribute returns null when width is null', function () {
$deviceModel = new DeviceModel(['width' => null]);
expect($deviceModel->getScaleLevelAttribute())->toBeNull();
});
-test('device model factory creates valid data', function (): void {
+test('device model factory creates valid data', function () {
$deviceModel = DeviceModel::factory()->create();
expect($deviceModel->name)->not->toBeEmpty();
diff --git a/tests/Unit/Models/PlaylistItemTest.php b/tests/Unit/Models/PlaylistItemTest.php
index 428a165..6bfe00c 100644
--- a/tests/Unit/Models/PlaylistItemTest.php
+++ b/tests/Unit/Models/PlaylistItemTest.php
@@ -4,7 +4,7 @@ use App\Models\Playlist;
use App\Models\PlaylistItem;
use App\Models\Plugin;
-test('playlist item belongs to playlist', function (): void {
+test('playlist item belongs to playlist', function () {
$playlist = Playlist::factory()->create();
$playlistItem = PlaylistItem::factory()->create(['playlist_id' => $playlist->id]);
@@ -13,7 +13,7 @@ test('playlist item belongs to playlist', function (): void {
->id->toBe($playlist->id);
});
-test('playlist item belongs to plugin', function (): void {
+test('playlist item belongs to plugin', function () {
$plugin = Plugin::factory()->create();
$playlistItem = PlaylistItem::factory()->create(['plugin_id' => $plugin->id]);
@@ -22,7 +22,7 @@ test('playlist item belongs to plugin', function (): void {
->id->toBe($plugin->id);
});
-test('playlist item can check if it is a mashup', function (): void {
+test('playlist item can check if it is a mashup', function () {
$plugin = Plugin::factory()->create();
$regularItem = PlaylistItem::factory()->create([
'mashup' => null,
@@ -44,7 +44,7 @@ test('playlist item can check if it is a mashup', function (): void {
->and($mashupItem->isMashup())->toBeTrue();
});
-test('playlist item can get mashup name', function (): void {
+test('playlist item can get mashup name', function () {
$plugin1 = Plugin::factory()->create();
$plugin2 = Plugin::factory()->create();
$mashupItem = PlaylistItem::factory()->create([
@@ -59,7 +59,7 @@ test('playlist item can get mashup name', function (): void {
expect($mashupItem->getMashupName())->toBe('Test Mashup');
});
-test('playlist item can get mashup layout type', function (): void {
+test('playlist item can get mashup layout type', function () {
$plugin1 = Plugin::factory()->create();
$plugin2 = Plugin::factory()->create();
$mashupItem = PlaylistItem::factory()->create([
@@ -74,7 +74,7 @@ test('playlist item can get mashup layout type', function (): void {
expect($mashupItem->getMashupLayoutType())->toBe('1Lx1R');
});
-test('playlist item can get mashup plugin ids', function (): void {
+test('playlist item can get mashup plugin ids', function () {
$plugin1 = Plugin::factory()->create();
$plugin2 = Plugin::factory()->create();
$mashupItem = PlaylistItem::factory()->create([
@@ -89,7 +89,7 @@ test('playlist item can get mashup plugin ids', function (): void {
expect($mashupItem->getMashupPluginIds())->toBe([$plugin1->id, $plugin2->id]);
});
-test('playlist item can get required plugin count for different layouts', function (): void {
+test('playlist item can get required plugin count for different layouts', function () {
$layouts = [
'1Lx1R' => 2,
'1Tx1B' => 2,
@@ -117,7 +117,7 @@ test('playlist item can get required plugin count for different layouts', functi
}
});
-test('playlist item can get layout type', function (): void {
+test('playlist item can get layout type', function () {
$layoutTypes = [
'1Lx1R' => 'vertical',
'1Lx2R' => 'vertical',
@@ -144,7 +144,7 @@ test('playlist item can get layout type', function (): void {
}
});
-test('playlist item can get layout size for different positions', function (): void {
+test('playlist item can get layout size for different positions', function () {
$plugin1 = Plugin::factory()->create();
$plugin2 = Plugin::factory()->create();
$plugin3 = Plugin::factory()->create();
@@ -163,7 +163,7 @@ test('playlist item can get layout size for different positions', function (): v
->and($mashupItem->getLayoutSize(2))->toBe('half_vertical');
});
-test('playlist item can get available layouts', function (): void {
+test('playlist item can get available layouts', function () {
$layouts = PlaylistItem::getAvailableLayouts();
expect($layouts)->toBeArray()
@@ -171,7 +171,7 @@ test('playlist item can get available layouts', function (): void {
->and($layouts['1Lx1R'])->toBe('1 Left - 1 Right (2 plugins)');
});
-test('playlist item can get required plugin count for layout', function (): void {
+test('playlist item can get required plugin count for layout', function () {
$layouts = [
'1Lx1R' => 2,
'1Tx1B' => 2,
@@ -187,7 +187,7 @@ test('playlist item can get required plugin count for layout', function (): void
}
});
-test('playlist item can create mashup', function (): void {
+test('playlist item can create mashup', function () {
$playlist = Playlist::factory()->create();
$plugins = Plugin::factory()->count(3)->create();
$pluginIds = $plugins->pluck('id')->toArray();
diff --git a/tests/Unit/Models/PlaylistTest.php b/tests/Unit/Models/PlaylistTest.php
index 62d3aaf..55d31c7 100644
--- a/tests/Unit/Models/PlaylistTest.php
+++ b/tests/Unit/Models/PlaylistTest.php
@@ -4,7 +4,7 @@ use App\Models\Device;
use App\Models\Playlist;
use App\Models\PlaylistItem;
-test('playlist has required attributes', function (): void {
+test('playlist has required attributes', function () {
$playlist = Playlist::factory()->create([
'name' => 'Test Playlist',
'is_active' => true,
@@ -21,7 +21,7 @@ test('playlist has required attributes', function (): void {
->active_until->format('H:i')->toBe('17:00');
});
-test('playlist belongs to device', function (): void {
+test('playlist belongs to device', function () {
$device = Device::factory()->create();
$playlist = Playlist::factory()->create(['device_id' => $device->id]);
@@ -30,7 +30,7 @@ test('playlist belongs to device', function (): void {
->id->toBe($device->id);
});
-test('playlist has many items', function (): void {
+test('playlist has many items', function () {
$playlist = Playlist::factory()->create();
$items = PlaylistItem::factory()->count(3)->create(['playlist_id' => $playlist->id]);
@@ -39,7 +39,7 @@ test('playlist has many items', function (): void {
->each->toBeInstanceOf(PlaylistItem::class);
});
-test('getNextPlaylistItem returns null when playlist is inactive', function (): void {
+test('getNextPlaylistItem returns null when playlist is inactive', function () {
$playlist = Playlist::factory()->create(['is_active' => false]);
expect($playlist->getNextPlaylistItem())->toBeNull();
diff --git a/tests/Unit/Models/PluginTest.php b/tests/Unit/Models/PluginTest.php
index ef054b1..248e6f5 100644
--- a/tests/Unit/Models/PluginTest.php
+++ b/tests/Unit/Models/PluginTest.php
@@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Http;
uses(Illuminate\Foundation\Testing\RefreshDatabase::class);
-test('plugin has required attributes', function (): void {
+test('plugin has required attributes', function () {
$plugin = Plugin::factory()->create([
'name' => 'Test Plugin',
'data_payload' => ['key' => 'value'],
@@ -18,7 +18,7 @@ test('plugin has required attributes', function (): void {
->uuid->toMatch('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/');
});
-test('plugin automatically generates uuid on creation', function (): void {
+test('plugin automatically generates uuid on creation', function () {
$plugin = Plugin::factory()->create();
expect($plugin->uuid)
@@ -26,14 +26,14 @@ test('plugin automatically generates uuid on creation', function (): void {
->toMatch('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/');
});
-test('plugin can have custom uuid', function (): void {
+test('plugin can have custom uuid', function () {
$uuid = Illuminate\Support\Str::uuid();
$plugin = Plugin::factory()->create(['uuid' => $uuid]);
expect($plugin->uuid)->toBe($uuid);
});
-test('plugin data_payload is cast to array', function (): void {
+test('plugin data_payload is cast to array', function () {
$data = ['key' => 'value'];
$plugin = Plugin::factory()->create(['data_payload' => $data]);
@@ -42,7 +42,7 @@ test('plugin data_payload is cast to array', function (): void {
->toBe($data);
});
-test('plugin can have polling body for POST requests', function (): void {
+test('plugin can have polling body for POST requests', function () {
$plugin = Plugin::factory()->create([
'polling_verb' => 'post',
'polling_body' => '{"query": "query { user { id name } }"}',
@@ -51,7 +51,7 @@ test('plugin can have polling body for POST requests', function (): void {
expect($plugin->polling_body)->toBe('{"query": "query { user { id name } }"}');
});
-test('updateDataPayload sends POST request with body when polling_verb is post', function (): void {
+test('updateDataPayload sends POST request with body when polling_verb is post', function () {
Http::fake([
'https://example.com/api' => Http::response(['success' => true], 200),
]);
@@ -65,12 +65,14 @@ test('updateDataPayload sends POST request with body when polling_verb is post',
$plugin->updateDataPayload();
- Http::assertSent(fn ($request): bool => $request->url() === 'https://example.com/api' &&
- $request->method() === 'POST' &&
- $request->body() === '{"query": "query { user { id name } }"}');
+ Http::assertSent(function ($request) {
+ return $request->url() === 'https://example.com/api' &&
+ $request->method() === 'POST' &&
+ $request->body() === '{"query": "query { user { id name } }"}';
+ });
});
-test('updateDataPayload handles multiple URLs with IDX_ prefixes', function (): void {
+test('updateDataPayload handles multiple URLs with IDX_ prefixes', function () {
$plugin = Plugin::factory()->create([
'data_strategy' => 'polling',
'polling_url' => "https://api1.example.com/data\nhttps://api2.example.com/weather\nhttps://api3.example.com/news",
@@ -97,7 +99,7 @@ test('updateDataPayload handles multiple URLs with IDX_ prefixes', function ():
expect($plugin->data_payload['IDX_2'])->toBe(['headline' => 'test']);
});
-test('updateDataPayload handles single URL without nesting', function (): void {
+test('updateDataPayload handles single URL without nesting', function () {
$plugin = Plugin::factory()->create([
'data_strategy' => 'polling',
'polling_url' => 'https://api.example.com/data',
@@ -118,7 +120,7 @@ test('updateDataPayload handles single URL without nesting', function (): void {
expect($plugin->data_payload)->not->toHaveKey('IDX_0');
});
-test('updateDataPayload resolves Liquid variables in polling_header', function (): void {
+test('updateDataPayload resolves Liquid variables in polling_header', function () {
$plugin = Plugin::factory()->create([
'data_strategy' => 'polling',
'polling_url' => 'https://api.example.com/data',
@@ -137,13 +139,15 @@ test('updateDataPayload resolves Liquid variables in polling_header', function (
$plugin->updateDataPayload();
- Http::assertSent(fn ($request): bool => $request->url() === 'https://api.example.com/data' &&
- $request->method() === 'GET' &&
- $request->header('Authorization')[0] === 'Bearer test123' &&
- $request->header('X-Custom-Header')[0] === 'custom_header_value');
+ Http::assertSent(function ($request) {
+ return $request->url() === 'https://api.example.com/data' &&
+ $request->method() === 'GET' &&
+ $request->header('Authorization')[0] === 'Bearer test123' &&
+ $request->header('X-Custom-Header')[0] === 'custom_header_value';
+ });
});
-test('updateDataPayload resolves Liquid variables in polling_body', function (): void {
+test('updateDataPayload resolves Liquid variables in polling_body', function () {
$plugin = Plugin::factory()->create([
'data_strategy' => 'polling',
'polling_url' => 'https://api.example.com/data',
@@ -162,7 +166,7 @@ test('updateDataPayload resolves Liquid variables in polling_body', function ():
$plugin->updateDataPayload();
- Http::assertSent(function ($request): bool {
+ Http::assertSent(function ($request) {
$expectedBody = '{"query": "query { user { id name } }", "api_key": "test123", "user_id": "456"}';
return $request->url() === 'https://api.example.com/data' &&
@@ -171,7 +175,7 @@ test('updateDataPayload resolves Liquid variables in polling_body', function ():
});
});
-test('webhook plugin is stale if webhook event occurred', function (): void {
+test('webhook plugin is stale if webhook event occurred', function () {
$plugin = Plugin::factory()->create([
'data_strategy' => 'webhook',
'data_payload_updated_at' => now()->subMinutes(10),
@@ -182,7 +186,7 @@ test('webhook plugin is stale if webhook event occurred', function (): void {
});
-test('webhook plugin data not stale if no webhook event occurred for 1 hour', function (): void {
+test('webhook plugin data not stale if no webhook event occurred for 1 hour', function () {
$plugin = Plugin::factory()->create([
'data_strategy' => 'webhook',
'data_payload_updated_at' => now()->subMinutes(60),
@@ -193,7 +197,7 @@ test('webhook plugin data not stale if no webhook event occurred for 1 hour', fu
});
-test('plugin configuration is cast to array', function (): void {
+test('plugin configuration is cast to array', function () {
$config = ['timezone' => 'UTC', 'refresh_interval' => 30];
$plugin = Plugin::factory()->create(['configuration' => $config]);
@@ -202,7 +206,7 @@ test('plugin configuration is cast to array', function (): void {
->toBe($config);
});
-test('plugin can get configuration value by key', function (): void {
+test('plugin can get configuration value by key', function () {
$config = ['timezone' => 'UTC', 'refresh_interval' => 30];
$plugin = Plugin::factory()->create(['configuration' => $config]);
@@ -211,7 +215,7 @@ test('plugin can get configuration value by key', function (): void {
expect($plugin->getConfiguration('nonexistent', 'default'))->toBe('default');
});
-test('plugin configuration template is cast to array', function (): void {
+test('plugin configuration template is cast to array', function () {
$template = [
'custom_fields' => [
[
@@ -229,7 +233,7 @@ test('plugin configuration template is cast to array', function (): void {
->toBe($template);
});
-test('resolveLiquidVariables resolves variables from configuration', function (): void {
+test('resolveLiquidVariables resolves variables from configuration', function () {
$plugin = Plugin::factory()->create([
'configuration' => [
'api_key' => '12345',
@@ -259,7 +263,7 @@ test('resolveLiquidVariables resolves variables from configuration', function ()
expect($result)->toBe('High');
});
-test('resolveLiquidVariables handles invalid Liquid syntax gracefully', function (): void {
+test('resolveLiquidVariables handles invalid Liquid syntax gracefully', function () {
$plugin = Plugin::factory()->create([
'configuration' => [
'api_key' => '12345',
@@ -273,7 +277,7 @@ test('resolveLiquidVariables handles invalid Liquid syntax gracefully', function
->toThrow(Keepsuit\Liquid\Exceptions\SyntaxException::class);
});
-test('plugin can extract default values from custom fields configuration template', function (): void {
+test('plugin can extract default values from custom fields configuration template', function () {
$configurationTemplate = [
'custom_fields' => [
[
@@ -319,7 +323,7 @@ test('plugin can extract default values from custom fields configuration templat
expect($plugin->getConfiguration('timezone'))->toBeNull();
});
-test('resolveLiquidVariables resolves configuration variables correctly', function (): void {
+test('resolveLiquidVariables resolves configuration variables correctly', function () {
$plugin = Plugin::factory()->create([
'configuration' => [
'Latitude' => '48.2083',
@@ -334,7 +338,7 @@ test('resolveLiquidVariables resolves configuration variables correctly', functi
expect($plugin->resolveLiquidVariables($template))->toBe($expected);
});
-test('resolveLiquidVariables handles missing variables gracefully', function (): void {
+test('resolveLiquidVariables handles missing variables gracefully', function () {
$plugin = Plugin::factory()->create([
'configuration' => [
'Latitude' => '48.2083',
@@ -347,7 +351,7 @@ test('resolveLiquidVariables handles missing variables gracefully', function ():
expect($plugin->resolveLiquidVariables($template))->toBe($expected);
});
-test('resolveLiquidVariables handles empty configuration', function (): void {
+test('resolveLiquidVariables handles empty configuration', function () {
$plugin = Plugin::factory()->create([
'configuration' => [],
]);
diff --git a/tests/Unit/Notifications/BatteryLowTest.php b/tests/Unit/Notifications/BatteryLowTest.php
index a809e5e..ba53356 100644
--- a/tests/Unit/Notifications/BatteryLowTest.php
+++ b/tests/Unit/Notifications/BatteryLowTest.php
@@ -8,14 +8,14 @@ use App\Notifications\BatteryLow;
use App\Notifications\Channels\WebhookChannel;
use Illuminate\Notifications\Messages\MailMessage;
-test('battery low notification has correct via channels', function (): void {
+test('battery low notification has correct via channels', function () {
$device = Device::factory()->create();
$notification = new BatteryLow($device);
expect($notification->via(new User()))->toBe(['mail', WebhookChannel::class]);
});
-test('battery low notification creates correct mail message', function (): void {
+test('battery low notification creates correct mail message', function () {
$device = Device::factory()->create([
'name' => 'Test Device',
'last_battery_voltage' => 3.0,
@@ -29,7 +29,7 @@ test('battery low notification creates correct mail message', function (): void
expect($mailMessage->viewData['device'])->toBe($device);
});
-test('battery low notification creates correct webhook message', function (): void {
+test('battery low notification creates correct webhook message', function () {
config([
'services.webhook.notifications.topic' => 'battery.low',
'app.name' => 'Test App',
@@ -60,7 +60,7 @@ test('battery low notification creates correct webhook message', function (): vo
]);
});
-test('battery low notification creates correct array representation', function (): void {
+test('battery low notification creates correct array representation', function () {
$device = Device::factory()->create([
'name' => 'Test Device',
'last_battery_voltage' => 3.0,
diff --git a/tests/Unit/Notifications/WebhookChannelTest.php b/tests/Unit/Notifications/WebhookChannelTest.php
index 16dbd4b..cdefbdd 100644
--- a/tests/Unit/Notifications/WebhookChannelTest.php
+++ b/tests/Unit/Notifications/WebhookChannelTest.php
@@ -11,13 +11,13 @@ use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Psr7\Response;
use Illuminate\Notifications\Notification;
-test('webhook channel returns null when no webhook url is configured', function (): void {
+test('webhook channel returns null when no webhook url is configured', function () {
$client = Mockery::mock(Client::class);
$channel = new WebhookChannel($client);
$user = new class extends User
{
- public function routeNotificationFor($driver, $notification = null): null
+ public function routeNotificationFor($driver, $notification = null)
{
return null; // No webhook URL configured
}
@@ -30,13 +30,13 @@ test('webhook channel returns null when no webhook url is configured', function
expect($result)->toBeNull();
});
-test('webhook channel throws exception when notification does not implement toWebhook', function (): void {
+test('webhook channel throws exception when notification does not implement toWebhook', function () {
$client = Mockery::mock(Client::class);
$channel = new WebhookChannel($client);
$user = new class extends User
{
- public function routeNotificationFor($driver, $notification = null): string
+ public function routeNotificationFor($driver, $notification = null)
{
return 'https://example.com/webhook';
}
@@ -44,23 +44,23 @@ test('webhook channel throws exception when notification does not implement toWe
$notification = new class extends Notification
{
- public function via($notifiable): array
+ public function via($notifiable)
{
return [];
}
};
- expect(fn (): ?\GuzzleHttp\Psr7\Response => $channel->send($user, $notification))
+ expect(fn () => $channel->send($user, $notification))
->toThrow(Exception::class, 'Notification does not implement toWebhook method.');
});
-test('webhook channel sends successful webhook request', function (): void {
+test('webhook channel sends successful webhook request', function () {
$client = Mockery::mock(Client::class);
$channel = new WebhookChannel($client);
$user = new class extends User
{
- public function routeNotificationFor($driver, $notification = null): string
+ public function routeNotificationFor($driver, $notification = null)
{
return 'https://example.com/webhook';
}
@@ -86,13 +86,13 @@ test('webhook channel sends successful webhook request', function (): void {
expect($result)->toBe($expectedResponse);
});
-test('webhook channel throws exception when response status is not successful', function (): void {
+test('webhook channel throws exception when response status is not successful', function () {
$client = Mockery::mock(Client::class);
$channel = new WebhookChannel($client);
$user = new class extends User
{
- public function routeNotificationFor($driver, $notification = null): string
+ public function routeNotificationFor($driver, $notification = null)
{
return 'https://example.com/webhook';
}
@@ -107,17 +107,17 @@ test('webhook channel throws exception when response status is not successful',
->once()
->andReturn($errorResponse);
- expect(fn (): ?\GuzzleHttp\Psr7\Response => $channel->send($user, $notification))
+ expect(fn () => $channel->send($user, $notification))
->toThrow(Exception::class, 'Webhook request failed with status code: 400');
});
-test('webhook channel handles guzzle exceptions', function (): void {
+test('webhook channel handles guzzle exceptions', function () {
$client = Mockery::mock(Client::class);
$channel = new WebhookChannel($client);
$user = new class extends User
{
- public function routeNotificationFor($driver, $notification = null): string
+ public function routeNotificationFor($driver, $notification = null)
{
return 'https://example.com/webhook';
}
@@ -130,6 +130,6 @@ test('webhook channel handles guzzle exceptions', function (): void {
->once()
->andThrow(new class extends Exception implements GuzzleException {});
- expect(fn (): ?\GuzzleHttp\Psr7\Response => $channel->send($user, $notification))
+ expect(fn () => $channel->send($user, $notification))
->toThrow(Exception::class);
});
diff --git a/tests/Unit/Notifications/WebhookMessageTest.php b/tests/Unit/Notifications/WebhookMessageTest.php
index a6ed027..a79f580 100644
--- a/tests/Unit/Notifications/WebhookMessageTest.php
+++ b/tests/Unit/Notifications/WebhookMessageTest.php
@@ -4,26 +4,26 @@ declare(strict_types=1);
use App\Notifications\Messages\WebhookMessage;
-test('webhook message can be created with static method', function (): void {
+test('webhook message can be created with static method', function () {
$message = WebhookMessage::create('test data');
expect($message)->toBeInstanceOf(WebhookMessage::class);
});
-test('webhook message can be created with constructor', function (): void {
+test('webhook message can be created with constructor', function () {
$message = new WebhookMessage('test data');
expect($message)->toBeInstanceOf(WebhookMessage::class);
});
-test('webhook message can set query parameters', function (): void {
+test('webhook message can set query parameters', function () {
$message = WebhookMessage::create()
->query(['param1' => 'value1', 'param2' => 'value2']);
expect($message->toArray()['query'])->toBe(['param1' => 'value1', 'param2' => 'value2']);
});
-test('webhook message can set data', function (): void {
+test('webhook message can set data', function () {
$data = ['key' => 'value', 'nested' => ['array' => 'data']];
$message = WebhookMessage::create()
->data($data);
@@ -31,7 +31,7 @@ test('webhook message can set data', function (): void {
expect($message->toArray()['data'])->toBe($data);
});
-test('webhook message can add headers', function (): void {
+test('webhook message can add headers', function () {
$message = WebhookMessage::create()
->header('X-Custom-Header', 'custom-value')
->header('Authorization', 'Bearer token');
@@ -41,7 +41,7 @@ test('webhook message can add headers', function (): void {
expect($headers['Authorization'])->toBe('Bearer token');
});
-test('webhook message can set user agent', function (): void {
+test('webhook message can set user agent', function () {
$message = WebhookMessage::create()
->userAgent('Test App/1.0');
@@ -49,20 +49,20 @@ test('webhook message can set user agent', function (): void {
expect($headers['User-Agent'])->toBe('Test App/1.0');
});
-test('webhook message can set verify option', function (): void {
+test('webhook message can set verify option', function () {
$message = WebhookMessage::create()
->verify(true);
expect($message->toArray()['verify'])->toBeTrue();
});
-test('webhook message verify defaults to false', function (): void {
+test('webhook message verify defaults to false', function () {
$message = WebhookMessage::create();
expect($message->toArray()['verify'])->toBeFalse();
});
-test('webhook message can chain methods', function (): void {
+test('webhook message can chain methods', function () {
$message = WebhookMessage::create(['initial' => 'data'])
->query(['param' => 'value'])
->data(['updated' => 'data'])
@@ -79,7 +79,7 @@ test('webhook message can chain methods', function (): void {
expect($array['verify'])->toBeTrue();
});
-test('webhook message toArray returns correct structure', function (): void {
+test('webhook message toArray returns correct structure', function () {
$message = WebhookMessage::create(['test' => 'data']);
$array = $message->toArray();
diff --git a/tests/Unit/Services/ImageGenerationServiceTest.php b/tests/Unit/Services/ImageGenerationServiceTest.php
index 5e3dc47..37ed4e2 100644
--- a/tests/Unit/Services/ImageGenerationServiceTest.php
+++ b/tests/Unit/Services/ImageGenerationServiceTest.php
@@ -6,15 +6,10 @@ use App\Enums\ImageFormat;
use App\Models\Device;
use App\Models\DeviceModel;
use App\Services\ImageGenerationService;
-use Bnussbau\TrmnlPipeline\TrmnlPipeline;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
-beforeEach(function (): void {
- TrmnlPipeline::fake();
-});
-
it('get_image_settings returns device model settings when available', function (): void {
// Create a DeviceModel
$deviceModel = DeviceModel::factory()->create([
@@ -37,6 +32,7 @@ it('get_image_settings returns device model settings when available', function (
// Use reflection to access private method
$reflection = new ReflectionClass(ImageGenerationService::class);
$method = $reflection->getMethod('getImageSettings');
+ $method->setAccessible(true);
$settings = $method->invoke(null, $device);
@@ -51,7 +47,7 @@ it('get_image_settings returns device model settings when available', function (
expect($settings['offset_x'])->toBe(10);
expect($settings['offset_y'])->toBe(20);
expect($settings['use_model_settings'])->toBe(true);
-});
+})->skipOnCi();
it('get_image_settings falls back to device settings when no device model', function (): void {
// Create a device without DeviceModel
@@ -65,6 +61,7 @@ it('get_image_settings falls back to device settings when no device model', func
// Use reflection to access private method
$reflection = new ReflectionClass(ImageGenerationService::class);
$method = $reflection->getMethod('getImageSettings');
+ $method->setAccessible(true);
$settings = $method->invoke(null, $device);
@@ -74,7 +71,7 @@ it('get_image_settings falls back to device settings when no device model', func
expect($settings['rotation'])->toBe(180);
expect($settings['image_format'])->toBe(ImageFormat::PNG_8BIT_GRAYSCALE->value);
expect($settings['use_model_settings'])->toBe(false);
-});
+})->skipOnCi();
it('get_image_settings uses defaults for missing device properties', function (): void {
// Create a device without DeviceModel and missing properties
@@ -88,6 +85,7 @@ it('get_image_settings uses defaults for missing device properties', function ()
// Use reflection to access private method
$reflection = new ReflectionClass(ImageGenerationService::class);
$method = $reflection->getMethod('getImageSettings');
+ $method->setAccessible(true);
$settings = $method->invoke(null, $device);
@@ -103,12 +101,13 @@ it('get_image_settings uses defaults for missing device properties', function ()
expect($settings['offset_y'])->toBe(0);
// image_format defaults to 'auto' when not set
expect($settings['image_format'])->toBe('auto');
-});
+})->skipOnCi();
it('determine_image_format_from_model returns correct formats', function (): void {
// Use reflection to access private method
$reflection = new ReflectionClass(ImageGenerationService::class);
$method = $reflection->getMethod('determineImageFormatFromModel');
+ $method->setAccessible(true);
// Test BMP format
$bmpModel = DeviceModel::factory()->create([
@@ -154,7 +153,7 @@ it('determine_image_format_from_model returns correct formats', function (): voi
]);
$format = $method->invoke(null, $unknownModel);
expect($format)->toBe(ImageFormat::AUTO->value);
-});
+})->skipOnCi();
it('cleanup_folder identifies active images correctly', function (): void {
// Create devices with images
@@ -190,7 +189,7 @@ it('reset_if_not_cacheable detects device models', function (): void {
$plugin->refresh();
expect($plugin->current_image)->toBeNull();
-});
+})->skipOnCi();
it('reset_if_not_cacheable detects custom dimensions', function (): void {
// Create a plugin
@@ -207,7 +206,7 @@ it('reset_if_not_cacheable detects custom dimensions', function (): void {
$plugin->refresh();
expect($plugin->current_image)->toBeNull();
-});
+})->skipOnCi();
it('reset_if_not_cacheable preserves cache for standard devices', function (): void {
// Create a plugin
@@ -225,7 +224,7 @@ it('reset_if_not_cacheable preserves cache for standard devices', function (): v
$plugin->refresh();
expect($plugin->current_image)->toBe('test-uuid');
-});
+})->skipOnCi();
it('reset_if_not_cacheable preserves cache for og_png and og_plus device models', function (): void {
// Create a plugin
@@ -256,7 +255,7 @@ it('reset_if_not_cacheable preserves cache for og_png and og_plus device models'
$plugin->refresh();
expect($plugin->current_image)->toBe('test-uuid');
-});
+})->skipOnCi();
it('reset_if_not_cacheable resets cache for non-standard device models', function (): void {
// Create a plugin
@@ -278,12 +277,12 @@ it('reset_if_not_cacheable resets cache for non-standard device models', functio
$plugin->refresh();
expect($plugin->current_image)->toBeNull();
-});
+})->skipOnCi();
it('reset_if_not_cacheable handles null plugin', function (): void {
// Test that the method handles null plugin gracefully
expect(fn () => ImageGenerationService::resetIfNotCacheable(null))->not->toThrow(Exception::class);
-});
+})->skipOnCi();
it('image_format enum includes new 2bit 4c format', function (): void {
// Test that the new format is properly defined in the enum
diff --git a/tests/Unit/Services/OidcProviderTest.php b/tests/Unit/Services/OidcProviderTest.php
index 1976872..06da1dd 100644
--- a/tests/Unit/Services/OidcProviderTest.php
+++ b/tests/Unit/Services/OidcProviderTest.php
@@ -9,10 +9,10 @@ use GuzzleHttp\Psr7\Response;
use Illuminate\Http\Request;
use Laravel\Socialite\Two\User;
-test('oidc provider throws exception when endpoint is not configured', function (): void {
+test('oidc provider throws exception when endpoint is not configured', function () {
config(['services.oidc.endpoint' => null]);
- expect(fn (): OidcProvider => new OidcProvider(
+ expect(fn () => new OidcProvider(
new Request(),
'client-id',
'client-secret',
@@ -20,7 +20,7 @@ test('oidc provider throws exception when endpoint is not configured', function
))->toThrow(Exception::class, 'OIDC endpoint is not configured');
});
-test('oidc provider handles well-known endpoint url', function (): void {
+test('oidc provider handles well-known endpoint url', function () {
config(['services.oidc.endpoint' => 'https://example.com/.well-known/openid-configuration']);
$mockClient = Mockery::mock(Client::class);
@@ -48,7 +48,7 @@ test('oidc provider handles well-known endpoint url', function (): void {
expect($provider)->toBeInstanceOf(OidcProvider::class);
});
-test('oidc provider handles base url endpoint', function (): void {
+test('oidc provider handles base url endpoint', function () {
config(['services.oidc.endpoint' => 'https://example.com']);
$mockClient = Mockery::mock(Client::class);
@@ -76,7 +76,7 @@ test('oidc provider handles base url endpoint', function (): void {
expect($provider)->toBeInstanceOf(OidcProvider::class);
});
-test('oidc provider throws exception when configuration is empty', function (): void {
+test('oidc provider throws exception when configuration is empty', function () {
config(['services.oidc.endpoint' => 'https://example.com']);
$mockClient = Mockery::mock(Client::class);
@@ -90,7 +90,7 @@ test('oidc provider throws exception when configuration is empty', function ():
$this->app->instance(Client::class, $mockClient);
- expect(fn (): OidcProvider => new OidcProvider(
+ expect(fn () => new OidcProvider(
new Request(),
'client-id',
'client-secret',
@@ -98,7 +98,7 @@ test('oidc provider throws exception when configuration is empty', function ():
))->toThrow(Exception::class, 'OIDC configuration is empty or invalid JSON');
});
-test('oidc provider throws exception when authorization endpoint is missing', function (): void {
+test('oidc provider throws exception when authorization endpoint is missing', function () {
config(['services.oidc.endpoint' => 'https://example.com']);
$mockClient = Mockery::mock(Client::class);
@@ -115,7 +115,7 @@ test('oidc provider throws exception when authorization endpoint is missing', fu
$this->app->instance(Client::class, $mockClient);
- expect(fn (): OidcProvider => new OidcProvider(
+ expect(fn () => new OidcProvider(
new Request(),
'client-id',
'client-secret',
@@ -123,7 +123,7 @@ test('oidc provider throws exception when authorization endpoint is missing', fu
))->toThrow(Exception::class, 'authorization_endpoint not found in OIDC configuration');
});
-test('oidc provider throws exception when configuration request fails', function (): void {
+test('oidc provider throws exception when configuration request fails', function () {
config(['services.oidc.endpoint' => 'https://example.com']);
$mockClient = Mockery::mock(Client::class);
@@ -133,7 +133,7 @@ test('oidc provider throws exception when configuration request fails', function
$this->app->instance(Client::class, $mockClient);
- expect(fn (): OidcProvider => new OidcProvider(
+ expect(fn () => new OidcProvider(
new Request(),
'client-id',
'client-secret',
@@ -141,7 +141,7 @@ test('oidc provider throws exception when configuration request fails', function
))->toThrow(Exception::class, 'Failed to load OIDC configuration');
});
-test('oidc provider uses default scopes when none provided', function (): void {
+test('oidc provider uses default scopes when none provided', function () {
config(['services.oidc.endpoint' => 'https://example.com']);
$mockClient = Mockery::mock(Client::class);
@@ -169,7 +169,7 @@ test('oidc provider uses default scopes when none provided', function (): void {
expect($provider)->toBeInstanceOf(OidcProvider::class);
});
-test('oidc provider uses custom scopes when provided', function (): void {
+test('oidc provider uses custom scopes when provided', function () {
config(['services.oidc.endpoint' => 'https://example.com']);
$mockClient = Mockery::mock(Client::class);
@@ -198,7 +198,7 @@ test('oidc provider uses custom scopes when provided', function (): void {
expect($provider)->toBeInstanceOf(OidcProvider::class);
});
-test('oidc provider maps user data correctly', function (): void {
+test('oidc provider maps user data correctly', function () {
config(['services.oidc.endpoint' => 'https://example.com']);
$mockClient = Mockery::mock(Client::class);
@@ -241,7 +241,7 @@ test('oidc provider maps user data correctly', function (): void {
expect($user->getAvatar())->toBe('https://example.com/avatar.jpg');
});
-test('oidc provider handles missing user fields gracefully', function (): void {
+test('oidc provider handles missing user fields gracefully', function () {
config(['services.oidc.endpoint' => 'https://example.com']);
$mockClient = Mockery::mock(Client::class);