Update views and related controllers

This commit is contained in:
DariusIII
2026-07-10 21:31:19 +02:00
parent 81d60db201
commit f6c18cdeac
40 changed files with 1303 additions and 1178 deletions
@@ -141,6 +141,29 @@ class AdminContentControllerTest extends TestCase
$this->assertSame('/about/', $content->url);
}
public function test_content_page_accepts_string_content_id_from_query(): void
{
$user = $this->createUserWithRole('User');
/** @var Authenticatable $authenticatedUser */
$authenticatedUser = $user;
$content = $this->createContent([
'title' => 'Useful Content',
'body' => '<p>Visible body.</p>',
'contenttype' => Content::TYPE_USEFUL,
'status' => Content::STATUS_ENABLED,
'role' => Content::ROLE_LOGGED_IN,
]);
$response = $this->actingAs($authenticatedUser)->get(route('content', [
'id' => (string) $content->id,
'page' => 'content',
]));
$response->assertOk();
$response->assertSee('Useful Content');
}
public function test_create_form_marks_title_as_optional(): void
{
$admin = $this->createUserWithRole('Admin');
@@ -306,17 +306,17 @@ class AdminReleaseReportControllerTest extends TestCase
{
$detailsControllerPath = app_path('Http/Controllers/DetailsController.php');
$detailsViewPath = resource_path('views/details/index.blade.php');
$browseViewPath = resource_path('views/browse/index.blade.php');
$releaseResultsComponentPath = resource_path('views/components/release-results.blade.php');
$browseServicePath = app_path('Services/Releases/ReleaseBrowseService.php');
$this->assertFileExists($detailsControllerPath);
$this->assertFileExists($detailsViewPath);
$this->assertFileExists($browseViewPath);
$this->assertFileExists($releaseResultsComponentPath);
$this->assertFileExists($browseServicePath);
$detailsController = file_get_contents($detailsControllerPath);
$detailsView = file_get_contents($detailsViewPath);
$browseView = file_get_contents($browseViewPath);
$releaseResultsComponent = file_get_contents($releaseResultsComponentPath);
$browseService = file_get_contents($browseServicePath);
$this->assertStringContainsString('publicReportResponses', $detailsController);
@@ -330,7 +330,7 @@ class AdminReleaseReportControllerTest extends TestCase
$this->assertStringContainsString('all_report_reasons', $browseService);
$this->assertStringContainsString('report_response_count', $browseService);
$this->assertStringContainsString('response_is_public = 1', $browseService);
$this->assertStringContainsString('Original report:', $browseView);
$this->assertStringContainsString('Staff response available on release details', $browseView);
$this->assertStringContainsString('Original report:', $releaseResultsComponent);
$this->assertStringContainsString('Staff response available on release details', $releaseResultsComponent);
}
}