refactor(tenants): remove general write endpoints

This commit is contained in:
2026-09-21 15:18:48 -03:00
parent fcb8386735
commit f4de2ff5b2
15 changed files with 40 additions and 1608 deletions

View File

@@ -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));
}
}
}