diff --git a/tests/CRM/ApiV4/ClaimTest.php b/tests/CRM/ApiV4/ClaimTest.php index 7ad687d..d77a021 100644 --- a/tests/CRM/ApiV4/ClaimTest.php +++ b/tests/CRM/ApiV4/ClaimTest.php @@ -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(); diff --git a/tests/Client/CrmClientClaimTest.php b/tests/Client/CrmClientClaimTest.php index 4f8e133..5dc0983 100644 --- a/tests/Client/CrmClientClaimTest.php +++ b/tests/Client/CrmClientClaimTest.php @@ -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}" ); }