refactor(tenants): remove general write endpoints
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Tests\Feature\Tenant;
|
||||
|
||||
use App\Domains\Core\Bootstrap\Controllers\TenantBootstrapController;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
||||
use Tests\TestCase;
|
||||
|
||||
class TenantBootstrapRouteTest extends TestCase
|
||||
@@ -16,4 +17,24 @@ class TenantBootstrapRouteTest extends TestCase
|
||||
|
||||
$this->assertSame(TenantBootstrapController::class, $route->getActionName());
|
||||
}
|
||||
|
||||
public function test_tenant_creation_and_update_routes_are_not_available(): void
|
||||
{
|
||||
$routes = app('router')->getRoutes();
|
||||
$this->assertNull($routes->getByName('tenants.store'));
|
||||
$this->assertNull($routes->getByName('tenants.update'));
|
||||
|
||||
foreach ([['POST', '/api/tenants'], ['PUT', '/api/tenants/demo'], ['PATCH', '/api/tenants/demo']] as [$method, $uri]) {
|
||||
try {
|
||||
$routes->match(Request::create($uri, $method));
|
||||
$this->fail("Unexpected route: {$method} {$uri}");
|
||||
} catch (MethodNotAllowedHttpException $exception) {
|
||||
$this->assertSame(405, $exception->getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
foreach (['tenants.index', 'tenants.show', 'tenants.destroy'] as $name) {
|
||||
$this->assertNotNull($routes->getByName($name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user