1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 21:54:03 +00:00
Commit graph

22 commits

Author SHA1 Message Date
lukinovec
77226cf2f4
Delete pivot records when deleting SyncMaster using morph pivot (#46)
* Add and correct pivot record tests

* Implement and test deleting pivot records when using morph pivot

* Use dataset to test deleting pivot records with both MorphTenantPivot and TenantPivot

* Delete extra test, use createTenantsAndRunMigrations() where appropriate

* FIx PHPStan errors

* Revert DB::table() assertion changes

* minor test improvements

---------

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2024-04-22 12:18:15 +02:00
Samuel Štancl
6784685054
Resource syncing rework (#30)
* Add &Model to docblock

* Fix code style (php-cs-fixer)

* Only delete synced resource if the central resource shouldSync

* Add central resource detached event and listener

* Add SyncedTenant interface

* Use the event & listener in the test file

* Add getGlobalIdentifierKey(Name) to TenantMorphPivot

* Refactor TriggerSyncingEvents

* Fix code style (php-cs-fixer)

* Test queueing the detaching listener

* Move finding the central resource into the event, naming changes

* Fix code style (php-cs-fixer)

* Simplify listener code

* Refactor detaching logic

* Create tenant resource after attaching central to tenant, test queueing related listener

* Delete dd()

* Fix code style (php-cs-fixer)

* Move triggerAttachEvent from SyncMaster

* Update attach event-related code

* Move findResource from SyncedTenant to the pivot trait

* Add annotation

* Update annotation

* Simplify getAttributesForCreation in CreateTenantResourceFromSyncMaster

* Update naming

* Add tenant trait for attaching/detaching resources

* Update test names

* Move creation attribute parsing method to trait

* Rename variable

* Fix code style (php-cs-fixer)

* Delete complete to-do

* Delete event comment

* Rename event property

* Find tenant resource in detach listener

* Use global ID key of tenant resource in cascade deletes listener

* Use global ID key name of the central resource while creating/deleting tenant resources

* Add getSyncedCreationAttributes example in the annotation

* Fix inconsistencies in SyncedTenant methods

* Improve annotation

* Don't return the query in `$scopeGetModelQuery`

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>

* Fix code style (php-cs-fixer)

* Update scoping getModel query

* Only use detach event instead of using both detach and delete events, refactor code

* Test that detaching tenant from a central resource doesn't affect other tenants

* Delete extra imports

* Fix code style (php-cs-fixer)

* Add PivotWithRelation, test attaching/detaching resources without polymorphic relations

* Refactor TriggerSyncingEvents to work with non-polymorphic relations too

* Fix code style (php-cs-fixer)

* Rename synced resource changed event, fix tests

* Enforce passing Tenant&Model to attach/detach events

* Prevent firing saved event automatically in CreateTenantResource

* Improve TriggerSyncingEvents trait

* Delete unused import

* Make TriggerSyncingEvents methods non-static, improve annotations

* Pass saved model to event

* Move attach/detach queueing tests to ResourceSyncingTest, pass models instead of IDs to attach/detach

* Move events to ResourceSyncing\Events

* Fix code style (php-cs-fixer)

* Use SerializesModels in queueable listeners instead of events

* Delete redundant $shouldQueue setting

* Rename listener, test cascade deletes from both sides of many-to-many

* Move creation attributes-related code to a separate test file, improve comments (wip)

* Improve comments, fix variable name capitalization

* Delete tracing comma

* Extract duplicate code into a trait

* Don't accept nullable tenant in SyncMasterDeleted

* Fix annotation

* Fix code style (php-cs-fixer)

* Update annotation

* Fix PHPStan error

* Fix annotation

* Update comments and test naming

* Move triggerDeleteEvent to CascadeDeletes interface

* Rename test file

* Import TenantPivot in Tenant class (tests/Etc)

* Add central resource not available in pivot exception

* Rename SaveSyncedResource to UpdateOrCreateSyncedResource

* Add new events and listeners to TSP stub

* Improve comments and naming

* Only keep SerializesModels in classes that utilize it

* Use tenant->run()

* Import events in stub

* Move RS listeners to separate namespace, use `Event/`Listener/` in stub for consistency

* Fix code style (php-cs-fixer)

* Fix namespace changes

* Use cursor instead of get

* Update src/ResourceSyncing/ParsesCreationAttributes.php

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>

* Update naming, structure (discussed on Discord)

* Update uses in in test file

* remove double ;;

* Add comments

* Test if static properties work fine with queueable listeners

* Update $shouldQuery test

* Update creation attributes

* Work on updating the tests

* Make synced attributes configurable using static properties

* Update resource syncing tests

* Get rid of mixed attribute classes

* Get rid of TenantUserWIthCreationAttributes

* Fix imports

* Get rid of the conditionally synced classes, improve tests

* Simplify resource creation tests (only test the more complex cases instead of each case - if the complex case works, the simpler cases work too)

* Clean up ResourceSyncingTest (mostly duplicate tests that were already in AutomaticResourceCreationTest)

* Simplify class naming in polymorhpic tests

* Move automatic resource creation tests to ResourceSyncingTest

* Test that the sync event doesn't get triggered excessively

* Only trigger the sync event if the synced attributes were changed or if the resource was recently created

* Update synced attribute instead of unsynced in test

* Fix sync event test

* Update static property redefining test

* Use getGlobalIdentifierKeyName() instead of hardcoding the key name

* Delete static properties from the ResourceSyncing trait

* Reuse user classes in polymorphic tests

* Update tests/ResourceSyncingTest.php

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>

* Use the default tenants() method in central user, override the default in ResourceSyncingTest

* Use BelongsToMany as tenants() return type

* Fix code style (php-cs-fixer)

* Delete extra static property from trait

* Delete duplicate events/listeners from TSP stub

* Delete weird expectation,  use $model->trashed()

* Change ResourceUser to TenantUser

* Add defaults for getGlobalIdentifierKey(Name)

* Use singular tenant in DeleteResourceInTenants name

* Rename getSyncedCreationAttributes to getCreationAttributes

* Fix comma position in comment

* minor fixes in traits and interfaces

* Fix code style (php-cs-fixer)

* Correct comment

* Use $tenant->run()

* Update scopeGetModelQuery annotation

* Use static property for testing shouldSync

* Improve test

* Get rid of datasets

* Add trashed assertions

* Always merge synced attributes with the creation attributes during parsing

* Update creation attributes in test's beforeEach

* Use only the necessary creation attributes (no need to include the synced attributes because they get merged automatically)

* Rename ResourceTenant to MorphTenant

* Add TriggerSyncingEvents docblock

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>

* Add force deletes test

* Fix code style (php-cs-fixer)

* Delete pivot if it can't access the resource class

* Make parseCreationAttributes more readable

* Comment out setting $scopeGetModelQuery in the stub

* Add @var annotations to bootTriggerSyncingEvents

* Fix attach()/detach() exception test

* Interrupt creation of broken pivots instead of deleting the pivots at a later point

* Add more comments

* Update CreateTenantResource comment

* Assert that forceDelete() doesn't affect other tenant resources

* Rename test

* Correct with() array formatting

* Expand test with soft deletes

* Merge SyncedResourceSaved tests

* Improve naming, comments and minor details in the assertions

* Move test

* Fix failing test

* Delete duplicate test

* Minor test improvement

* Delete duplicate test

* Improve old test

* Minor test improvement

* Improve event test

* Improve tests (naming, code, comments)

* Delete extra test, add comments to the larger test

* Refactor central -> tenant attach() test

* Apply changes from central -> tenant attach() test on tenant -> central test

* Fix assertions in central -> tenant

* Correct comment and assertion

* Refactor tenant -> central attach() test

* Fix inconsistency

* Delete unused import

* Add comments

* Update polymorphic test names

* Rename polymorphic tests

* Update listener test name

* Delete redundant tenant ID assignments

* Improve test names

* Move polymorphic tests to ResourceSyncingTest

* Mention alternative solutions in CentralResourceNotAvailableInPivotException

* Add comments

* Update test comments

* minor changes to tests + review comments

* Delete extra tests, update comments

* Remove unneeded part of test

* Fix comment

* Improve comments

* Add test for companies() realationship accessibility

* Update test name

* Complete to-do, add comment

* Improve naming and comments (resolve some priority reviews)

* Move test

* Comment, resolve to-dos

* Add low-level pivot assertions

* Restore trashed resources if the central resource got restored, try improving tests

* Fix code style (php-cs-fixer)

* Dekete redundnat unsynced comments

* Add to-do, test WIP

* Fix restoring logic

* Update todo

* Add todo to fix phpdoc

* Fix code style (php-cs-fixer)

* PHPStan error fix wip

* Fix PHPStan error

* Add regression test

* Delete unused trait

* Add and test restoring WIP

* Fix code style (php-cs-fixer)

* Add to-do

* Delete comment from test

* Focus on restoring in the restore test

* Improve maming

* Fix stub

* Delete redundant part of test

* Delete incorrect test leftover

* Add triggerRestoredEvent

* Fix restore test

* Correct tests and restore(() logic

* Fix code style (php-cs-fixer)

* Check if SoftDeletes are used before firing SyncMasterRestored

* Fix comment

* Revert restore action changes (phpstan errors)

* Delete CascadeDeletes interface

* Remove CascadeDeletes from most of the tests

* Fix code style (php-cs-fixer)

* Rename tests

* Fix restoring + tests WIP

* Fix restoring

* Fix restoring tests

* Fix code style (php-cs-fixer)

* Test that detaching force deletes the tenant resources

* Implement cacscade force deleting

* Delete redundant changes

* Fix typo

* Fix SyncMaster

* Improve test

* Add force deleting logic back and fix tests

* Improve comment

* Delete extra assertion

* Improve restoring test

* Simplify assertion

* Delete redundant query scoping from test

* Test restore listener queueing

* use strict in_array() checks

* fix phpstan errors

---------

Co-authored-by: lukinovec <lukinovec@gmail.com>
Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2024-02-10 19:08:37 +01:00
Abrar Ahmad
1d0ca27bc8
Central routes without Route::domain(), configurable tenant/central routes by default for domain/subdomain identification, allow accessing central routes in early identification for path & request data middleware (#3)
* Update url binding bootstrapper test

* Fix parent::temporarySignedRoute() call

* Add universal route tests for all identification types

* Improve determineContextFromRequest()

* Add setting `TenancyUrlGenerator::$prefixRouteNames` to true in TSP stub

* Delete seemingly redundant test (making one route universal won't make all routes universal in any case)

* Use collection syntax in ReregisterUniversalRoutes

* Improve comments

* Add domain identification MW annotation

* Update condition in GloballyUsable

* Set `tenancy.bootstrappers` instead of adding the bootstrappers using `tenancy.bootstrappers.x`, move test

* Revert GloballyUsable condition change

* Delete assigning bootstrappers to tenancy.bootstrappers.x

* Exclude cache prefixing bootstrapper from the initial configuration

* Fix test

* Unset bypass parameter

* Set static kernel identification-related properties in TestCase

* Update bootstrapper name in annotation

* Move unset() into a condition

* Update TenancyUrlGenerator condition

* Set static properties without instantiating Tenancy

* Fix unsetting bypass parameter

* formatting changes

* add a comment

* improve docblock

* add docblock to TenancyUrlGenerator [ci skip]

* docblock changes [ci skip]

* Update TenancyUrlGenerator (rename variable, allow bypassing prefixing temporarySignedRoute name)

* Improve determineContextFromRequest

* Only return the new url generator instance when extending 'url' in UrlBindingBootstrapper

* Check route's MW groups for the path ID MW

* Remove extra imports from config

* Rename MiddlewareContext to Context, add condition for skipping ID MW

* Set only the needed bootstrappers in TestCase

* Fix code style (php-cs-fixer)

* Remove condition

* Use correct return type

* Fix PHPStan issue

* Update comment

* Check for tenant parameter instead of prefix

* Update shouldBeSkipped condition for universal routes

* Don't remove the 'universal' MW group after route re-registration, update test

* Fix code style (php-cs-fixer)

* Fix typo

* Add test for mixing placement of access prevention and identification MW

* Add test for mixing placement of access prevention and identification MW

* Update docblock

* Add setting the session and key resolvers in UrlBindingBootstrapper (required with LW file uploads)

* Update stub

* Update variable name in route reregistering action

* Add trailing comma

* Fix code style (php-cs-fixer)

* Require routes using path identification to be flagged as tenant in order to be recognized as tenant routes

* Add tenant flag while re-registering routes

* Update determineContextFromRequest condition (wip)

* Fix code style (php-cs-fixer)

* Update the middleware context logic so that universal routes have to be flagged as tenant instead of just having ID MW

* Update path identification condition

* Fix re-registering the LW localized route (add 'tenant' MW)

* Update docblock

* Simplify LW route re-registration

* Add comment

* Update comment

* Simplify determineContextFromRequest, add comment

* Improve stub

* Add skipRoute method + test

* Fix typo

* Update assets/TenancyServiceProvider.stub.php

* Update src/Concerns/DealsWithEarlyIdentification.php

* Fix typo

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>

* Improve comment

* Update test structure

* Restructure Fortify test

* code style

* Fix typo

* Update ReregisterUniversalRoutes annotation

* Only prefix route  name if it wasn't already prefixed

* Add todo@docs

* Delete `Tenancy::$kernelAccessPreventionSkipped` and related logic

* Delete test tenant cleanup

* Test MW group unpacking, restructure and improve test

* Test that tenancy isn't initialized after visiting a central route with the tenant parameter

* Delete "in both central and tenant contexts" from test names

* Test that re-registering works with controllers too

* Set misc route properties during re-registering

* Determine context instead of guessing, update universal route tests

* Use randomly generated tenant ID instead of hardcoding `acme`

* Remove setting route validators

* Rename and update determine context method, add comments

* Update ForgetTenantParameter annotation

* Add comment

* Delete comment, delete variable assignment

* Update early domain identification test

* Improve domain identification tests (test defaulting accurately)

* Improve readability

* Simplify domain early ID test

* Use randomly generated tenant instead of 'acme'

* Simplify request data ID test, use random tenant instead of 'acme'

* Simplify defaulting domain identification test

* Use RouteFacade alias for the Route facade, improve test code

* Add defaulting to the request data and path ID tests

* Merge path identification tenant parameter removal tests, clean up

* Correct wording

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>

* Delete debugging things from UniversalRouteTest

* Update annotation

* Add `// Creates a matrix`

* Improve comment wording

* Add MiddlewareUsableWithUniversalRoutes, refactor code accordingly

* Fix code style (php-cs-fixer)

* Delete debugging leftovers

* Delete unused import

* Update universal route GloballyUsable condition

* Don't implement the universal route interface in access prevention MW

* Check if request host is in the central domains in domain ID MW

* Test universal routes with domain identification without access prevent MW

* Test that universal routes work only with identification MW implementing the universal route interface

* Fix code style (php-cs-fixer)

* Rename GloballyUsable to UsableWithEarlyIdentification

* Fix annotation

* Update requestHasTenant annotations

* Update comment

* Add `with()` comments

* Add with() comments where missing

* Rename interface, update/add comments

* Rename exception, update its default message

* Fix code style (php-cs-fixer)

* Fix interface name

* Delete redundant code from subdomain ID MW

* Change domainOrSubdomain ID MW so that instead of passing the identification to other MWs, it happens in the domainOrSubdomain MW

* Test domainOrSubdomain identification with universal routes

* Fix code style (php-cs-fixer)

* Rename universal routes interface

* Fix code style (php-cs-fixer)

* Try explaining forgetting the tenant parameter better

* update interface name reference

* uncouple example from query parameters

* Update ForgetTenantParameter.php

* Update ForgetTenantParameter annotation

* Check both routeHasMiddleware and routeHasIdentificationMiddleware in the route MW detection test

* Hardcode tenant subdomain

* Delete redundant event listening code

* Delete unused imports

* Delete misuse of `tenancy()->getMiddlewareContext()` from conditions

* Delete unused variable

* Update comment

* Correct request data identification test (defaulting)

* Fix defaulting in path id test

* Move default route context configuration in domian id test

* Rename and update the tenant parameter test

* Delete extra tenant parameter test

* Use `tenant-domain.test` instead of `127.0.0.2`

* Add `default_to_universal_routes` config key

* Deal with defaulting to universal routes in the reregistering action

* Update logic to make defaulting to universal routes possible

* Test defaulting to universal routes

* Fix code style (php-cs-fixer)

* Delete extra tests

* Delete "without access prevention" from datasets

* Add defaulting to universal routes to datasets

* Override universal flag by central/tenant flag

* Add universal flag overriding test

* Update "a route can be universal in both route modes" so that the name corresponds with the tested thing

* Ignore the PHPStan error

* Reset `InitializeTenancyByPath::$onFail` in PathIdentificationTest

* Simplify expression

* Use 'Tenancy (not) initialized.' in instead of `tenant()?->getTenantKey()` for better assertions

* Properly test removing tenant parameter

* Reset static properties in tests

* Correct comments in EarlyIdentificationTest

* Add comment

* Add detail to annotation

* Throw exception if payload isn't string or null in request data ID MW

* Fix code style (php-cs-fixer)

* Delete static `$kernelIdentificationSkipped` property, use `$request->attributes` instead

* Use 'default_route_mode' instead of 'default_to_tenant/universal_routes'

* Fix code style (php-cs-fixer)

* Make path identification MW, tenantParameterName and tenantRouteNamePrefix configurable in ReregisterUniversalRoutes

* Delete unused import

* Add `$passTenantParameterToRoute` to TenancyUrlGenerator

* Use `$passTenantParameterToRoute` in BootstrapperTest

* Bypass tenant parameter passing

* Improve TenancyUrlGenerator so that both ID methods work

* Fix code style (php-cs-fixer)

* Improve TenancyUrlGenerator readability

* Add modifyBehavior() to TenancyUrlGenerator

* Fix code style (php-cs-fixer)

* Improve comment

* Toggle route name prefixing in path/request data ID MW (route-level identification)

* Fix code style (php-cs-fixer)

* Add path identification MW config key, add `getTenantParameterName()` to ForgetTenantParameter

* Fix code style (php-cs-fixer)

* Fix modifyBehavior and routeBehaviorModificationBypassed

* Add type to `$parameters` parameter

* Split modifyBehavior into two methods, don't pass name and parameters by reference

* Update UrlBindingBootstrapper annotation

* Correct naming in tests (request data -> query string identification)

* Add info to annotation

* Pass arrays to the behavior modification methods instead of `mixed`

* Fix default value of static property in Fortify bootstrapper

* Fix code style (php-cs-fixer)

* Correct annotation

* Enable prefixing routes directly using path identification MW

* Test re-registration of routes with path ID MW

* Prefix names of routes directly using path ID MW

* Fix code style (php-cs-fixer)

* Add Livewire v3 integration example to TSP stub

* Prefix route name only if it's not prefixed already

* Rename ReregisterUniversalRoutes to ReregisterRoutesAsTenant

* Fix code style (php-cs-fixer)

* Improve ReregisterRoutesAsTenant

* Add/update TenancyUrlGenerator docblocks

* Update action name in comments/test names

* Update reregister action annotation

* Delete unused imports

* Improve comments

* Make method protected

* Improve TenancyUrlGenerator code

* Test bypass parameter removal

* Fix comment

* Update annotation

* Improve shouldReregisterRoute

* Fix typo, delete redundant comment

* Improve skipRoute

* Improve shouldBeSkipped

* Add and test `$passTenantParameterToRoutes`

* add a comment

* Fix typo in comment

* Pass array as $parameters in prepareRouteInputs

* Make path_identification_middleware an array

* Fix code style (php-cs-fixer)

* Fix ReregisterRouteAsTenant

* Move tenantParameterName and tenantRouteNamePrefix getting to PathIdentificationManager

* Make PathIdentificationManager properties `Closure|null`

* Fix code style (php-cs-fixer)

* Fix PathIdentificationManager

* Update comments

* Use foreach for dataset definition

* Extract repetitive inGlobalStack and routeHasMiddleware calls

* Refactor PathIdentificationManager

* Update TenancyUrlGenerator annotation

* Add $skippedRoutes, refactor ReregisterRoutesAsTenant

* Improve reregisterRoute

* Update re-register action annotation

* update test name

* Make PathIdentificationManager methods static again, update comments

* Add test comment

* Update ForgetTenantParameter annotation

* Improve route re-registration condition, add comment

* Change "re-register" to "clone"

* minor code improvements

---------

Co-authored-by: lukinovec <lukinovec@gmail.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2023-08-03 00:23:26 +02:00
Abrar Ahmad
758fbc8a75
Use polymorphic table for mapping resources to tenants (#997)
* wip

* Fix code style (php-cs-fixer)

* adjust tests

* Update ResourceSyncingPolymorphicTest.php

* Update SyncMaster.php

* correct method name

* Update ResourceSyncingPolymorphicTest.php

* use BelongsToMany return type

* separate pivot model for each approach

* ability to publish migrations

* remove unsed import

* use resource migrations from asset

* anonymous migration for `tenant_resources` table

* rename file

* rename classes

* trait

* add back using statement

* revert to unset change

* use unset approach

* use unset approach

* Assert `tenants` are accessible

* Update ResourceSyncingUsingPolymorphicTest.php

* improve `tenants` assertions

* improve assertions

* remove `getResourceTenantModelName` method and use config

* use `BelongsToMany` for `tenants` method return type

* Fix code style (php-cs-fixer)

* revert type

* use correct key

* test right resources are accessible from the tenant

* Update tests/ResourceSyncingUsingPolymorphicTest.php

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2023-02-02 06:39:35 +01:00
Abrar Ahmad
ea3e44576f
[4.x] Resource syncing improvements (#992)
* Update TenantSyncingTest.php

* Update ResourceSyncingTest.php

* rename UserTenant to ResourceTenant

* Revert "rename UserTenant to ResourceTenant"

This reverts commit f9ba778e1b.

* rename TenantUser class

* return style

* Update ResourceSyncingTest.php

* revert return style

* Update ResourceSyncingTest.php
2022-11-09 13:00:54 +01:00
Abrar Ahmad
22d1b2065b
[4.x] Add feature to ignore the resource synchronization based on provided condition. (#993)
* wip

* add test

* readability

* remove group

* DisabledSync -> ConditionalSync; test both cases with dataset

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-11-04 15:04:29 +01:00
Abrar Ahmad
77c5ae1f32
[4.x] Configure attributes for synced resources when creating models (#915)
* configure attributes for creating resource

* Update ResourceSyncingTest.php

* Update ci.yml

* Update ResourceSyncingTest.php

* Update ci.yml

* cs

* comments

* Update tests/ResourceSyncingTest.php

Co-authored-by: Samuel Štancl <samuel@archte.ch>

* improve comments, move method to `SyncMaster` interface

* Revert "improve comments, move method to `SyncMaster` interface"

This reverts commit 5ddd50deb9.

* Update ResourceSyncingTest.php

* Update ResourceSyncingTest.php

* update comment

* Update ResourceSyncingTest.php

* Update ResourceSyncingTest.php

* wip

* wip

* wip

* add a todo

* assert that creation attributes returns null

* classes at the end

* rename method to `getAttributesForCreation`

* Update ResourceSyncingTest.php

* update comments

* Fix little grammer

* merge default values with sync attributes and tests

* Update ResourceSyncingTest.php

* method rename

* method rename

* Update ResourceSyncingTest.php

* comments

* Update ResourceSyncingTest.php

* allow defining a mix of attribute names and default values

* add test

* code improvements

* Fix code style (php-cs-fixer)

* remove unused import

* fix all phpstan issues in resource syncing code

* Fix code style (php-cs-fixer)

* wip

* improve tests

* Update ResourceSyncingTest.php

* better names

* Update UpdateSyncedResource.php

* code style

* Update UpdateSyncedResource.php

* add comments above new tests

* methods dockblocks and correct names

* Update ResourceSyncingTest.php

* update comments

* remove different schema setup

* delete custom migrations

* self review

* grammar, code style

* refactor helpers for creating tenants

Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2022-11-03 17:51:29 +01:00
Samuel Štancl
8af354c20e get phpstan errors down from 252 to 189 2022-08-30 05:44:23 +02:00
Samuel Štancl
40bf28c7d0 general refactor, move more classes under Database namespace 2022-08-27 03:17:16 +02:00
Samuel Štancl
f9c9d8615f Refactor tests to use pest() helper 2022-07-23 01:16:50 +02:00
Samuel Štancl
b47c5549ef
[4.x] Migrate tests to Pest (#884)
* Add Pest dependencies

* Add base Pest file

* Convert test cases

* Remove non-compound imports

* Adopt expectation API

* Optimize uses

* Shift cleanup

* phpunit -> pest

* Fix tests in PR #884 PHPUnit to Pest Converter  (#885)

* fixed tests, remove method duplications, restore necessary inner classes

* Update CommandsTest.php

* temporary checks run on `shift-64622` on branch.

* fixed `TestSeeder` class not resolved

* fixed messed up names

* removed `uses` from individual files and add it in `Pest`

* extract tests to helpers

* use pest dataset

* Update AutomaticModeTest.php

* newline

* todo convention

* resolve reviews

* added `// todo@tests`

* remove shift branch from CI workflow

Co-authored-by: Samuel Štancl <samuel@archte.ch>

* check if I have write permission

* Convert newly added tests to Pest

Co-authored-by: Shift <shift@laravelshift.com>
Co-authored-by: Abrar Ahmad <abrar.dev99@gmail.com>
2022-07-22 19:26:59 +02:00
Abrar Ahmad
97ab483173
Completing PR #881 (#902)
* install PHP CS Fixer

* Fix styling

* remove StyleCI config

* use config from archtechx/template

* Fix styling

* added `php-cs-fixer`

* Update .php-cs-fixer.php

* added GitHub token

* Update ci.yml

* Update ci.yml

* Update ci.yml

* php-cs-fixer workflow same as template

Co-authored-by: Erik Gaal <me@erikgaal.nl>
Co-authored-by: erikgaal <erikgaal@users.noreply.github.com>
2022-07-20 15:28:45 +02:00
Samuel Štancl
e93e766f92 Remove unnecessary typehints 2020-06-08 21:35:41 +02:00
Samuel Štancl
6735d0a589 Switch to using MySQL for tests, resolve FK constraint issues 2020-06-07 10:28:55 +02:00
Samuel Štancl
da23662d7b Clenup for resource syncing 2020-06-01 09:51:22 +02:00
stancl
6955512a6b Apply fixes from StyleCI 2020-05-22 09:01:31 +00:00
Samuel Štancl
15a7e52208 Get rid of tenant DB manager connection config 2020-05-21 14:47:29 +02:00
Samuel Štancl
1833622170 Extract JobPipelines to a separate package 2020-05-15 18:26:08 +02:00
Samuel Štancl
1a8d150f2c Change bootstrappers namespace 2020-05-13 18:19:59 +02:00
Samuel Štancl
de53b81c0e Change default tenant model, write more tests, cleanup 2020-05-13 06:23:41 +02:00
Samuel Štancl
c32f229dd5 Refactor more old code and get tests to pass 2020-05-13 04:51:37 +02:00
Samuel Štancl
c5377a16f7 Move resource sharing test to original namespace 2020-05-13 00:34:55 +02:00
Renamed from tests/v3/ResourceSyncingTest.php (Browse further)