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

19 commits

Author SHA1 Message Date
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)