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

[v10.x] Add missing methods to newly extended fake Vite instance #49165

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

stevebauman
Copy link
Contributor

@stevebauman stevebauman commented Nov 28, 2023

Similar to #49163, the changes made in #49150 to the fake Vite instance swapped out using $this->withoutVite() in our tests has broken our suite. If I roll back to a v10.3X version, the test passes normally.

This PR adds some remaining methods that are documented in the facade and on the laravel.com website.


Test:

public function testItSavesAsPdf()
{
    $this->withoutVite();

    $invoice = Invoice::factory()->create();

    $media = $invoice->saveAsPdf();

    $this->assertEquals(now()->format('Y-m').'-invoice.pdf', $media->file_name);
}

Exception:

Illuminate\View\ViewException: Vite manifest not found at: /Users/stevebauman/Sites/project/public/build/manifest.json (View: /Users/stevebauman/Sites/project/resources/views/invoice/show.blade.php)

This is due to the following call in our show.blade.php method:

<style>{!! Vite::content('resources/scss/app.scss') !!}</style>

On another note, this anonymous class is getting pretty large. Should we swap this out with its own dedicated ViteFake class living in the Illuminate\Support\Testing\Fakes namespace that implements the Fake interface?

@taylorotwell taylorotwell merged commit 364cc05 into laravel:10.x Nov 28, 2023
20 checks passed
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

Successfully merging this pull request may close these issues.

2 participants