Repository navigation
Modernise lacommerce for a first release under simtabi - #3
Merged
Merged
Conversation
The migration only creates a dummy_models table for the test suite. It sat in database/migrations, which the provider loads into every host application. This commit moves the file verbatim; the provider change follows separately.
- Config is merged once (it was merged twice) under simtabi.lacommerce, published to config/simtabi/lacommerce.php with the tag simtabi::lacommerce-config. - The bare key lacommerce and tag lacommerce:config are deprecated, not removed: a published config/lacommerce.php is still honoured, the bare key is still populated with the merged result, and the bare tag still publishes to config/lacommerce.php. Earliest removal: 0.2.0. - The two publish entries use different spellings of the same source path, because Laravel keys publishable paths by source and a shared key would send both tags to the same target. - The provider no longer loads database/migrations, which only ever held the test fixture now under tests/. - Views, translations, assets: none ship, so their loaders and publish tags are registered only when the directory exists.
static::observe() instantiates the model, and current Laravel throws a LogicException when a model is instantiated while it is still booting. Every model using HasSku, HasOrderNumber or HasTicketNumber failed on its first use. The traits now register the observer's creating and updating handlers directly; the observers themselves are unchanged.
- PHP ^8.4.1 || ^8.5, matching the family floor. - Require the illuminate components src/ imports, at ^12.0 || ^13.0. - Testbench ^10.6 || ^11.0 and PHPUnit ^11.5 || ^12.0, with prefer-stable. - phpunit.xml rewritten for the current schema. - Ignore vendor/, composer.lock and PHPUnit caches; a library does not track its lock file. - 22 tests cover the three traits (generation on create, refresh on update, manual values kept, generation disabled) and the provider (scoped and deprecated config keys and tags, precedence, no migrations loaded into the host, bindings, Str macros). - The fixture migration gains order_number and ticket_number columns.
tests.yml runs PHPUnit on PHP 8.4 and 8.5 against lowest and stable dependencies, on pull_request and workflow_dispatch only, with no path filter so it can be a required check. The existing checks workflow now validates composer.json strictly and lints tests/ instead of the removed database/ directory.
- README: Tests badge on simtabi/lacommerce; the Packagist badge is dropped until the package is published, with a line saying why; the required Quick start guide and usage section; disclosure address corrected to security@simtabi.com. - Docs: the scoped config path and tag, the deprecated bare key, the real config key names (source_column, destination_column), the real interface a custom generator implements, and no publish commands for assets or views the package does not ship. - CHANGELOG: Keep a Changelog with an Unreleased section. The 0.1.0 entry dated 2022-02-03 is replaced because no such tag exists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prepares
simtabi/lacommercefor its first tagged release under thesimtabiorg. No tag is cut here.What changed
^8.4.1 || ^8.5;illuminate/contracts,database,httpandsupportat^12.0 || ^13.0(src/ imported them with nothing required); Testbench^10.6 || ^11.0, PHPUnit^11.5 || ^12.0. No lock file is tracked.tests.ymlruns them on PHP 8.4 and 8.5, lowest and stable, onpull_requestandworkflow_dispatch, with no path filter so it can be made a required check.simtabi.lacommerce, fileconfig/simtabi/lacommerce.php, tagsimtabi::lacommerce-config; a view/translation namespace ofsimtabi/lacommercewhen those directories exist.homepage,support.*, the badge and the doc links point atsimtabi. The CHANGELOG is now Keep a Changelog with anUnreleasedsection. The old0.1.0 - 2022-02-03entry was replaced because no such tag was ever cut.Deprecated, not removed
lacommerce/config/lacommerce.phpsimtabi.lacommerce/config/simtabi/lacommerce.phpconfig('lacommerce.*')still returns the merged configlacommerce:configsimtabi::lacommerce-configconfig/lacommerce.phpEarliest removal: 0.2.0. Tests pin both aliases.
Behaviour changes worth reading
database/migrations. That directory held only a test fixture creating adummy_modelstable. It was loaded into every host app, somigrateeither created that table or failed on the file's non-standard name. The fixture moved verbatim totests/Fixtures/in its own commit. No consumer relied on a migration it shipped, but this is the one change a host app can observe.static::observe()inside the trait's boot method, and current Laravel throws aLogicExceptionthere, so every model using a trait failed on first use. They now register the observer'screating/updatinghandlers directly. The observers are unchanged.simtabi::lacommerce-configtoconfig/lacommerce.php. The two entries use distinct spellings of the same path, and a test asserts each tag's target.lacommerce:assets,:viewsand:translationsno longer appear (they published nothing before). The install docs no longer tell users to run them.Not changed
Str::sku,Str::orderNumberandStr::ticketNumbermacro names are left as they are. Renaming them is a separate decision.src/.DS_Storewas never tracked. It was already ignored, so there was nothing to untrack.Verification
Run locally on PHP 8.5.3: stable deps (Laravel 13, Testbench 11.3, PHPUnit 12.5) gave 22 tests, OK. Lowest deps (Laravel 12.69, Testbench 10.6, PHPUnit 11.5) gave 22 tests, OK, with 2 deprecation notices. I checked that three of the guards can fail by reintroducing the defect: dropping the legacy merge, reloading migrations, and reverting the trait boot each turn the suite red.