fix: ✅ update and pass all tests

This commit is contained in:
Alexis Gousseau 2025-10-07 09:22:11 +02:00
parent 16e4e4ee19
commit b36aa19028
No known key found for this signature in database
GPG key ID: 4A614CB3DBBA2406
2 changed files with 14 additions and 14 deletions

View file

@ -53,16 +53,16 @@ class ClaimTest extends ApiBase
$response = $this->callApiWithToken($service, 'post', route('apiV4.claim.store'), \array_merge(
$this->skeleton,
[
'brand_id' => $brand->getKey(),
'subject_id' => $subject->getKey(),
'customer_id' => $customer->getKey(),
'brand_id' => $brand->getKey(),
'subject_id' => $subject->getKey(),
'hashcode' => $customer->hashcode,
]
));
$claimModel = Claim::query()->where([
['email', 'claim@hotmail.fr'],
['brand_id', $brand->getKey()],
['subject_id', $subject->getKey()],
['customer_id', $customer->getKey()],
['hashcode', $customer->hashcode],
])->exists();
$json = $response->decodeResponseJson();
$this->assertApiResponseStatusIs($json, ApiStatus::OK);
@ -72,7 +72,7 @@ class ClaimTest extends ApiBase
$claimModel = Claim::query()->where('email', 'claim@hotmail.fr')->firstOrFail();
$this->assertNotEmpty($claimModel->file, 'The "file" field is empty on the Claim model.');
$this->assertTrue(
Storage::exists(ltrim($claimModel->file, '/')),
Storage::disk('public')->exists(str_replace('storage/', '', $claimModel->file)),
"The file does not exist: {$claimModel->file}"
);
}
@ -90,9 +90,9 @@ class ClaimTest extends ApiBase
$response = $this->callApiWithToken($service, 'post', route('apiV4.claim.store'), \array_merge(
$this->skeleton,
[
'brand_id' => 0,
'subject_id' => 0,
'customer_id' => 0,
'brand_id' => 0,
'subject_id' => 0,
'hashcode' => null,
]
));
$json = $response->decodeResponseJson();
@ -122,7 +122,7 @@ class ClaimTest extends ApiBase
['email', 'claim@hotmail.fr'],
['brand_id', $brand->getKey()],
['subject_id', $subject->getKey()],
['customer_id', null],
['hashcode', null],
])->exists();
$json = $response->decodeResponseJson();
$this->assertApiResponseStatusIs($json, ApiStatus::OK);
@ -147,10 +147,10 @@ class ClaimTest extends ApiBase
$response = $this->callApiWithToken($service, 'post', route('apiV4.claim.store'), \array_merge(
Arr::except($this->skeleton, ['address', 'city', 'postcode', 'file']),
[
'file' => $base64Gif,
'brand_id' => $brand->getKey(),
'subject_id' => $subject->getKey(),
'customer_id' => $customer->getKey(),
'file' => $base64Gif,
'brand_id' => $brand->getKey(),
'subject_id' => $subject->getKey(),
'hashcode' => $customer->hashcode,
]
));
$json = $response->decodeResponseJson();

View file

@ -36,7 +36,7 @@ class CrmClientClaimTest extends CrmClientTester
$claimModel = ModelsClaim::query()->where('email', 'claim@hotmail.fr')->firstOrFail();
$this->assertNotEmpty($claimModel->file, 'The "file" field is empty on the Claim model.');
$this->assertTrue(
Storage::exists(ltrim($claimModel->file, '/')),
Storage::disk('public')->exists(str_replace('storage/', '', $claimModel->file)),
"The file does not exist: {$claimModel->file}"
);
}