Skip to content

Commit e5811d5

Browse files
committed
fix tests
1 parent dcecdfb commit e5811d5

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

tests/Feature_v2/Metrics/MetricsGetTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ public function testWithData(): void
7373
$this->assertOk($response); // 1: - viewed album4
7474
$response = $this->get('gallery/' . $this->album4->id);
7575
$this->assertOk($response); // 2: - shared album4
76-
$response = $this->postJson('Metrics::photo', ['photo_ids' => [$this->photo4->id]]);
76+
$response = $this->postJson('Metrics::photo', ['photo_ids' => [$this->photo4->id], 'from_id' => $this->album4->id]);
7777
$this->assertNoContent($response); // 3: viewed photo4
78-
$response = $this->postJson('Metrics::favourite', ['photo_ids' => [$this->photo4->id]]);
78+
$response = $this->postJson('Metrics::favourite', ['photo_ids' => [$this->photo4->id], 'from_id' => $this->album4->id]);
7979
$this->assertNoContent($response); // 4: favourite photo4
8080
$response = $this->get('gallery/' . $this->album4->id . '/' . $this->photo4->id);
8181
$this->assertOk($response); // 5: shared photo4

tests/Unit/Http/Requests/Album/ZipRequestTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use App\Policies\AlbumPolicy;
1919
use App\Rules\AlbumIDListRule;
2020
use App\Rules\RandomIDListRule;
21+
use App\Rules\RandomIDRule;
2122
use Illuminate\Support\Facades\Gate;
2223
use Illuminate\Validation\Rules\Enum;
2324
use Tests\Unit\Http\Requests\Base\BaseRequestTest;
@@ -62,6 +63,7 @@ public function testRules(): void
6263
RequestAttribute::ALBUM_IDS_ATTRIBUTE => ['sometimes', new AlbumIDListRule()],
6364
RequestAttribute::PHOTO_IDS_ATTRIBUTE => ['sometimes', new RandomIDListRule()],
6465
RequestAttribute::SIZE_VARIANT_ATTRIBUTE => ['required_if_accepted:photos_ids', new Enum(DownloadVariantType::class)],
66+
RequestAttribute::FROM_ID_ATTRIBUTE => ['required_if_accepted:photos_ids', new RandomIDRule(true)],
6567
];
6668
$this->assertCount(count($expectedRuleMap), $rules); // only validating the first 7 rules & the GRANTS_UPLOAD_ATTRIBUTE is tested afterwards
6769

0 commit comments

Comments
 (0)