Should something this be a unit test or something else? Using Laravel 8


I’ve recently built an app that imports around 4500 rows from Excel into a MongoDB database. I have the import working really well, but now I’m running into the GIGO issue.

The excel spreadsheet has a column called ‘program_url’, this column is supposed to be an external link. About a thousand of these are malformed or lead to 404s.
I’ve managed to fix the malformed urls during the import (http:www. typt things), but there are quite a few that just lead to a 404 page, and I wanted to test that.

My question is, is it better to test for an HTTP 200 status while I’m running the import? Or should it be part of a unit/feature/browser test? If the latter.. how would I go about doing that?

In the Dusk test I have the following code as a test..

    public function test_program_urls()
        $programs = Program::all()->take(5);

        foreach($programs AS $program) {

            $this->browse(function (Browser $browser) use ($program) {




The test/assertions pass, but I don’t see a way to check the status of ClickLink (

I tried to do this as a Database test, but that has even fewer assertions..

Perhaps I’m answering my own question.. and I should just test during the seeding/import and either fix the Excel sheet everytime I run into an issue, or log all the 404s, for future inspection.

Source: Laravel

Categorised as laravel, php, phpunit Tagged , ,


Leave a Reply

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us