refactor: split testing seeders into complete store and network fixtures - #98
Merged
Conversation
Replace CatalogAndProductsSeeder and CheckoutOrdersSeeder with two declarative seeders built on a shared fixtures concern: - StoreSeeder seeds one complete store: order config, location with weekly hours, sandbox Stripe gateway, categories, products with variants and addons, published catalog, customers, an open cart, a pending checkout, a month of cash and Stripe orders across statuses, and reviews. - NetworkSeeder seeds a marketplace: network gateway, network categories, five member stores (one uncategorised) and network-tagged orders across them. Fixes carried over from the old seeders: core product categories are now purged between runs, addon categories carry their store owner so they show in the console, order statuses survive the FleetOps tracking reset, orders are spread over the last month, and schema column lookups are cached per table. Each seeder tags and purges only its own fixtures while still cleaning up legacy storefront-testing data. Also fix Network::setOptionsAttribute, which stored a raw array and made any network save with options fail; it now encodes JSON like Store.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #98 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 1775 1775
===========================================
Files 135 135
Lines 7785 7785
===========================================
Hits 7785 7785
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…etwork Network::categories() filtered on 'network_category', a value nothing writes, so the relation was always empty; it now matches the 'storefront_network' categories the console and v1 API use. Network::createCategory set the owner type from 'network:storefront', which resolves to a nonexistent class; it now resolves to the Network model. Covered by the network category behaviour test.
Open
roncodes
added a commit
that referenced
this pull request
Sep 4, 2026
Cuts the patch release carrying the QPay authentication fix (#99) and the network model repairs and testing seeder split (#98). The release/v* workflow gate is deliberately NOT changed here — #97 owns that, with fleetbase/fleetbase#641 behind it. Both must land before this branch is merged, or the tag job either skips (old gate) or is refused by the reusable workflow (gate updated, reusable workflow not yet).
roncodes
force-pushed
the
release/v0.4.21
branch
from
September 4, 2026 10:44
54965e0 to
9bbc7b5
Compare
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.
Summary
Refactors the Storefront testing seeders into two complete, idempotent fixtures built on a shared concern:
StoreSeederseeds one complete standalone store: order config, store location with weekly hours, sandbox Stripe gateway, 3 product categories, 10 products (variants, addons, sale/unavailable/draft cases), a published catalog, 20 customers, an open cart, a pending checkout, 30 captured orders spread over the last month (cash and Stripe, delivery and pickup, seven lifecycle statuses), and reviews.NetworkSeederseeds a complete marketplace: a network with its own sandbox Stripe gateway, 3 network categories, 5 member stores (grocer, restaurant, wet market, pharmacy, and an uncategorised florist) each built the same way, and 46 network-tagged orders across them.TestingSeederruns both. Each seeder tags and purges only its own fixtures, and still cleans up data from the previousstorefront-testingseeders.Problems in the old seeders this fixes:
owner_uuid, so the console never listed them for the store.createdbecause FleetOps resets the status column when the tracking number is generated; statuses are now re-applied after creation.Also fixes three
Networkmodel defects found while seeding:Network::setOptionsAttributestored a raw array (bypassing the JSON cast), so any network save with options failed. It now encodes JSON likeStore.Network::categories()filtered onfor = 'network_category', a value nothing writes, so the relation was always empty. It now matches thestorefront_networkcategories the console and v1 API use.Network::createCategoryderived the owner type fromnetwork:storefront, which resolves to a nonexistent class. It now resolves to theNetworkmodel.Tests that had locked in the broken behaviour were updated, and the category behaviour test now asserts the relation and owner type.
Related Issue
N/A
Type of Change
Implementation Notes
Concerns/SeedsStorefrontFixtures.phpholds all builders (store, location/hours, gateway, categories, products, variants, addons, catalog, network, network categories, customers, carts, checkouts, orders, reviews) plus one purge routine covering both databases. The seeders are declarative definition arrays on top of it.Concerns/SeedsTestingData.phpnow exposesseedName()per seeder (storefront-testing-store/storefront-testing-network), matches legacystorefront-testingrecords when purging, caches table column listings, and wraps purges inwithoutForeignKeyConstraints().SEED_STRIPE_SECRET_KEY/SEED_STRIPE_PUBLISHABLE_KEY; otherwise obvioussk_test_…placeholdervalues are stored so the gateway is selectable and the missing-secret path can be tested.SEED_COMPANY_UUID/SEED_COMPANY_PUBLIC_IDpick the company as before.Validation
Command output / summary:
Note:
composer test:typescurrently fails locally becausephpstan.neon.distpoints atsrcrather thanserver/src(pre-existing); the seeders directory is not in its scope either way.Documentation Impact
fleetbase/fleetbase.ioAPI Reference Impact
fleetbase/postmanAPI reference notes:
None. Seeders are development tooling; the
Networkoptions change only affects persistence of an already-documented attribute.Documentation Notes
None.
Risk
storefront-testingtags), so re-running against a developer database is safe. They are not meant for production.Network::setOptionsAttributenow persists a JSON string. Reads are unchanged because theoptionsattribute is cast withJson::class; any code that inspectedgetAttributes()['options']directly and expected an array would need updating (only the two tests did).Network::categories()will now return rows where it previously returned none. Existing categories created throughcreateCategorycarry the oldFleetbase\Network\Models\Storefrontowner type string; nothing filters on that column, so they keep working, but a data cleanup could normalise it.Screenshots / Recordings
N/A