Documentation
¶
Overview ¶
Package tests is the base every test in this project builds on.
It is tests/TestCase.php, in the shape Go allows: a package the suites import rather than a class they extend. What belongs here is what more than one suite needs -- booting the application, opening a database, reading a file from the project root -- and nothing else. A helper used by one test belongs beside it.
The two suites are the Laravel ones and they mean the same thing:
tests/Feature/ boots the application and makes a request tests/Unit/ checks one thing without booting anything
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func App ¶
App boots the whole application on a throwaway SQLite database, migrated, and returns a browser for it.
It is Laravel's RefreshDatabase and $this->get() in one call, and it is the difference between a feature test worth writing and one nobody writes: every alternative starts with twelve lines of environment, connection and migration that have nothing to do with what is being proved.
SQLite in a temporary directory, so the tests need nothing installed and two of them cannot see each other's rows. The file goes with t.TempDir.
func Kernel ¶
Kernel needs no database. database/sql connects lazily, so the wiring, the pipeline and every route can be exercised without a server running -- which is what makes this a useful smoke test to keep in a project skeleton. Kernel boots the application for a test.
Exported because both suites use it, which is the whole reason this package exists.
func Root ¶
Root is the project root, from inside a suite directory.
The tests that read a file -- the Dockerfile, the workflow, arandu.toml -- run two directories down from it now, and a relative path written from the old location silently reads nothing: os.ReadFile returns an error the test reports as "the file does not say X", which is true and misleading.
Types ¶
This section is empty.