Files
coolify/tests/Feature/AppIconsTest.php
T
Andras BacsaiandClaude Opus 5.5 a70e856882 test: remove tests that do not test behavior and strengthen weak ones
- Remove tests that only check markup, CSS, static text, wire:key strings,
  framework behavior, copied app logic, or expect(true)
- Replace source-grep and Reflection checks of security fixes with tests
  that run the real code (shell quoting, locked properties, 403 checks,
  webhook fork trust, log redaction, Sentinel token cleanup)
- Assert response bodies and unchanged data on API error paths
- Run the Traefik version job through handle() instead of private methods
- Update stale tests for scheduled task props, the default Postgres image,
  and the disabled transfer link of unvalidated servers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:47:56 +01:00

41 lines
1.5 KiB
PHP

<?php
test('icon files are opaque pngs with the required sizes', function (string $file, int $size) {
$image = getimagesize(public_path($file));
expect($image)->toMatchArray([0 => $size, 1 => $size, 'mime' => 'image/png']);
})->with([
['apple-touch-icon.png', 180],
['icon-192.png', 192],
['icon-512.png', 512],
['icon-maskable-512.png', 512],
]);
test('favicon ico contains 16, 32 and 48 pixel images', function () {
$ico = file_get_contents(public_path('favicon.ico'));
$header = unpack('vreserved/vtype/vcount', $ico);
$sizes = collect(range(0, $header['count'] - 1))
->map(fn (int $index) => ord($ico[6 + 16 * $index]))
->all();
expect($header['type'])->toBe(1)
->and($sizes)->toBe([16, 32, 48]);
});
test('web manifest lists the pwa icons', function () {
$manifest = json_decode(file_get_contents(public_path('site.webmanifest')), true, flags: JSON_THROW_ON_ERROR);
expect($manifest['name'])->toBe('Coolify')
->and($manifest['display'])->toBe('standalone')
->and(collect($manifest['icons'])->map(fn (array $icon) => [$icon['src'], $icon['sizes'], $icon['purpose'] ?? 'any'])->all())
->toBe([
['/icon-192.png', '192x192', 'any'],
['/icon-512.png', '512x512', 'any'],
['/icon-maskable-512.png', '512x512', 'maskable'],
]);
foreach ($manifest['icons'] as $icon) {
expect(public_path(ltrim($icon['src'], '/')))->toBeFile();
}
});