Skip to content

Document PHP and Laravel support on branch 5.0 - #19

Open
eldmark wants to merge 6 commits into
csgt:5.0from
eldmark:docs/readme-5.0
Open

eldmark wants to merge 6 commits into
csgt:5.0from
eldmark:docs/readme-5.0

Conversation

@eldmark

@eldmark eldmark commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

What

  1. README — documents which PHP and Laravel versions this branch supports, with a matrix for every branch of the repository.
  2. Tests — adds a PHPUnit suite for the static API of Crud.
  3. composer.lock — stops tracking it.

Why

The composer.json constraints across the repo are stale, so there was no
reliable way to tell which branch to install for a given Laravel version. On
this branch specifically, the committed composer.lock predated the
illuminate/support ~5.1 constraint, so composer install failed outright on
a clean checkout. composer.lock is already listed in .gitignore, and a
library should resolve its dependencies against the host application anyway.

Scope of the tests

Covered: getUrl and the static setters — setTabla, setTablaId,
setTitulo, setExport, setSearch, setStateSave, setSoftDelete,
setResponsive, setPerPage, setTemplate, setPermisos, setSlug,
setWhere (both arities), setWhereIn, setWhereRaw, setLeftJoin,
setGroupBy, setOrderBy, setHidden, setBotonExtra, and setCampo across
its branches.

Not covered, and why: index(), create(), store(), destroy() and
getData() depend on the Input, Request, Session, View, Redirect and
DB facades plus a booted application, which cannot be exercised without
effectively starting Laravel. The dd()-guarded validation branches are also
left out, since calling them terminates the PHPUnit process.

composer install && vendor/bin/phpunit — 21 tests, 53 assertions, green.

Note

This branch is archived: the listing optimization applied to 5.3 and up was
not backported here, and its API is the old static Crud facade rather than
CrudController.

eldmark added 6 commits August 4, 2026 11:23
Adds a PHPUnit suite for Crud: getUrl, setTabla, setTablaId, setTitulo,
setExport, setSearch, setStateSave, setSoftDelete, setResponsive,
setPerPage, setTemplate, setPermisos, setSlug, setWhere, setWhereIn,
setWhereRaw, setLeftJoin, setGroupBy, setOrderBy, setHidden, setBotonExtra
and setCampo.

Crud is a static class with no CrudController equivalent here: index,
create, store, destroy and getData are all driven by the Input, Request,
Session, View, Redirect and DB facades and need a booted Laravel
application, so they are left untested. The suite only covers what can be
exercised without one: the pure getUrl() helper and the setters that shape
the static state, including the branching and defaulting logic inside
setCampo(). Static state is reset before every test since it persists
across calls.

phpunit is require-dev only, so nothing changes for consumers of the
package.

Run with `composer install && vendor/bin/phpunit`.
The file is already listed in .gitignore and the committed copy was stale: it
predated the illuminate/support ~5.1 constraint, so composer install failed on
a clean checkout. A library should resolve its dependencies against the host
application anyway.
Every setter of this class is static and writes a static property, and the
facade is used as `Crud::setX(...)`. `setResponsive()` was declared without the
`static` keyword while still writing `self::$responsive`, so the documented
call `Crud::setResponsive(false)` was a fatal error and the option could only
be reached through an instance.

Adding the keyword makes the static call work and keeps any existing instance
call working, since a static method can still be called on an instance.
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.

1 participant