test: add ShareLinkTest + PureLogicTest (TDD), fix coverMap undefined in SearchController

This commit is contained in:
Pontoporeia
2026-05-08 10:56:27 +02:00
parent 15d54fa19e
commit 6ba13e00ea
16 changed files with 1274 additions and 68 deletions

View File

@@ -0,0 +1,46 @@
<?php
/**
* language-autre-fragment.php
*
* HTMX fragment: returns the "Autre(s) langue(s)" input row when no standard
* language checkbox is checked, or an empty hidden placeholder when at least
* one is checked.
*
* Expected POST:
* languages[] — selected language IDs (may be absent)
* language_autre — current free-text value (for repopulation)
*/
require_once __DIR__ . '/../bootstrap.php';
$selectedIds = isset($_POST['languages']) && is_array($_POST['languages'])
? $_POST['languages']
: [];
$currentValue = htmlspecialchars(trim($_POST['language_autre'] ?? ''));
$anyChecked = !empty($selectedIds);
?>
<div id="language-autre-row">
<?php if (!$anyChecked): ?>
<div>
<label for="language_autre">Autre(s) langue(s) : <span class="asterisk">*</span></label>
<div>
<input type="text"
id="language_autre"
name="language_autre"
value="<?= $currentValue ?>"
required>
<small>Si votre TFE contient une langue absente de la liste, précisez-la ici.</small>
</div>
</div>
<?php else: ?>
<div>
<label for="language_autre">Autre(s) langue(s) :</label>
<div>
<input type="text"
id="language_autre"
name="language_autre"
value="<?= $currentValue ?>">
<small>Si votre TFE contient une langue absente de la liste, précisez-la ici.</small>
</div>
</div>
<?php endif; ?>
</div>