Titelbild im Profil, durchsuchbare Baum-Auswahl im IT-Ticket (0.20.1)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m47s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m8s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m6s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m25s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m23s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m39s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m40s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m8s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m47s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m8s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m6s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m25s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m23s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m39s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m40s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m8s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2f03597b89
commit
05b4b79cb3
146 changed files with 1051 additions and 495 deletions
|
|
@ -246,7 +246,8 @@ class ItServiceTest extends TestCase
|
|||
|
||||
$this->actingAs($this->user)->get('/it-service/tickets/neu')->assertInertia(fn (Assert $page) => $page
|
||||
->where('options.data.categories', fn ($categories) => collect($categories)->pluck('path')->all() === ['Hardware', 'Hardware › Drucker', 'Hardware › Drucker › Toner', 'Verwaist'])
|
||||
->where('options.data.categories.2.depth', 2));
|
||||
->where('options.data.categories.2.depth', 2)
|
||||
->where('options.data.categories.2.name', 'Toner'));
|
||||
}
|
||||
|
||||
public function test_greeting_box_gets_a_my_it_button(): void
|
||||
|
|
|
|||
74
tests/Feature/Profile/CoverTest.php
Normal file
74
tests/Feature/Profile/CoverTest.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Profile;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Support\Theme\Theme;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CoverTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Storage::fake('uploads');
|
||||
}
|
||||
|
||||
public function test_cover_is_stored_cropped_and_shown_in_profile_and_greeting(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->post('/profil/titelbild', ['cover' => UploadedFile::fake()->image('berge.jpg', 2400, 1600)])
|
||||
->assertRedirect()
|
||||
->assertSessionHasNoErrors();
|
||||
|
||||
$user->refresh();
|
||||
$this->assertStringStartsWith("covers/{$user->id}/", $user->cover_path);
|
||||
[$width, $height] = getimagesizefromstring(Storage::disk('uploads')->get($user->cover_path));
|
||||
$this->assertSame([1600, 500], [$width, $height]);
|
||||
|
||||
$this->get("/personen/{$user->id}")->assertInertia(fn (Assert $page) => $page
|
||||
->where('person.cover_url', $user->coverUrl())
|
||||
->where('auth.user.cover_url', $user->coverUrl()));
|
||||
|
||||
// Neues Bild ersetzt das alte, Entfernen räumt auf
|
||||
$old = $user->cover_path;
|
||||
$this->post('/profil/titelbild', ['cover' => UploadedFile::fake()->image('see.png', 1800, 900)])->assertSessionHasNoErrors();
|
||||
Storage::disk('uploads')->assertMissing($old);
|
||||
|
||||
$current = $user->fresh()->cover_path;
|
||||
$this->delete('/profil/titelbild')->assertRedirect();
|
||||
Storage::disk('uploads')->assertMissing($current);
|
||||
$this->assertNull($user->fresh()->cover_path);
|
||||
}
|
||||
|
||||
public function test_only_images_are_accepted(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post('/profil/titelbild', ['cover' => UploadedFile::fake()->create('lebenslauf.pdf', 100, 'application/pdf')])
|
||||
->assertSessionHasErrors('cover');
|
||||
}
|
||||
|
||||
public function test_default_cover_and_overlay_come_from_the_appearance(): void
|
||||
{
|
||||
$theme = app(Theme::class);
|
||||
$theme->saveDraft(['profile_cover' => 'theme/titel.webp', 'profile_cover_overlay' => 55]);
|
||||
app()->call([$theme, 'publish']);
|
||||
|
||||
$this->actingAs(User::factory()->create())->get('/')->assertInertia(fn (Assert $page) => $page
|
||||
->where('branding.profile_cover.image_url', Storage::disk('uploads')->url('theme/titel.webp'))
|
||||
->where('branding.profile_cover.overlay', 0.55));
|
||||
|
||||
// Ungültige Werte fallen auf den Standard zurück
|
||||
$this->assertSame(70, Theme::normalize(['profile_cover_overlay' => 13])['profile_cover_overlay']);
|
||||
$this->assertNull(Theme::normalize(['profile_cover' => '../.env'])['profile_cover']);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue