1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 17:44:04 +00:00
tenancy/tests/FacadeTest.php
Samuel Štancl 3bb2759fe2
[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
2020-05-03 18:12:27 +02:00

36 lines
862 B
PHP

<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Tenancy;
use Tenant;
class FacadeTest extends TestCase
{
public $autoCreateTenant = true;
public $autoInitTenancy = true;
/** @test */
public function tenant_manager_can_be_accessed_using_the_Tenancy_facade()
{
$this->assertSame(tenancy()->getTenant(), Tenancy::getTenant());
}
/** @test */
public function tenant_storage_can_be_accessed_using_the_Tenant_facade()
{
tenant()->put('foo', 'bar');
Tenant::put('abc', 'xyz');
$this->assertSame('bar', Tenant::get('foo'));
$this->assertSame('xyz', Tenant::get('abc'));
}
/** @test */
public function tenant_can_be_created_using_the_Tenant_facade()
{
$this->assertSame('bar', Tenant::create(['foo.localhost'], ['foo' => 'bar'])->foo);
}
}