diff --git a/src/TenancyBootstrappers/FilesystemTenancyBootstrapper.php b/src/TenancyBootstrappers/FilesystemTenancyBootstrapper.php index 60f98d30..b16c5ce4 100644 --- a/src/TenancyBootstrappers/FilesystemTenancyBootstrapper.php +++ b/src/TenancyBootstrappers/FilesystemTenancyBootstrapper.php @@ -11,11 +11,11 @@ use Stancl\Tenancy\Tenant; class FilesystemTenancyBootstrapper implements TenancyBootstrapper { - protected $originalPaths = []; - /** @var Application */ protected $app; + protected $originalPaths = []; + public function __construct(Application $app) { $this->app = $app; diff --git a/src/TenancyBootstrappers/RedisTenancyBootstrapper.php b/src/TenancyBootstrappers/RedisTenancyBootstrapper.php index be758e2c..0d5f88fe 100644 --- a/src/TenancyBootstrappers/RedisTenancyBootstrapper.php +++ b/src/TenancyBootstrappers/RedisTenancyBootstrapper.php @@ -11,8 +11,8 @@ use Stancl\Tenancy\Tenant; class RedisTenancyBootstrapper implements TenancyBootstrapper { - /** @var string[string] Original prefixes of connections */ - protected $originalPrefixes = []; + /** @var array Original prefixes of connections */ + public $originalPrefixes = []; /** @var Application */ protected $app; diff --git a/src/TenancyServiceProvider.php b/src/TenancyServiceProvider.php index 860c79c6..8656df72 100644 --- a/src/TenancyServiceProvider.php +++ b/src/TenancyServiceProvider.php @@ -46,9 +46,6 @@ class TenancyServiceProvider extends ServiceProvider return $this; }); - $this->app['url']->macro('getForcedRoot', function () { - return $this->forcedRoot; - }); } /** diff --git a/src/helpers.php b/src/helpers.php index 56065811..2049e9fe 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -30,12 +30,11 @@ if (! \function_exists('tenant')) { if (! \function_exists('tenant_asset')) { function tenant_asset($asset) { - return route('stancl.tenancy.asset', ['asset' => $asset]); + return route('stancl.tenancy.asset', ['path' => $asset]); } } if (! \function_exists('global_asset')) { - // todo test this function global_asset($asset) { return app('globalUrl')->asset($asset); diff --git a/tests/TenantAssetTest.php b/tests/TenantAssetTest.php index 66e00cc8..a3081cc0 100644 --- a/tests/TenantAssetTest.php +++ b/tests/TenantAssetTest.php @@ -14,8 +14,8 @@ class TenantAssetTest extends TestCase /** @test */ public function asset_can_be_accessed_using_the_url_returned_by_the_tenant_asset_helper() { - Tenant::create('foo.localhost'); - tenancy()->init('foo.localhost'); + Tenant::create('localhost'); + tenancy()->init('localhost'); $filename = 'testfile' . $this->randomString(10); \Storage::disk('public')->put($filename, 'bar'); @@ -23,8 +23,10 @@ class TenantAssetTest extends TestCase // response()->file() returns BinaryFileResponse whose content is // inaccessible via getContent, so ->assertSee() can't be used - $this->get(tenant_asset($filename))->assertSuccessful(); $this->assertFileExists($path); + $response = $this->get(tenant_asset($filename)); + + $response->assertSuccessful(); $f = fopen($path, 'r'); $content = fread($f, filesize($path));