+
![]()
+
{{
item.title
}}
-
{{ item.size_variant_type }} - {{ item.license_type }}
+
+ {{ item.album_title ?? $t("webshop.orderDownload.unknownAlbum") }}
+
+
+ {{ $t("webshop.basketList.printLabel") }}: {{ item.print_width }} × {{ item.print_height }}
+ {{ item.print_unit }}, {{ $t("webshop.basketList.paperType") }}: {{ item.print_paper_type }}
+
+
+ {{ $t("webshop.basketList.pixelLabel") }}: {{ item.pixel_width }} × {{ item.pixel_height }} px,
+ {{ $t("webshop.orderSummary.license") }} {{ item.license_type }}
+
+
+ {{ $t("webshop.orderSummary.size") }} {{ item.size_variant_type }}, {{ $t("webshop.orderSummary.license") }}
+ {{ item.license_type }}
+
requirePro();
+ }
+
+ public function tearDown(): void
+ {
+ $this->resetPro();
+ parent::tearDown();
+ }
+
+ // -------------------------------------------------------------------------
+ // T-042-03: Happy path — both album_title and thumb_url non-null (S-042-06, S-042-07)
+ // -------------------------------------------------------------------------
+
+ public function testAlbumTitleAndThumbUrlPresentWhenPhotoAndAlbumExist(): void
+ {
+ // $this->photo1 is in $this->album1 and has all 7 size variants (incl. THUMB).
+ $order = Order::factory()
+ ->forUser($this->userMayUpload1)
+ ->withTransactionId(Str::uuid()->toString())
+ ->withProvider(OmnipayProviderType::DUMMY)
+ ->withStatus(PaymentStatusType::PENDING)
+ ->withEmail($this->userMayUpload1->email)
+ ->create();
+
+ OrderItem::factory()
+ ->forOrder($order)
+ ->forPhoto($this->photo1)
+ ->forAlbum($this->album1)
+ ->create();
+
+ $response = $this->actingAs($this->userMayUpload1)->getJson("Shop/Order/{$order->id}");
+
+ $this->assertOk($response);
+ $items = $response->json('items');
+ $this->assertIsArray($items);
+ $this->assertCount(1, $items);
+
+ $item = $items[0];
+ $this->assertEquals($this->album1->title, $item['album_title']);
+ $this->assertNotNull($item['thumb_url']);
+ $this->assertIsString($item['thumb_url']);
+ }
+
+ // -------------------------------------------------------------------------
+ // T-042-04: album_title is null when album deleted (S-042-02)
+ // -------------------------------------------------------------------------
+
+ public function testAlbumTitleIsNullWhenAlbumIsAbsent(): void
+ {
+ $order = Order::factory()
+ ->forUser($this->userMayUpload1)
+ ->withTransactionId(Str::uuid()->toString())
+ ->withProvider(OmnipayProviderType::DUMMY)
+ ->withStatus(PaymentStatusType::PENDING)
+ ->withEmail($this->userMayUpload1->email)
+ ->create();
+
+ // Create item with album_id = null (simulating deleted album via FK set-null cascade).
+ OrderItem::factory()
+ ->forOrder($order)
+ ->forPhoto($this->photo1)
+ ->forAlbum(null)
+ ->create();
+
+ $response = $this->actingAs($this->userMayUpload1)->getJson("Shop/Order/{$order->id}");
+
+ $this->assertOk($response);
+ $items = $response->json('items');
+ $this->assertCount(1, $items);
+ $this->assertNull($items[0]['album_title']);
+ }
+
+ // -------------------------------------------------------------------------
+ // T-042-05: thumb_url is null when photo deleted (S-042-04)
+ // -------------------------------------------------------------------------
+
+ public function testThumbUrlIsNullWhenPhotoIsAbsent(): void
+ {
+ $order = Order::factory()
+ ->forUser($this->userMayUpload1)
+ ->withTransactionId(Str::uuid()->toString())
+ ->withProvider(OmnipayProviderType::DUMMY)
+ ->withStatus(PaymentStatusType::PENDING)
+ ->withEmail($this->userMayUpload1->email)
+ ->create();
+
+ // Create item with photo_id = null (simulating deleted photo via FK set-null cascade).
+ OrderItem::factory()
+ ->forOrder($order)
+ ->forPhoto(null)
+ ->forAlbum($this->album1)
+ ->create();
+
+ $response = $this->actingAs($this->userMayUpload1)->getJson("Shop/Order/{$order->id}");
+
+ $this->assertOk($response);
+ $items = $response->json('items');
+ $this->assertCount(1, $items);
+ $this->assertNull($items[0]['thumb_url']);
+ }
+
+ // -------------------------------------------------------------------------
+ // T-042-06: thumb_url is null when photo has no THUMB size variant (S-042-05)
+ // -------------------------------------------------------------------------
+
+ public function testThumbUrlIsNullWhenPhotoHasNoThumbVariant(): void
+ {
+ $photo_without_thumb = Photo::factory()
+ ->owned_by($this->userMayUpload1)
+ ->create();
+
+ // Delete the THUMB size variant so only non-thumb variants remain.
+ SizeVariant::where('photo_id', $photo_without_thumb->id)
+ ->where('type', SizeVariantType::THUMB)
+ ->delete();
+
+ $order = Order::factory()
+ ->forUser($this->userMayUpload1)
+ ->withTransactionId(Str::uuid()->toString())
+ ->withProvider(OmnipayProviderType::DUMMY)
+ ->withStatus(PaymentStatusType::PENDING)
+ ->withEmail($this->userMayUpload1->email)
+ ->create();
+
+ OrderItem::factory()
+ ->forOrder($order)
+ ->forPhoto($photo_without_thumb)
+ ->forAlbum($this->album1)
+ ->create();
+
+ $response = $this->actingAs($this->userMayUpload1)->getJson("Shop/Order/{$order->id}");
+
+ $this->assertOk($response);
+ $items = $response->json('items');
+ $this->assertCount(1, $items);
+ $this->assertNull($items[0]['thumb_url']);
+ }
+}