name); $en_meta = get_term_meta($articles->term_id, 'titre_anglais', true); check('EN = titre_anglais ou fallback', thalim_cat_name($articles, 'en'), $en_meta ?: $articles->name); check('valeur non-term', thalim_cat_name('Texte brut'), 'Texte brut'); echo "== thalim_format_date ==\n"; check('date vide', thalim_format_date(''), ''); check('0000-00-00', thalim_format_date('0000-00-00 00:00:00'), ''); check('format Y', thalim_format_date('2026-03-15 00:00:00', 'fr', 'Y'), '2026'); check('format Y-m-d', thalim_format_date('2026-03-15 10:30:00', 'fr', 'Y-m-d'), '2026-03-15'); echo "== config (résolution par slug) ==\n"; check('cat seance', thalim_cat_id('seance'), 12); check('cat non-classe', thalim_cat_id('non-classe'), 31); check('cat vie-du-labo', thalim_cat_id('vie-du-labo'), 9); check('cat publications', thalim_cat_id('publications'), 4); check('cat message-labo', thalim_cat_id('message-labo'), 268); check('clé inconnue', thalim_cat_id('nexiste-pas'), 0); check('slug inexistant', thalim_term_id_by_slug('slug-bidon-xyz'), 0); check('rôles exclus', thalim_excluded_role_ids(), [600, 598]); echo "== thalim_get_active_pinned_ids ==\n"; check('catégorie 0 → []', thalim_get_active_pinned_ids(0), []); echo "== thalim_get_seance_parent_id ==\n"; global $wpdb; $seance_id = (int) $wpdb->get_var( "SELECT tr.object_id FROM {$wpdb->term_relationships} tr JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id JOIN {$wpdb->posts} p ON p.ID = tr.object_id WHERE tt.term_id = 12 AND p.post_status = 'publish' LIMIT 1" ); if ($seance_id) { $parent = thalim_get_seance_parent_id($seance_id); check('séance a un parent publié', $parent > 0, true); check('lien = parent + ancre', thalim_get_seance_link($seance_id), get_permalink($parent) . '#seance-' . $seance_id); } else { echo " skip aucune séance publiée en base\n"; } check('séance inexistante → 0', thalim_get_seance_parent_id(999999999), 0); echo "\n$count tests, $failures échec(s)\n"; exit($failures ? 1 : 0);