Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image Path #30

Open
kingdomac opened this issue Oct 14, 2021 · 5 comments
Open

Image Path #30

kingdomac opened this issue Oct 14, 2021 · 5 comments

Comments

@kingdomac
Copy link

in OfficeImageControllerTest after changing the imageResource to return the full path the Storage::assertExists($response->json('data.path')); return an error

@davorminchorov
Copy link

Here's the fix that you need to apply:
image

@davorminchorov
Copy link

I created the PR #32 that should fix this issue.

@bryceandy
Copy link

Does the office object have a path property? @davorminchorov

@bryceandy
Copy link

bryceandy commented Oct 19, 2021

Since $office->refresh()->path is null, and Storage::assertExists(null) always passes, your test will pass.

This is what I think you intended to do:

Storage::assertExists(
    $office->refresh()->images->first()->path
);

Alternatively, this was my own approach:

$image = UploadedFile::fake()->image('cover.jpg');

$this->actingAs($user)
    ->postJson(route('office.images.store', $office), compact('image'))
    ->assertCreated();

Storage::assertExists($image->hashName());

@davorminchorov
Copy link

That's a good catch, I did not even check for the value. I'll update the PR accordingly. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants