mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Remove duration_pages/duration_minutes/file_size_info; rename cc4r → cc2r in DB and code
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
* - autofocusFieldForError()
|
||||
* - detectFileType() — via subclass to access private
|
||||
* - generateAuthorSlug() — accent stripping, uppercase, underscore
|
||||
* - buildFileSizeInfo() — pages, minutes, annexes combinations
|
||||
*
|
||||
* ExportController:
|
||||
* - CSV_HEADERS count matches exportAllTheses() row width
|
||||
@@ -37,7 +36,6 @@ require_once APP_ROOT . '/src/Database.php';
|
||||
require_once APP_ROOT . '/src/RateLimit.php';
|
||||
require_once APP_ROOT . '/src/Controllers/TfeController.php';
|
||||
require_once APP_ROOT . '/src/Controllers/ThesisCreateController.php';
|
||||
require_once APP_ROOT . '/src/Controllers/ThesisEditController.php';
|
||||
require_once APP_ROOT . '/src/Controllers/SearchController.php';
|
||||
require_once APP_ROOT . '/src/Controllers/ExportController.php';
|
||||
|
||||
@@ -101,14 +99,6 @@ class ThesisCreateControllerTestable extends ThesisCreateController
|
||||
}
|
||||
}
|
||||
|
||||
class ThesisEditControllerTestable extends ThesisEditController
|
||||
{
|
||||
public function testBuildFileSizeInfo(array $post): string
|
||||
{
|
||||
return $this->buildFileSizeInfo($post);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Setup ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
echo "Pure Logic Unit Test\n";
|
||||
@@ -117,7 +107,6 @@ echo "====================\n\n";
|
||||
$db = Database::getInstance();
|
||||
$tfe = new TfeControllerTestable($db);
|
||||
$createCtrl = new ThesisCreateControllerTestable($db);
|
||||
$editCtrl = new ThesisEditControllerTestable($db);
|
||||
|
||||
try {
|
||||
|
||||
@@ -338,44 +327,10 @@ try {
|
||||
echo "\n";
|
||||
|
||||
// =========================================================================
|
||||
// SECTION C: ThesisEditController — buildFileSizeInfo
|
||||
// SECTION C: ExportController — CSV column count consistency
|
||||
// =========================================================================
|
||||
|
||||
echo "C1: buildFileSizeInfo — pages only\n";
|
||||
$info = $editCtrl->testBuildFileSizeInfo(['duration_pages' => '84', 'duration_minutes' => '']);
|
||||
plAssertEq('84 pages', $info, 'pages only');
|
||||
echo "\n";
|
||||
|
||||
echo "C2: buildFileSizeInfo — minutes only\n";
|
||||
$info = $editCtrl->testBuildFileSizeInfo(['duration_pages' => '', 'duration_minutes' => '32']);
|
||||
plAssertEq('32 minutes', $info, 'minutes only');
|
||||
echo "\n";
|
||||
|
||||
echo "C3: buildFileSizeInfo — pages + minutes\n";
|
||||
$info = $editCtrl->testBuildFileSizeInfo(['duration_pages' => '84', 'duration_minutes' => '32']);
|
||||
plAssertEq('84 pages + 32 minutes', $info, 'pages + minutes');
|
||||
echo "\n";
|
||||
|
||||
echo "C4: buildFileSizeInfo — annexes appended\n";
|
||||
$info = $editCtrl->testBuildFileSizeInfo(['duration_pages' => '50', 'duration_minutes' => '', 'has_annexes' => '1']);
|
||||
plAssertEq('50 pages + annexe(s)', $info, 'annexes appended');
|
||||
echo "\n";
|
||||
|
||||
echo "C5: buildFileSizeInfo — annexes only (no pages/minutes)\n";
|
||||
$info = $editCtrl->testBuildFileSizeInfo(['duration_pages' => '', 'duration_minutes' => '', 'has_annexes' => '1']);
|
||||
plAssertEq('Annexe(s)', $info, 'annexes only');
|
||||
echo "\n";
|
||||
|
||||
echo "C6: buildFileSizeInfo — empty fields = empty string\n";
|
||||
$info = $editCtrl->testBuildFileSizeInfo(['duration_pages' => '', 'duration_minutes' => '']);
|
||||
plAssertEq('', $info, 'empty when nothing set');
|
||||
echo "\n";
|
||||
|
||||
// =========================================================================
|
||||
// SECTION D: ExportController — CSV column count consistency
|
||||
// =========================================================================
|
||||
|
||||
echo "D1: ExportController — CSV_HEADERS count matches row column count\n";
|
||||
echo "C1: ExportController — CSV_HEADERS count matches row column count\n";
|
||||
$export = new ExportController($db);
|
||||
$rows = $export->exportAllTheses();
|
||||
$headerCount = count(ExportController::CSV_HEADERS);
|
||||
@@ -397,10 +352,10 @@ try {
|
||||
echo "\n";
|
||||
|
||||
// =========================================================================
|
||||
// SECTION E: SearchController — coverMap key always present (regression)
|
||||
// SECTION D: SearchController — coverMap key always present (regression)
|
||||
// =========================================================================
|
||||
|
||||
echo "E1: SearchController::handleSearch() — coverMap key always in return array\n";
|
||||
echo "D1: SearchController::handleSearch() — coverMap key always in return array\n";
|
||||
// Simulate $_GET for the method (it reads from $_GET directly via collectSearchParams)
|
||||
$_GET = ['query' => ''];
|
||||
$rateLimit = new RateLimit(1000, 60);
|
||||
|
||||
Reference in New Issue
Block a user