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

Rewrite old tests

This commit is contained in:
Samuel Štancl 2020-05-12 23:22:40 +02:00
parent 64383b4c56
commit 89936187ce
71 changed files with 698 additions and 3203 deletions

View file

@ -6,13 +6,15 @@ namespace Stancl\Tenancy\Features;
use Illuminate\Http\RedirectResponse;
use Stancl\Tenancy\Contracts\Feature;
use Stancl\Tenancy\TenantManager;
use Stancl\Tenancy\Tenancy;
class CrossDomainRedirect implements Feature
{
public function bootstrap(TenantManager $tenantManager): void
public function bootstrap(Tenancy $tenancy): void
{
RedirectResponse::macro('domain', function (string $domain) {
/** @var RedirectResponse $this */
// replace first occurance of hostname fragment with $domain
$url = $this->getTargetUrl();
$hostname = parse_url($url, PHP_URL_HOST);

View file

@ -8,8 +8,9 @@ use Laravel\Telescope\IncomingEntry;
use Laravel\Telescope\Telescope;
use Stancl\Tenancy\Contracts\Feature;
use Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains;
use Stancl\Tenancy\TenantManager;
use Stancl\Tenancy\Tenancy;
// todo rewrite this
class TelescopeTags implements Feature
{
/** @var callable User-specific callback that returns tags. */
@ -22,7 +23,7 @@ class TelescopeTags implements Feature
};
}
public function bootstrap(TenantManager $tenantManager): void
public function bootstrap(Tenancy $tenancy): void
{
if (! class_exists(Telescope::class)) {
return;
@ -35,6 +36,7 @@ class TelescopeTags implements Feature
return $tags;
}
// todo lines below
$tenantRoute = PreventAccessFromTenantDomains::routeHasMiddleware(request()->route(), 'tenancy')
|| PreventAccessFromTenantDomains::routeHasMiddleware(request()->route(), 'universal');

View file

@ -6,9 +6,11 @@ namespace Stancl\Tenancy\Features;
use Illuminate\Contracts\Config\Repository;
use Stancl\Tenancy\Contracts\Feature;
use Stancl\Tenancy\Tenancy;
use Stancl\Tenancy\Tenant;
use Stancl\Tenancy\TenantManager;
// todo rewrite this
class TenantConfig implements Feature
{
/** @var Repository */
@ -30,7 +32,7 @@ class TenantConfig implements Feature
}
}
public function bootstrap(TenantManager $tenantManager): void
public function bootstrap(Tenancy $tenancy): void
{
$tenantManager->eventListener('bootstrapped', function (TenantManager $manager) {
$this->setTenantConfig($manager->getTenant());

View file

@ -10,6 +10,7 @@ use Stancl\Tenancy\Contracts\Feature;
use Stancl\Tenancy\Tenant;
use Stancl\Tenancy\TenantManager;
// todo rewrite this
class Timestamps implements Feature
{
/** @var Repository */