// the find
nunomaduro/laravel-mojito
🍹 A lightweight package for testing Laravel views in isolation
Mojito is a small Laravel test helper that renders a single Blade view and checks its HTML with a fluent API, without a full HTTP request. It suits Laravel teams who want quick checks on templates and partials, not whole-page feature tests.
- Chaining in() and first() narrows each check to a subtree, so in('.links')->first('a')->hasLink(...) only matches the link you mean and not similar text elsewhere on the page.
- ViewAssertion is macroable, so a project can add its own domain checks, such as the README's hasCharset example, without forking the package.
- The same fluent assertions work on an isolated view name via assertView('welcome') and on an HTTP TestResponse via $response->assertView(), so one vocabulary covers both kinds of test.
- The surface is small, with one test file per assertion and HTML fixtures for the malformed and multiple-match cases. It is easy to read in one sitting.
- The README build badge still points at travis-ci.org, which has been shut down. The real CI is the GitHub Actions workflow in .github/workflows/tests.yml, so the README has not caught up with the move.
- contains() checks for text inside the selected nodes, so it can pass on a substring the template only happens to include. The documented API has no exact-match or count assertion to guard against that.
- The documented API has no negated assertions. Only empty() covers absence, so checks like 'the nav has no admin link' need workarounds.
- Isolated rendering means anything the template gets from middleware or the request has to be passed in by hand. A passing assertView test shows the template works with those inputs, not that the real page works.