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

Merge inertia-laravel-testing into inertia-laravel #220

Merged
merged 10 commits into from
Mar 2, 2021

Conversation

claudiodekker
Copy link
Member

@claudiodekker claudiodekker commented Mar 2, 2021

Testing

After multiple months of beta testing, this PR makes the inertia-laravel-testing library an official part of the inertia-laravel adapter 🎉

While the inertia-laravel-testing library WILL remain available for installation, it WILL NOT receive any further (security) updates going forward.

Migrating

To migrate from inertia-laravel-testing to the inertia-laravel adapter implementation, simply follow these easy steps:

  1. In your composer.json file, remove the claudiodekker/inertia-laravel-testing dependency line
  2. In your composer.json file, change the version of inertiajs/inertia-laravel to ^0.4.0
  3. Run composer update
  4. Search and replace use ClaudioDekker\Inertia\Assert; with use Inertia\Testing\Assert; in your test suites.

That's it! When done correctly, all of your tests should still be passing.

@reinink reinink merged commit 097fe5b into master Mar 2, 2021
@reinink reinink deleted the inertia-laravel-testing branch March 2, 2021 19:35
innocenzi added a commit to innocenzi/awesome-inertiajs that referenced this pull request Mar 2, 2021
@eballeste
Copy link

@claudiodekker hi! thanks for this! how do you use this?

I looked at the tests directory and tried to recreate something very simple but keep getting:
Undefined type 'Inertia\Testing\Assert'

namespace Tests\Feature\Frontend\Pages;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Inertia\Testing\Assert;
use Tests\TestCase;

class HomePageTest extends TestCase
{
    use RefreshDatabase;

    /** @test */
    function i_can_see_the_homepage()
    {
        $response = $this->get(route('home'));

        $response->assertInertia(fn (Assert $inertia) => $inertia
            ->component('Home')
        );
    }
}

@eballeste
Copy link

ouuu I didn't notice that this had just been merged! talk about timing!

i upgraded this package via composer and my test passed

@claudiodekker
Copy link
Member Author

@claudiodekker hi! thanks for this! how do you use this?

I looked at the tests directory and tried to recreate something very simple but keep getting:
Undefined type 'Inertia\Testing\Assert'

namespace Tests\Feature\Frontend\Pages;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Inertia\Testing\Assert;
use Tests\TestCase;

class HomePageTest extends TestCase
{
    use RefreshDatabase;

    /** @test */
    function i_can_see_the_homepage()
    {
        $response = $this->get(route('home'));

        $response->assertInertia(fn (Assert $inertia) => $inertia
            ->component('Home')
        );
    }
}

Right now, we don't have documentation for this on our website yet, but since this is pretty much entirely the 'old' testing helpers library, you can find the documentation here

@j-dexx
Copy link

j-dexx commented Apr 22, 2021

Can we port the testing documentation somewhere more noticeable?

Being laravel specific doesn't make sense on the main inertia docs to me personally but in the readme maybe or wiki (which seems to exist but if I click github just redirects back to the main page)?

@sebastiaanluca
Copy link

The documentation for this seems to be quite hidden 😅 Found some under https://inertiajs.com/releases/inertia-laravel-0.4.0-2021-03-02#top that redirected me to https://github.com/claudiodekker/inertia-laravel-testing/tree/a5ac8d372e456534f5ad2e07a6875e0f27c6a73d.

@reinink
Copy link
Member

reinink commented Jul 1, 2021

@sebastiaanluca Yeah, this really needs more attention. I just haven't had the time to get this done yet.

To help things a little, I've just added a new "Testing" page to the website (https://inertiajs.com/testing), which outlines some testing basis, and mentions the Laravel testing helper.

@sebastiaanluca
Copy link

@reinink Totally understand that! Thanks for adding the docs on testing on such short notice. Think that's enough for (new) Inertia users to get started with testing.

@sagalbot
Copy link

sagalbot commented Jul 6, 2021

@reinink do you have something in mind for how you'd like these docs to be implemented? I have some free time these days and may be able to lend a hand.

@reinink
Copy link
Member

reinink commented Jul 14, 2021

@sagalbot Heh, no, I haven't had a chance to think that through yet. It's kind of tricky, as it requires a ton of documentation. It would looks something like the new Fluent JSON Testing Laravel docs and the existing docs that Claudio wrote for this.

If you're still up to taking a crack at this, I'd be happy to give you access to the website repo. Let me know. 👍

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.

6 participants