mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 11:34:03 +00:00
[2.2.0] [WIP] Add functionality (#206)
* TenantDatabaseDoesNotExistException * Apply fixes from StyleCI * User post-creation callbacks * Rename method * postCreationActions * pass $tenant as parameter * pass $tenant to async actions * WIP findBy() * findBy\* ForwardsCalls * Apply fixes from StyleCI * findBy DB storage driver * Redis SD TODO message * Apply fixes from StyleCI * Fix chained jobs * WIP event system * import str * instanceof closure check * findBy instead of find * Tenant -> Tenants * dots * Use DB hooks instead of a SC key * Don't allow callables for queue chain * CanDeleteKeys interface * Apply fixes from StyleCI * CanFindByAnyKey interface * Apply fixes from StyleCI * Ditch models for custom repositories * Resolve circular dependency * Apply fixes from StyleCI * Fix tests * Apply fixes from StyleCI * FutureTest * Prefix tenant events with 'tenant.' * Event listener arguments test
This commit is contained in:
parent
7389f44de9
commit
869ac32983
22 changed files with 654 additions and 254 deletions
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy\Tests;
|
||||
|
||||
use Stancl\Tenancy\StorageDrivers\Database\TenantModel;
|
||||
use Stancl\Tenancy\StorageDrivers\Database\TenantRepository;
|
||||
use Stancl\Tenancy\Tenant;
|
||||
|
||||
class TenantStorageTest extends TestCase
|
||||
|
|
@ -112,10 +112,11 @@ class TenantStorageTest extends TestCase
|
|||
}
|
||||
|
||||
/** @test */
|
||||
public function tenant_model_uses_correct_connection()
|
||||
public function tenant_repository_uses_correct_connection()
|
||||
{
|
||||
config(['database.connections.foo' => config('database.connections.sqlite')]);
|
||||
config(['tenancy.storage_drivers.db.connection' => 'foo']);
|
||||
$this->assertSame('foo', (new TenantModel)->getConnectionName());
|
||||
$this->assertSame('foo', app(TenantRepository::class)->database->getName());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
|
|
@ -156,6 +157,9 @@ class TenantStorageTest extends TestCase
|
|||
tenancy()->create(['foo.localhost']);
|
||||
tenancy()->init('foo.localhost');
|
||||
|
||||
tenant()->put('foo', '111');
|
||||
$this->assertSame('111', tenant()->get('foo'));
|
||||
|
||||
tenant()->put(['foo' => 'bar', 'abc' => 'xyz']);
|
||||
$this->assertSame(['foo' => 'bar', 'abc' => 'xyz'], tenant()->get(['foo', 'abc']));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue