1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 16:14:02 +00:00

[3.x] DB users (#382)

* Initial draft

* Apply fixes from StyleCI

* Use CI on master branch too

* Pass correct argument to queued DB creators/deleters

* Apply fixes from StyleCI

* Remove new interface from MySQLDBManager

* Make phpunit run

* Apply fixes from StyleCI

* Fix static property

* Default databaseName

* Use database transactions for creating users & granting permissions

* Apply fixes from StyleCI

* Get old tests to pass

* Apply fixes from StyleCI

* Add tests for PermissionControlledMySQLDatabaseManager

* Apply fixes from StyleCI

* Write test for extra config, fix bug with extra config

* Apply fixes from StyleCI
This commit is contained in:
Samuel Štancl 2020-05-03 18:12:27 +02:00 committed by GitHub
parent 60665517a0
commit 3bb2759fe2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 756 additions and 286 deletions

View file

@ -8,11 +8,10 @@ use Stancl\Tenancy\Tenant;
class CacheManagerTest extends TestCase
{
public $autoInitTenancy = false;
/** @test */
public function default_tag_is_automatically_applied()
{
$this->createTenant();
$this->initTenancy();
$this->assertArrayIsSubset([config('tenancy.cache.tag_base') . tenant('id')], cache()->tags('foo')->getTags()->getNames());
}
@ -20,6 +19,7 @@ class CacheManagerTest extends TestCase
/** @test */
public function tags_are_merged_when_array_is_passed()
{
$this->createTenant();
$this->initTenancy();
$expected = [config('tenancy.cache.tag_base') . tenant('id'), 'foo', 'bar'];
$this->assertEquals($expected, cache()->tags(['foo', 'bar'])->getTags()->getNames());
@ -28,6 +28,7 @@ class CacheManagerTest extends TestCase
/** @test */
public function tags_are_merged_when_string_is_passed()
{
$this->createTenant();
$this->initTenancy();
$expected = [config('tenancy.cache.tag_base') . tenant('id'), 'foo'];
$this->assertEquals($expected, cache()->tags('foo')->getTags()->getNames());
@ -36,6 +37,7 @@ class CacheManagerTest extends TestCase
/** @test */
public function exception_is_thrown_when_zero_arguments_are_passed_to_tags_method()
{
$this->createTenant();
$this->initTenancy();
$this->expectException(\Exception::class);
cache()->tags();
@ -44,6 +46,7 @@ class CacheManagerTest extends TestCase
/** @test */
public function exception_is_thrown_when_more_than_one_argument_is_passed_to_tags_method()
{
$this->createTenant();
$this->initTenancy();
$this->expectException(\Exception::class);
cache()->tags(1, 2);