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

411 commits

Author SHA1 Message Date
lukinovec
8f5a4e4eb6 Use $addTags approach again 2023-04-20 15:49:17 +02:00
lukinovec
53b2181779 Clean up global state (static properties) in before/afterEach 2023-04-19 13:37:06 +02:00
lukinovec
52d10d36f9 Prefix both drivers by default, add assertions for the second driver where missing 2023-04-19 10:30:09 +02:00
lukinovec
2171ca9c68 Override cache manager only in CacheTagsBootstrapper 2023-04-19 09:37:10 +02:00
lukinovec
1d52096d6e Delete cache.default assertion 2023-04-19 08:35:36 +02:00
lukinovec
4d387188c5 Inline variable & config key assignment 2023-04-18 16:10:47 +02:00
lukinovec
cb07a47f18 Change setting to assertion, add comment 2023-04-18 15:05:37 +02:00
lukinovec
b5abe6ef0f Use tenancy.cache.manager config instead of Stancl\Tenancy\CacheManager 2023-04-18 14:39:35 +02:00
lukinovec
4b862e2bd6 Delete redundant config put calls 2023-04-18 14:27:57 +02:00
lukinovec
f7c8f226c3 Add assertions + comment 2023-04-18 14:20:21 +02:00
lukinovec
c0e2926905 Update comment 2023-04-18 09:49:44 +02:00
lukinovec
46f94d15a5 Extract duplicate assertions into a closure 2023-04-18 09:42:43 +02:00
lukinovec
e4a4940e59 Update comments 2023-04-18 09:25:31 +02:00
lukinovec
835b169d60 Update defaulting test 2023-04-18 08:53:33 +02:00
lukinovec
ca907e68be Improve tests 2023-04-17 18:00:03 +02:00
lukinovec
2309b83327 Improve test name 2023-04-17 17:05:03 +02:00
lukinovec
b4f4fd1d94 Fix formatting 2023-04-17 17:00:28 +02:00
lukinovec
4c9cb7cf51 Merge the tenantCacheStores tests 2023-04-17 17:00:15 +02:00
lukinovec
9925e49112 Assert that cache is null from the beginning 2023-04-17 15:11:30 +02:00
lukinovec
90684a7d92 Add re-initialization cache assertion 2023-04-17 15:10:06 +02:00
lukinovec
bd41ae4fe5 Delete TTL from cache put calls 2023-04-17 15:06:22 +02:00
lukinovec
ce43384537 Refactor assertions 2023-04-17 14:54:45 +02:00
lukinovec
d84878bd45 Refactor assertion 2023-04-17 14:51:52 +02:00
lukinovec
859b2c534a Add assertion 2023-04-17 14:49:23 +02:00
lukinovec
52d9643535 Update cache prefixing and tests 2023-04-17 14:34:54 +02:00
lukinovec
13b85a2d3b Set cache.default in beforeEach 2023-04-17 12:36:59 +02:00
lukinovec
0c1912b9c5 Small testing improvements 2023-04-14 12:33:08 +02:00
lukinovec
3481e24c7d Delete afterEach 2023-04-13 13:45:29 +02:00
lukinovec
dd57d9bbdc Simplify cache tests 2023-04-13 13:44:00 +02:00
lukinovec
9e15110ad9 Update cache tests so that both prefixing and tagging is covered 2023-04-13 13:36:58 +02:00
lukinovec
651302943f Correct $addTags reset in a test 2023-04-13 13:10:41 +02:00
lukinovec
740d4e78d8 Update prefix generator logic + tests 2023-04-13 12:46:33 +02:00
lukinovec
8ac4d87e94 Use a single original prefix 2023-04-13 07:47:18 +02:00
lukinovec
4ab692bb05 Rename bootstrapper 2023-04-13 07:07:11 +02:00
lukinovec
35b0dea270 Use $this->app instead of app() 2023-04-12 09:40:00 +02:00
lukinovec
39e62c7dcf Make original prefixes customizable 2023-04-12 08:23:31 +02:00
lukinovec
70051e70b3 Rename bootstrapper 2023-04-11 15:01:08 +02:00
lukinovec
7ebfc375d6 Disable cache tagging by default, add CacheTagBootstrapper 2023-04-11 14:28:28 +02:00
lukinovec
66669934f9 Reset static properties in afterEach 2023-03-31 14:11:45 +02:00
lukinovec
840cd831d6 Delete CacheTenancyBootstrapper 2023-03-31 14:10:56 +02:00
lukinovec
7bbd5350c7 Update tests 2023-03-31 09:20:10 +02:00
lukinovec
7b91e3fdec Test cache prefixing customization 2023-03-14 17:24:57 +01:00
lukinovec
9e8af40715 Test that non-default stores get prefixed too 2023-02-21 18:48:57 +01:00
lukinovec
249fc545d2
Merge branch 'master' into cache-prefix 2023-02-21 10:22:17 +01:00
lukinovec
e61a26d604
Add L10 support to 4.x (merge 3.x to master) (#1071)
* exclude master from CI

* Add space after 'up' in 'docker-compose up-d' (#900)

* Fix ArgumentCountError on the TenantAssetsController (#894)

* Fix ArgumentCount exception on the TenantAssetsController when no `$path` is provided

* CS

* CS

* Handle null case explicitly

* code style

Co-authored-by: Bram Wubs <bram@sibi.nl>
Co-authored-by: Samuel Štancl <samuel@archte.ch>

* Add support for nested tenant config override (#920)

* feat: add support for nested tenant config override

* test: ensure nested tenant values are mapped

* fix: typo mistake (#954)

* [3.x] Add Vite helper for tenancy (#956)

* Add Vite helper for tenancy

* Move Vite bundler to an Optional Feature

* Rename to foundation vite

* Add ViteBundlerTest

* Add missing end of file

* Update tests

* remove unnecessary end() call

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

* rewrite ViteBundlerTest to phpunit syntax

* skip vite test in Laravel < 9

* convert ViteBundler to PHP 7 syntax

* remove import of nonexistent class in older Laravel versions

* remove import of Foundation\Vite in tests

* try to exclude Vite.php from coverage report

* remove typehint

* update channel name

* Cache crash fix (#1048)

* Don't prevent accessing missing Tenant attributes. (#1045)

* [3.x] L10 compatibility (#1065)

* Bump dependencies for Laravel 10

* Update GitHub Actions for Laravel 10

* ci: do not test L10 using PHP 7.3

* drop < L9 support

* use `dispatch_sync` instead of `dispatch_now`

* migrate phpunit configuration

* Update ci.yml

* drop laravel < 9 support

* misc L10 fixes, new docker image

* specify odbc version

* wip

* properly list php versions as strings

* minor changes

* Add `getValue($queryGrammar)` to raw query

* Clean up `isVersion8` code

* rewrite hasFailed assertion

* phpunit schema update

* Upgrade `doctrine/dbal`

---------

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

* Update ci.yml

* Fix code style (php-cs-fixer)

* Update dependencies

* Change invade version

* Delete ViteBundlerTest

* Fix PHPStan error

* Delete PHPStan error ignore

* Fix CONTRIBUTING.md

* Delete ViteBundler remains

* Bring back ViteBundler

* Convert ViteBundlerTest to Pest

* Update ci.yml

---------

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: Bram Wubs <megawubs@users.noreply.github.com>
Co-authored-by: Bram Wubs <bram@sibi.nl>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: George Bishop <email.georgebishop@gmail.com>
Co-authored-by: Anbuselvan Rocky <15264938+anburocky3@users.noreply.github.com>
Co-authored-by: Wilsen Hernández <13445515+wilsenhc@users.noreply.github.com>
Co-authored-by: Joel Stein <joel@mediatrix.digital>
Co-authored-by: Guilherme Saade <saade@outlook.com.br>
Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2023-02-20 23:47:10 +01:00
lukinovec
d7a4982cd3
[4.x] Make broadcasting work with Tenancy (#1027)
* Add BroadcastTenancyBootstrapper and TenancyBroadcastManager

* Fix code style (php-cs-fixer)

* Bind original BroadcastManager again on `revert()`

* Fix code style (php-cs-fixer)

* Move manager to correct directory

* Fix property type

* Make BroadcastTenancyBootstrapper a singleton in tests

* Fix code style (php-cs-fixer)

* Bind the original broadcaster instance on `revert()`

* Instead of just forgetting the old broadcaster instance, bind the new one

* Add BroadcastTenancyBootstrapper tests

* Separate the test

* Fix code style (php-cs-fixer)

* Add bootstrapper test

* Add broadcaster channels test

* Clean up BootstrapperTest

* Fix BroadcastingTest

* Add comments to TenancyBroadcastManager

* Add BroadcastTenancyBootstrapper comments

* Simplify BroadcastManager extension, remove setDriver method

* Add comment

* Fix PHPStan errors

* Fix PHPStan errors

* Remove duplicate import

* Fix test

* Delete `::class` from test name

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

* Create databases for newly created tenants in BroadcastingTest

* move spatie/invade to require

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2023-02-18 15:52:55 +01:00
lukinovec
fbdb13f392
[4.x] Set app.url config in UrlTenancyBootstrapper (#1068)
* Set `app.url` config in UrlTenancyBootstrapper

* Add assertions

* Set base app URL in config

* Make UrlTenancyBootstrapper a singleton
2023-02-18 13:01:17 +01:00
lukinovec
617e9a7a73
[4.x] Allow user to customize tenant's URL root in CLI (#1044)
* Add UrlTenancyBootstrapper

* Fix code style (php-cs-fixer)

* Move URL overriding to a separate method, call it in `boot()`

* Test URL root overriding

* Change parameter formatting

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

* Fix code style (php-cs-fixer)

* Improve URL bootstrapper test

* Move `$scheme` and `$hostname` to the closure

* Update code example comment

* Hardcode values instead of referencing variables

* Delete extra line

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2023-02-17 10:56:43 +01:00
lukinovec
93aaba3e11 Merge branch 'master' of github.com:archtechx/tenancy into cache-prefix 2023-02-02 10:51:09 +01: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