From 7e3c810c853a0480b7335a9a542fef8d1052d6ca Mon Sep 17 00:00:00 2001 From: JamesRezo <james@rezo.net> Date: Wed, 26 Apr 2023 11:24:36 +0200 Subject: [PATCH] Merge spip/tests dans ./tests --- tests/.gitignore | 9 + tests/Makefile | 12 + tests/README.md | 58 + tests/bin/configure.php | 60 + tests/composer.json | 46 + tests/ecs.php | 21 + tests/index.php | 103 + tests/phpunit.xml.dist | 14 + tests/rector.php | 24 + tests/src/Constraint/IsOk.php | 41 + .../TemplateCompilationErrorException.php | 14 + .../Exception/TemplateNotFoundException.php | 14 + tests/src/SquelettesTestCase.php | 292 + tests/src/Template.php | 84 + tests/src/Template/Loader/ChainLoader.php | 71 + tests/src/Template/Loader/FileLoader.php | 41 + tests/src/Template/Loader/LoaderInterface.php | 14 + tests/src/Template/Loader/StringLoader.php | 106 + tests/src/Templating.php | 52 + tests/tests/Action/EditerLiensTest.php | 305 + tests/tests/Api/AutoriserTest.php | 39 + tests/tests/Api/data/autoriser.php | 33 + tests/tests/Config/DepotMetaPackTest.php | 217 + tests/tests/Config/DepotMetaPersoTest.php | 198 + tests/tests/Config/DepotMetaTest.php | 205 + tests/tests/Distant/NeedProxyTest.php | 65 + tests/tests/Distant/UrlToAsciiTest.php | 58 + .../tests/Distant/ValiderUrlDistanteTest.php | 87 + tests/tests/Filtre/AjouterClassTest.php | 54 + tests/tests/Filtre/AntispamTest.php | 26 + tests/tests/Filtre/AppliquerFiltreTest.php | 44 + tests/tests/Filtre/ChercherFiltreTest.php | 480 + tests/tests/Filtre/CommuterClassTest.php | 54 + .../tests/Filtre/CorrigerEntitesHtmlTest.php | 84 + tests/tests/Filtre/Date/AffdateCourtTest.php | 405 + .../tests/Filtre/Date/AffdateDebutFinTest.php | 279 + tests/tests/Filtre/Date/AffdateHeureTest.php | 336 + .../Filtre/Date/AffdateJourcourtTest.php | 410 + .../Filtre/Date/AffdateMoisAnneeTest.php | 336 + tests/tests/Filtre/Date/AnneeTest.php | 330 + tests/tests/Filtre/Date/DateIcalTest.php | 335 + tests/tests/Filtre/Date/DateInterfaceTest.php | 336 + tests/tests/Filtre/Date/DateRelativeTest.php | 318 + tests/tests/Filtre/Date/HeuresMinutesTest.php | 336 + tests/tests/Filtre/Date/HeuresTest.php | 330 + tests/tests/Filtre/Date/JourTest.php | 336 + tests/tests/Filtre/Date/JournumTest.php | 330 + tests/tests/Filtre/Date/MinutesTest.php | 330 + tests/tests/Filtre/Date/MoisTest.php | 330 + tests/tests/Filtre/Date/NomJourTest.php | 336 + tests/tests/Filtre/Date/NomMoisTest.php | 336 + .../tests/Filtre/Date/NormaliserDateTest.php | 750 ++ tests/tests/Filtre/Date/RecupDateTest.php | 1810 +++ tests/tests/Filtre/Date/RecupHeureTest.php | 179 + tests/tests/Filtre/Date/SaisonTest.php | 336 + tests/tests/Filtre/Date/ViderDateTest.php | 330 + tests/tests/Filtre/DivTest.php | 1315 ++ tests/tests/Filtre/EchapperTagsTest.php | 62 + tests/tests/Filtre/ExtraireBalisesTest.php | 260 + tests/tests/Filtre/ExtraireMultiTest.php | 90 + .../tests/Filtre/FiltreBaliseImgDistTest.php | 238 + tests/tests/Filtre/FiltrerEntitesTest.php | 66 + .../tests/Filtre/Form/FormHiddenArboTest.php | 18 + tests/tests/Filtre/Form/FormHiddenCase.php | 128 + .../tests/Filtre/Form/FormHiddenHtmlTest.php | 16 + .../Filtre/Form/FormHiddenLibresTest.php | 16 + .../tests/Filtre/Form/FormHiddenPageTest.php | 16 + .../Filtre/Form/FormHiddenPropresQsTest.php | 16 + .../Filtre/Form/FormHiddenPropresTest.php | 16 + .../Filtre/Form/FormHiddenStandardTest.php | 16 + tests/tests/Filtre/HauteurTest.php | 50 + tests/tests/Filtre/IdentifiantSlugTest.php | 699 ++ tests/tests/Filtre/InsererAttributTest.php | 1144 ++ tests/tests/Filtre/LabelTest.php | 127 + tests/tests/Filtre/LargeurTest.php | 50 + tests/tests/Filtre/LienOuExposeTest.php | 216 + .../Filtre/Mime/FiltreTextCsvDistTest.php | 136 + .../tests/Filtre/Mime/FiltreTextDistTest.php | 134 + .../Filtre/Mini/ProtocoleVerifierTest.php | 75 + tests/tests/Filtre/ModuloTest.php | 1314 ++ tests/tests/Filtre/MoinsTest.php | 1314 ++ tests/tests/Filtre/MultTest.php | 1314 ++ tests/tests/Filtre/PlusTest.php | 1314 ++ tests/tests/Filtre/PostAutobrTest.php | 70 + tests/tests/Filtre/ProtegerAmpTest.php | 62 + tests/tests/Filtre/RecupererNumeroTest.php | 58 + tests/tests/Filtre/SecondesTest.php | 330 + tests/tests/Filtre/SinonTest.php | 839 ++ tests/tests/Filtre/SpipHtmlentitiesTest.php | 1619 +++ .../tests/Filtre/SpipHtmlspecialcharsTest.php | 866 ++ tests/tests/Filtre/SupprimerClassTest.php | 74 + tests/tests/Filtre/SupprimerNumeroTest.php | 62 + tests/tests/Filtre/SupprimerTagsTest.php | 62 + tests/tests/Filtre/TailleEnOctetsTest.php | 90 + tests/tests/Filtre/TailleImageTest.php | 62 + tests/tests/Filtre/TexteBackendTest.php | 62 + tests/tests/Filtre/TexteBackendqTest.php | 62 + tests/tests/Filtre/WrapTest.php | 49 + tests/tests/Fixtures/data/dailymotion.rss | 277 + tests/tests/Format/Json/Var2jsTest.php | 212 + tests/tests/Format/Xml/SpipXmlParseTest.php | 118 + tests/tests/Formulaire/ProtegeChampTest.php | 176 + tests/tests/Genie/MajTest.php | 79 + tests/tests/LegacyUnitHtmlTest.php | 76 + tests/tests/LegacyUnitPhpTest.php | 80 + .../Plugin/PluginVersionCompatibleTest.php | 484 + tests/tests/Plugin/SpipVersionCompareTest.php | 568 + tests/tests/Propre/ChevronOuvrantTest.php | 70 + tests/tests/Propre/CodeImbriqueTest.php | 240 + tests/tests/Propre/EchappeHtmlTest.php | 232 + tests/tests/Propre/TraiterModelesTest.php | 50 + tests/tests/Propre/TraiterRaccourcisTest.php | 86 + tests/tests/Propre/TraiterTableauTest.php | 113 + tests/tests/Sql/Objets/IdTableObjetTest.php | 108 + tests/tests/Sql/Objets/ObjetTypeTest.php | 117 + .../Sql/Objets/QueryEchappeTextesTest.php | 105 + tests/tests/Sql/Objets/TableObjetSqlTest.php | 111 + tests/tests/Sql/Objets/TableObjetTest.php | 108 + tests/tests/Sql/SqlInMysqlTest.php | 200 + tests/tests/Sql/SqlInSqliteTest.php | 200 + .../tests/Squelettes/Balise/AutoriserTest.php | 21 + .../Squelettes/Balise/BaliseDetacheeTest.php | 51 + .../Squelettes/Balise/BaliseGeneriqueTest.php | 118 + tests/tests/Squelettes/Balise/ConfigTest.php | 244 + tests/tests/Squelettes/Balise/ConstTest.php | 28 + tests/tests/Squelettes/Balise/EvalTest.php | 19 + tests/tests/Squelettes/Balise/ExposeTest.php | 59 + .../Squelettes/Balise/InclureStatiqueTest.php | 80 + tests/tests/Squelettes/Balise/InclureTest.php | 80 + .../Squelettes/Balise/IntroductionTest.php | 89 + .../Squelettes/Balise/LesauteursTest.php | 28 + .../tests/Squelettes/Balise/MimeTypeTest.php | 31 + tests/tests/Squelettes/Balise/NotesTest.php | 57 + tests/tests/Squelettes/Balise/SelfTest.php | 16 + tests/tests/Squelettes/Balise/SessionTest.php | 39 + tests/tests/Squelettes/Balise/ValTest.php | 19 + .../Balise/data/balise_detachee.html | 33 + .../Balise/data/balise_env_test.html | 1 + .../Squelettes/Balise/data/balise_expose.html | 16 + .../data/balise_expose_dans_inclusion.html | 3 + .../Squelettes/Balise/data/inclure_vide.html | 3 + .../Balise/data/note_inclue_affichee.html | 2 + .../Balise/data/note_inclue_nonaffichee.html | 2 + tests/tests/Squelettes/Balise/data/notes.html | 78 + .../Balise/data/texte_hello_world.html | 1 + .../Squelettes/Boucle/BoucleGeneriqueTest.php | 55 + .../Squelettes/Boucle/BoucleRecursiveTest.php | 18 + .../Squelettes/Boucle/HierarchieTest.php | 40 + .../Squelettes/Boucle/data/boucle_vide.html | 6 + .../tests/Squelettes/Boucle/data/bug764.html | 18 + .../tests/Squelettes/Critere/DoublonsTest.php | 72 + .../Squelettes/Critere/data/doublons.html | 22 + .../Squelettes/Filtre/IntroductionTest.php | 79 + .../tests/Squelettes/Filtre/LogiquesTest.php | 86 + .../tests/Testing/SquelettesTestCaseTest.php | 59 + tests/tests/Testing/TemplateTest.php | 24 + tests/tests/Testing/TemplatingTest.php | 161 + tests/tests/Testing/data/balise_env_test.html | 1 + .../tests/Testing/data/texte_hello_world.html | 1 + tests/tests/Texte/CouperTest.php | 114 + tests/tests/Texte/EchapperHtmlSuspectTest.php | 78 + .../Texte/InterdireScriptLaxisteTest.php | 59 + .../tests/Texte/InterdireScriptParanoTest.php | 62 + tests/tests/Texte/PropreTest.php | 96 + tests/tests/Texte/TypoTest.php | 142 + tests/tests/Typographie/FrTest.php | 189 + tests/tests/Typographie/FrTextwheelTest.php | 24 + tests/tests/Typographie/NotesTest.php | 132 + tests/tests/Utils/ParametreUrlTest.php | 260 + tests/tests/Utils/TesterUrlAbsolueTest.php | 62 + tests/tests/Utils/UrlDeTest.php | 118 + tests/tests/bootstrap.php | 66 + tests/tests/legacy/css/tests.css | 66 + tests/tests/legacy/js/jquery-3.2.js | 10253 ++++++++++++++++ tests/tests/legacy/js/testrunner.js | 65 + tests/tests/legacy/squel.php | 58 + .../balise/formulaire_test_phraseur.php | 50 + .../legacy/squelettes/cache_session_w_1.html | 2 + .../legacy/squelettes/cache_session_w_2.html | 4 + .../legacy/squelettes/cache_session_w_3.html | 4 + .../legacy/squelettes/cache_session_wo_1.html | 2 + .../legacy/squelettes/cache_session_wo_2.html | 2 + .../legacy/squelettes/cache_session_wo_3.html | 2 + .../legacy/squelettes/cache_session_wo_4.html | 4 + .../legacy/squelettes/cache_session_wo_5.html | 4 + .../legacy/squelettes/cache_session_wo_6.html | 4 + .../legacy/squelettes/cache_session_wo_7.html | 4 + .../squelettes/formulaires/test_dyn_lang.html | 8 + .../squelettes/formulaires/test_dyn_lang.php | 17 + .../squelettes/formulaires/test_phraseur.html | 8 + .../squelettes/inclure/A_session_w.html | 2 + .../squelettes/inclure/A_session_wo.html | 4 + .../squelettes/inclure/B_session_w.html | 2 + .../squelettes/inclure/B_session_wo.html | 4 + .../squelettes/inclure/C_session_w.html | 2 + .../squelettes/inclure/C_session_wo.html | 4 + .../modeles/foreach_test_ul_li.html | 1 + .../squelettes/modeles/foreach_ul_li.html | 1 + tests/tests/legacy/squelettes/root.html | 2 + tests/tests/legacy/test.inc | 87 + tests/tests/legacy/test_fonctions.php | 289 + tests/tests/legacy/unit/abstract_sql/.ok | 0 .../abstract_sql/00_sql_create_drop_view.php | 76 + .../abstract_sql/10_sql_insert_select.php | 327 + .../abstract_sql/20_sql_update_delete.php | 108 + .../legacy/unit/abstract_sql/30_sql_alter.php | 309 + .../unit/abstract_sql/40_sql_divers.php | 164 + .../unit/abstract_sql/inc-sql_datas.inc | 211 + .../unit/balises/balise_dyn_langue.html | 16 + .../balises/balise_dyn_langue_fonctions.php | 6 + .../balises/balise_dyn_langue_modele.html | 17 + .../balise_dyn_langue_modele_fonctions.php | 6 + tests/tests/legacy/unit/balises/doublons.html | 33 + tests/tests/legacy/unit/balises/filtre.html | 10 + .../legacy/unit/balises/filtre_fonctions.php | 20 + .../legacy/unit/balises/formulaire_.html | 9 + .../unit/balises/formulaire__fonctions.php | 18 + .../legacy/unit/balises/inclure_array.html | 20 + .../legacy/unit/balises/inclure_manquant.html | 9 + .../balises/inclure_manquant_fonctions.php | 18 + .../legacy/unit/balises/inclus_article.html | 1 + .../legacy/unit/balises/inclus_rien.html | 3 + .../unit/balises/phraseur_balise_dyn.html | 11 + .../legacy/unit/cache/cache_sessions.php | 159 + tests/tests/legacy/unit/criteres/branche.html | 38 + .../unit/criteres/origine_traduction.html | 27 + .../legacy/unit/criteres/regexp-like.html | 79 + .../legacy/unit/criteres/traduction.html | 40 + .../unit/documents/affichage_documents.html | 44 + .../entrees_sorties/flock_sous_repertoire.php | 34 + .../unit/entrees_sorties/spip_nfslock.php | 48 + tests/tests/legacy/unit/filtres/abs_url.html | 16 + tests/tests/legacy/unit/filtres/affdate.php | 109 + .../legacy/unit/filtres/attribut_html.php | 48 + tests/tests/legacy/unit/filtres/date_iso.php | 33 + .../legacy/unit/filtres/entites_html.php | 111 + .../legacy/unit/filtres/extraire_attribut.php | 158 + .../legacy/unit/filtres/form_hidden.html | 36 + .../legacy/unit/filtres/liens_absolus.php | 66 + .../unit/filtres/liens_absolus_prive.php | 23 + .../legacy/unit/filtres/liens_ouvrants.html | 17 + tests/tests/legacy/unit/filtres/logique.html | 9 + .../legacy/unit/filtres/suivre_liens.php | 157 + tests/tests/legacy/unit/path/creer_chemin.php | 54 + .../legacy/unit/plugin/dir_plugins_suppl.php | 210 + .../legacy/unit/propre/doublons_notes.html | 29 + .../unit/propre/doublons_notes_fonctions.php | 23 + tests/tests/legacy/unit/propre/liens.php | 186 + .../legacy/unit/propre/liens_classes.php | 72 + .../unit/rubriques/creer_rubrique_nommee.html | 20 + tests/tests/legacy/unit/xml/xmlhack.html | 14 + .../legacy/unit/xml/xmlhack_fonctions.php | 5 + .../legacy/unit/xml/xmlhack_inclure.html | 1 + .../legacy/unit/xml/xmlhack_inclure_dyn.html | 1 + .../unit/xml/xmlhack_inclure_dyn_php.html | 1 + .../legacy/unit/xml/xmlhack_inclure_php.html | 1 + tests/tests/legacy/unit/xml/xmlhack_php.html | 14 + .../legacy/unit/xml/xmlhack_php_fonctions.php | 5 + .../unit/xml/xmlhack_recuperer_fond.php | 53 + .../legacy/unit/z_todo/NA_echappements.php | 91 + .../legacy/unit/z_todo/NA_email_valide.php | 199 + .../unit/z_todo/NA_email_valide_5322.php | 115 + .../legacy/unit/z_todo/email_valide_5322.xml | 1739 +++ .../config/set/spip_test_essais_migration.php | 12 + .../rector/src/Rector/MoveSpipTestsEssais.php | 82 + .../src/Rector/RefactorSpipTestsEssais.php | 336 + .../Set/ValueObject/SpipTestSetList.php | 13 + 267 files changed, 50553 insertions(+) create mode 100644 tests/.gitignore create mode 100644 tests/Makefile create mode 100644 tests/README.md create mode 100755 tests/bin/configure.php create mode 100644 tests/composer.json create mode 100644 tests/ecs.php create mode 100644 tests/index.php create mode 100755 tests/phpunit.xml.dist create mode 100644 tests/rector.php create mode 100644 tests/src/Constraint/IsOk.php create mode 100644 tests/src/Exception/TemplateCompilationErrorException.php create mode 100644 tests/src/Exception/TemplateNotFoundException.php create mode 100644 tests/src/SquelettesTestCase.php create mode 100644 tests/src/Template.php create mode 100644 tests/src/Template/Loader/ChainLoader.php create mode 100644 tests/src/Template/Loader/FileLoader.php create mode 100644 tests/src/Template/Loader/LoaderInterface.php create mode 100644 tests/src/Template/Loader/StringLoader.php create mode 100644 tests/src/Templating.php create mode 100644 tests/tests/Action/EditerLiensTest.php create mode 100644 tests/tests/Api/AutoriserTest.php create mode 100644 tests/tests/Api/data/autoriser.php create mode 100644 tests/tests/Config/DepotMetaPackTest.php create mode 100644 tests/tests/Config/DepotMetaPersoTest.php create mode 100644 tests/tests/Config/DepotMetaTest.php create mode 100644 tests/tests/Distant/NeedProxyTest.php create mode 100644 tests/tests/Distant/UrlToAsciiTest.php create mode 100644 tests/tests/Distant/ValiderUrlDistanteTest.php create mode 100644 tests/tests/Filtre/AjouterClassTest.php create mode 100644 tests/tests/Filtre/AntispamTest.php create mode 100644 tests/tests/Filtre/AppliquerFiltreTest.php create mode 100644 tests/tests/Filtre/ChercherFiltreTest.php create mode 100644 tests/tests/Filtre/CommuterClassTest.php create mode 100644 tests/tests/Filtre/CorrigerEntitesHtmlTest.php create mode 100644 tests/tests/Filtre/Date/AffdateCourtTest.php create mode 100644 tests/tests/Filtre/Date/AffdateDebutFinTest.php create mode 100644 tests/tests/Filtre/Date/AffdateHeureTest.php create mode 100644 tests/tests/Filtre/Date/AffdateJourcourtTest.php create mode 100644 tests/tests/Filtre/Date/AffdateMoisAnneeTest.php create mode 100644 tests/tests/Filtre/Date/AnneeTest.php create mode 100644 tests/tests/Filtre/Date/DateIcalTest.php create mode 100644 tests/tests/Filtre/Date/DateInterfaceTest.php create mode 100644 tests/tests/Filtre/Date/DateRelativeTest.php create mode 100644 tests/tests/Filtre/Date/HeuresMinutesTest.php create mode 100644 tests/tests/Filtre/Date/HeuresTest.php create mode 100644 tests/tests/Filtre/Date/JourTest.php create mode 100644 tests/tests/Filtre/Date/JournumTest.php create mode 100644 tests/tests/Filtre/Date/MinutesTest.php create mode 100644 tests/tests/Filtre/Date/MoisTest.php create mode 100644 tests/tests/Filtre/Date/NomJourTest.php create mode 100644 tests/tests/Filtre/Date/NomMoisTest.php create mode 100644 tests/tests/Filtre/Date/NormaliserDateTest.php create mode 100644 tests/tests/Filtre/Date/RecupDateTest.php create mode 100644 tests/tests/Filtre/Date/RecupHeureTest.php create mode 100644 tests/tests/Filtre/Date/SaisonTest.php create mode 100644 tests/tests/Filtre/Date/ViderDateTest.php create mode 100644 tests/tests/Filtre/DivTest.php create mode 100644 tests/tests/Filtre/EchapperTagsTest.php create mode 100644 tests/tests/Filtre/ExtraireBalisesTest.php create mode 100644 tests/tests/Filtre/ExtraireMultiTest.php create mode 100644 tests/tests/Filtre/FiltreBaliseImgDistTest.php create mode 100644 tests/tests/Filtre/FiltrerEntitesTest.php create mode 100644 tests/tests/Filtre/Form/FormHiddenArboTest.php create mode 100644 tests/tests/Filtre/Form/FormHiddenCase.php create mode 100644 tests/tests/Filtre/Form/FormHiddenHtmlTest.php create mode 100644 tests/tests/Filtre/Form/FormHiddenLibresTest.php create mode 100644 tests/tests/Filtre/Form/FormHiddenPageTest.php create mode 100644 tests/tests/Filtre/Form/FormHiddenPropresQsTest.php create mode 100644 tests/tests/Filtre/Form/FormHiddenPropresTest.php create mode 100644 tests/tests/Filtre/Form/FormHiddenStandardTest.php create mode 100644 tests/tests/Filtre/HauteurTest.php create mode 100644 tests/tests/Filtre/IdentifiantSlugTest.php create mode 100644 tests/tests/Filtre/InsererAttributTest.php create mode 100644 tests/tests/Filtre/LabelTest.php create mode 100644 tests/tests/Filtre/LargeurTest.php create mode 100644 tests/tests/Filtre/LienOuExposeTest.php create mode 100644 tests/tests/Filtre/Mime/FiltreTextCsvDistTest.php create mode 100644 tests/tests/Filtre/Mime/FiltreTextDistTest.php create mode 100644 tests/tests/Filtre/Mini/ProtocoleVerifierTest.php create mode 100644 tests/tests/Filtre/ModuloTest.php create mode 100644 tests/tests/Filtre/MoinsTest.php create mode 100644 tests/tests/Filtre/MultTest.php create mode 100644 tests/tests/Filtre/PlusTest.php create mode 100644 tests/tests/Filtre/PostAutobrTest.php create mode 100644 tests/tests/Filtre/ProtegerAmpTest.php create mode 100644 tests/tests/Filtre/RecupererNumeroTest.php create mode 100644 tests/tests/Filtre/SecondesTest.php create mode 100644 tests/tests/Filtre/SinonTest.php create mode 100644 tests/tests/Filtre/SpipHtmlentitiesTest.php create mode 100644 tests/tests/Filtre/SpipHtmlspecialcharsTest.php create mode 100644 tests/tests/Filtre/SupprimerClassTest.php create mode 100644 tests/tests/Filtre/SupprimerNumeroTest.php create mode 100644 tests/tests/Filtre/SupprimerTagsTest.php create mode 100644 tests/tests/Filtre/TailleEnOctetsTest.php create mode 100644 tests/tests/Filtre/TailleImageTest.php create mode 100644 tests/tests/Filtre/TexteBackendTest.php create mode 100644 tests/tests/Filtre/TexteBackendqTest.php create mode 100644 tests/tests/Filtre/WrapTest.php create mode 100644 tests/tests/Fixtures/data/dailymotion.rss create mode 100644 tests/tests/Format/Json/Var2jsTest.php create mode 100644 tests/tests/Format/Xml/SpipXmlParseTest.php create mode 100644 tests/tests/Formulaire/ProtegeChampTest.php create mode 100644 tests/tests/Genie/MajTest.php create mode 100644 tests/tests/LegacyUnitHtmlTest.php create mode 100644 tests/tests/LegacyUnitPhpTest.php create mode 100644 tests/tests/Plugin/PluginVersionCompatibleTest.php create mode 100644 tests/tests/Plugin/SpipVersionCompareTest.php create mode 100644 tests/tests/Propre/ChevronOuvrantTest.php create mode 100644 tests/tests/Propre/CodeImbriqueTest.php create mode 100644 tests/tests/Propre/EchappeHtmlTest.php create mode 100644 tests/tests/Propre/TraiterModelesTest.php create mode 100644 tests/tests/Propre/TraiterRaccourcisTest.php create mode 100644 tests/tests/Propre/TraiterTableauTest.php create mode 100644 tests/tests/Sql/Objets/IdTableObjetTest.php create mode 100644 tests/tests/Sql/Objets/ObjetTypeTest.php create mode 100644 tests/tests/Sql/Objets/QueryEchappeTextesTest.php create mode 100644 tests/tests/Sql/Objets/TableObjetSqlTest.php create mode 100644 tests/tests/Sql/Objets/TableObjetTest.php create mode 100644 tests/tests/Sql/SqlInMysqlTest.php create mode 100644 tests/tests/Sql/SqlInSqliteTest.php create mode 100644 tests/tests/Squelettes/Balise/AutoriserTest.php create mode 100644 tests/tests/Squelettes/Balise/BaliseDetacheeTest.php create mode 100644 tests/tests/Squelettes/Balise/BaliseGeneriqueTest.php create mode 100644 tests/tests/Squelettes/Balise/ConfigTest.php create mode 100644 tests/tests/Squelettes/Balise/ConstTest.php create mode 100644 tests/tests/Squelettes/Balise/EvalTest.php create mode 100644 tests/tests/Squelettes/Balise/ExposeTest.php create mode 100644 tests/tests/Squelettes/Balise/InclureStatiqueTest.php create mode 100644 tests/tests/Squelettes/Balise/InclureTest.php create mode 100644 tests/tests/Squelettes/Balise/IntroductionTest.php create mode 100644 tests/tests/Squelettes/Balise/LesauteursTest.php create mode 100644 tests/tests/Squelettes/Balise/MimeTypeTest.php create mode 100644 tests/tests/Squelettes/Balise/NotesTest.php create mode 100644 tests/tests/Squelettes/Balise/SelfTest.php create mode 100644 tests/tests/Squelettes/Balise/SessionTest.php create mode 100644 tests/tests/Squelettes/Balise/ValTest.php create mode 100644 tests/tests/Squelettes/Balise/data/balise_detachee.html create mode 100644 tests/tests/Squelettes/Balise/data/balise_env_test.html create mode 100644 tests/tests/Squelettes/Balise/data/balise_expose.html create mode 100644 tests/tests/Squelettes/Balise/data/balise_expose_dans_inclusion.html create mode 100644 tests/tests/Squelettes/Balise/data/inclure_vide.html create mode 100644 tests/tests/Squelettes/Balise/data/note_inclue_affichee.html create mode 100644 tests/tests/Squelettes/Balise/data/note_inclue_nonaffichee.html create mode 100644 tests/tests/Squelettes/Balise/data/notes.html create mode 100644 tests/tests/Squelettes/Balise/data/texte_hello_world.html create mode 100644 tests/tests/Squelettes/Boucle/BoucleGeneriqueTest.php create mode 100644 tests/tests/Squelettes/Boucle/BoucleRecursiveTest.php create mode 100644 tests/tests/Squelettes/Boucle/HierarchieTest.php create mode 100644 tests/tests/Squelettes/Boucle/data/boucle_vide.html create mode 100644 tests/tests/Squelettes/Boucle/data/bug764.html create mode 100644 tests/tests/Squelettes/Critere/DoublonsTest.php create mode 100644 tests/tests/Squelettes/Critere/data/doublons.html create mode 100644 tests/tests/Squelettes/Filtre/IntroductionTest.php create mode 100644 tests/tests/Squelettes/Filtre/LogiquesTest.php create mode 100644 tests/tests/Testing/SquelettesTestCaseTest.php create mode 100644 tests/tests/Testing/TemplateTest.php create mode 100644 tests/tests/Testing/TemplatingTest.php create mode 100644 tests/tests/Testing/data/balise_env_test.html create mode 100644 tests/tests/Testing/data/texte_hello_world.html create mode 100644 tests/tests/Texte/CouperTest.php create mode 100644 tests/tests/Texte/EchapperHtmlSuspectTest.php create mode 100644 tests/tests/Texte/InterdireScriptLaxisteTest.php create mode 100644 tests/tests/Texte/InterdireScriptParanoTest.php create mode 100644 tests/tests/Texte/PropreTest.php create mode 100644 tests/tests/Texte/TypoTest.php create mode 100644 tests/tests/Typographie/FrTest.php create mode 100644 tests/tests/Typographie/FrTextwheelTest.php create mode 100644 tests/tests/Typographie/NotesTest.php create mode 100644 tests/tests/Utils/ParametreUrlTest.php create mode 100644 tests/tests/Utils/TesterUrlAbsolueTest.php create mode 100644 tests/tests/Utils/UrlDeTest.php create mode 100644 tests/tests/bootstrap.php create mode 100644 tests/tests/legacy/css/tests.css create mode 100644 tests/tests/legacy/js/jquery-3.2.js create mode 100644 tests/tests/legacy/js/testrunner.js create mode 100644 tests/tests/legacy/squel.php create mode 100644 tests/tests/legacy/squelettes/balise/formulaire_test_phraseur.php create mode 100644 tests/tests/legacy/squelettes/cache_session_w_1.html create mode 100644 tests/tests/legacy/squelettes/cache_session_w_2.html create mode 100644 tests/tests/legacy/squelettes/cache_session_w_3.html create mode 100644 tests/tests/legacy/squelettes/cache_session_wo_1.html create mode 100644 tests/tests/legacy/squelettes/cache_session_wo_2.html create mode 100644 tests/tests/legacy/squelettes/cache_session_wo_3.html create mode 100644 tests/tests/legacy/squelettes/cache_session_wo_4.html create mode 100644 tests/tests/legacy/squelettes/cache_session_wo_5.html create mode 100644 tests/tests/legacy/squelettes/cache_session_wo_6.html create mode 100644 tests/tests/legacy/squelettes/cache_session_wo_7.html create mode 100644 tests/tests/legacy/squelettes/formulaires/test_dyn_lang.html create mode 100644 tests/tests/legacy/squelettes/formulaires/test_dyn_lang.php create mode 100644 tests/tests/legacy/squelettes/formulaires/test_phraseur.html create mode 100644 tests/tests/legacy/squelettes/inclure/A_session_w.html create mode 100644 tests/tests/legacy/squelettes/inclure/A_session_wo.html create mode 100644 tests/tests/legacy/squelettes/inclure/B_session_w.html create mode 100644 tests/tests/legacy/squelettes/inclure/B_session_wo.html create mode 100644 tests/tests/legacy/squelettes/inclure/C_session_w.html create mode 100644 tests/tests/legacy/squelettes/inclure/C_session_wo.html create mode 100644 tests/tests/legacy/squelettes/modeles/foreach_test_ul_li.html create mode 100644 tests/tests/legacy/squelettes/modeles/foreach_ul_li.html create mode 100644 tests/tests/legacy/squelettes/root.html create mode 100644 tests/tests/legacy/test.inc create mode 100644 tests/tests/legacy/test_fonctions.php create mode 100644 tests/tests/legacy/unit/abstract_sql/.ok create mode 100644 tests/tests/legacy/unit/abstract_sql/00_sql_create_drop_view.php create mode 100644 tests/tests/legacy/unit/abstract_sql/10_sql_insert_select.php create mode 100644 tests/tests/legacy/unit/abstract_sql/20_sql_update_delete.php create mode 100644 tests/tests/legacy/unit/abstract_sql/30_sql_alter.php create mode 100644 tests/tests/legacy/unit/abstract_sql/40_sql_divers.php create mode 100644 tests/tests/legacy/unit/abstract_sql/inc-sql_datas.inc create mode 100644 tests/tests/legacy/unit/balises/balise_dyn_langue.html create mode 100644 tests/tests/legacy/unit/balises/balise_dyn_langue_fonctions.php create mode 100644 tests/tests/legacy/unit/balises/balise_dyn_langue_modele.html create mode 100644 tests/tests/legacy/unit/balises/balise_dyn_langue_modele_fonctions.php create mode 100644 tests/tests/legacy/unit/balises/doublons.html create mode 100644 tests/tests/legacy/unit/balises/filtre.html create mode 100644 tests/tests/legacy/unit/balises/filtre_fonctions.php create mode 100644 tests/tests/legacy/unit/balises/formulaire_.html create mode 100644 tests/tests/legacy/unit/balises/formulaire__fonctions.php create mode 100644 tests/tests/legacy/unit/balises/inclure_array.html create mode 100644 tests/tests/legacy/unit/balises/inclure_manquant.html create mode 100644 tests/tests/legacy/unit/balises/inclure_manquant_fonctions.php create mode 100644 tests/tests/legacy/unit/balises/inclus_article.html create mode 100644 tests/tests/legacy/unit/balises/inclus_rien.html create mode 100644 tests/tests/legacy/unit/balises/phraseur_balise_dyn.html create mode 100644 tests/tests/legacy/unit/cache/cache_sessions.php create mode 100644 tests/tests/legacy/unit/criteres/branche.html create mode 100644 tests/tests/legacy/unit/criteres/origine_traduction.html create mode 100644 tests/tests/legacy/unit/criteres/regexp-like.html create mode 100644 tests/tests/legacy/unit/criteres/traduction.html create mode 100644 tests/tests/legacy/unit/documents/affichage_documents.html create mode 100644 tests/tests/legacy/unit/entrees_sorties/flock_sous_repertoire.php create mode 100644 tests/tests/legacy/unit/entrees_sorties/spip_nfslock.php create mode 100644 tests/tests/legacy/unit/filtres/abs_url.html create mode 100644 tests/tests/legacy/unit/filtres/affdate.php create mode 100644 tests/tests/legacy/unit/filtres/attribut_html.php create mode 100644 tests/tests/legacy/unit/filtres/date_iso.php create mode 100644 tests/tests/legacy/unit/filtres/entites_html.php create mode 100644 tests/tests/legacy/unit/filtres/extraire_attribut.php create mode 100644 tests/tests/legacy/unit/filtres/form_hidden.html create mode 100644 tests/tests/legacy/unit/filtres/liens_absolus.php create mode 100644 tests/tests/legacy/unit/filtres/liens_absolus_prive.php create mode 100644 tests/tests/legacy/unit/filtres/liens_ouvrants.html create mode 100644 tests/tests/legacy/unit/filtres/logique.html create mode 100644 tests/tests/legacy/unit/filtres/suivre_liens.php create mode 100644 tests/tests/legacy/unit/path/creer_chemin.php create mode 100644 tests/tests/legacy/unit/plugin/dir_plugins_suppl.php create mode 100644 tests/tests/legacy/unit/propre/doublons_notes.html create mode 100644 tests/tests/legacy/unit/propre/doublons_notes_fonctions.php create mode 100644 tests/tests/legacy/unit/propre/liens.php create mode 100644 tests/tests/legacy/unit/propre/liens_classes.php create mode 100644 tests/tests/legacy/unit/rubriques/creer_rubrique_nommee.html create mode 100644 tests/tests/legacy/unit/xml/xmlhack.html create mode 100644 tests/tests/legacy/unit/xml/xmlhack_fonctions.php create mode 100644 tests/tests/legacy/unit/xml/xmlhack_inclure.html create mode 100644 tests/tests/legacy/unit/xml/xmlhack_inclure_dyn.html create mode 100644 tests/tests/legacy/unit/xml/xmlhack_inclure_dyn_php.html create mode 100644 tests/tests/legacy/unit/xml/xmlhack_inclure_php.html create mode 100644 tests/tests/legacy/unit/xml/xmlhack_php.html create mode 100644 tests/tests/legacy/unit/xml/xmlhack_php_fonctions.php create mode 100644 tests/tests/legacy/unit/xml/xmlhack_recuperer_fond.php create mode 100644 tests/tests/legacy/unit/z_todo/NA_echappements.php create mode 100644 tests/tests/legacy/unit/z_todo/NA_email_valide.php create mode 100644 tests/tests/legacy/unit/z_todo/NA_email_valide_5322.php create mode 100644 tests/tests/legacy/unit/z_todo/email_valide_5322.xml create mode 100644 tests/utils/rector/config/set/spip_test_essais_migration.php create mode 100644 tests/utils/rector/src/Rector/MoveSpipTestsEssais.php create mode 100644 tests/utils/rector/src/Rector/RefactorSpipTestsEssais.php create mode 100644 tests/utils/rector/src/Rector/Set/ValueObject/SpipTestSetList.php diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000000..7e5cd04552 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,9 @@ +.idea +composer.lock +/vendor/ +/vendor-bin/*/vendor/ +.phpunit.result.cache +.phpunit.cache/ +phpunit.xml +phpunit.xml.bak +tests/bootstrap_plugins.php diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000000..387e2c320f --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,12 @@ +tests: vendor phpunit.xml bootstrap_plugins.php + vendor/bin/phpunit --colors + +phpunit.xml: + php bin/configure.php + +bootstrap_plugins.php: + php bin/configure.php + +vendor: composer.json + composer update + touch $@ diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000000..25c3996f9e --- /dev/null +++ b/tests/README.md @@ -0,0 +1,58 @@ +# Tests pour SPIP + +Suite de tests basée sur PHPUnit, avec un wrapper pour les tests historiques écrits en script PHP standalone ou en squelette HTML + +## Installation + +Placez-vous à la racine du site. + +``` +git clone https://git.spip.net/spip/tests.git +cd tests +make tests +``` + +## Commande principale + +Lancer tous les tests +``` +make tests +``` + +## Commandes spécifiques + +Lancer tous les tests +``` +vendor/bin/phpunit --colors tests +``` + +Voir le détail de tous les tests lancés (y compris leurs noms) +``` +vendor/bin/phpunit --colors --debug tests +``` + +Lister toutes les suites de tests : +``` +vendor/bin/phpunit --colors --debug --list-suites +``` + +Lister tous les tests : +``` +vendor/bin/phpunit --colors --debug --list-tests +``` + +Pour filtrer les tests et n'en executer que certains : +``` +vendor/bin/phpunit --colors --debug tests --filter=unit/propre/ +vendor/bin/phpunit --colors --debug --filter=testCouper +``` + +## Ajouter des tests + +TODO + +## Legacy + +Les tests historiques écrits sous forme de PHP ou de squelette HTML sont joués via les 2 composants `LegacyUnitHtmlTest.php` et `LegacyUnitPhpTest.php` + +Il est encore possible de lancer dans le navigateur la suite de tests legacy via l'url `monsite.spip/tests/` mais cette méthode est depréciée et ne lancera pas les tests écrits directement pour PHPUnit diff --git a/tests/bin/configure.php b/tests/bin/configure.php new file mode 100755 index 0000000000..e825167e3d --- /dev/null +++ b/tests/bin/configure.php @@ -0,0 +1,60 @@ +#!/usr/bin/env php +<?php + +// les args a passer a phpUnit +$args = $argv; +array_shift($args); + +$dir_tests = dirname(__DIR__) . '/'; +$file_bootstrap_plugins = $dir_tests . "tests/bootstrap_plugins.php"; +if (!file_exists($file_bootstrap_plugins)) { + file_put_contents($file_bootstrap_plugins,"<?"."php\n"); +} + +// charger SPIP +require_once $dir_tests . 'tests/bootstrap.php'; + +// Lister les repertoires du path qui contiennent des dossier tests/ avec des tests PHPUnit + +$dirs = []; +$bootstraps = []; +foreach (creer_chemin() as $d) { + if ($d and + is_dir("{$d}tests") + and (count(glob("{$d}tests/*Test.php")) or count(glob("{$d}tests/*/*Test.php"))) + ) { + $bases[] = "{$d}tests"; + + if (file_exists($f = "{$d}tests/bootstrap.php")) { + $bootstraps[] = $f; + } + } +} + +$prefixe_dir = '../'; +while (!is_dir($dir_tests . $prefixe_dir . 'ecrire')) { + $prefixe_dir .= '../'; +} + +$testsuites = []; +foreach ($bases as $base) { + $name = dirname($base); + $testsuites[] = "<testsuite name=\"$name\"><directory>{$prefixe_dir}{$base}/</directory></testsuite>"; +} + +$testsuites = "\t\t" . implode("\n\t\t", $testsuites) . "\n"; + +// generer le phpunit.xml a jour +$config = file_get_contents($dir_tests . 'phpunit.xml.dist'); +$p = strpos($config, "\t</testsuites>"); +$config = substr_replace($config, $testsuites, $p, 0); + +file_put_contents($dir_tests . "phpunit.xml", $config); + + +// generer le bootstrap_plugins.php a jour +$code = "<?" . "php\n"; +foreach ($bootstraps as $bootstrap) { + $code .= "include_once '".addslashes($bootstrap)."';\n"; +} +file_put_contents($file_bootstrap_plugins, $code); diff --git a/tests/composer.json b/tests/composer.json new file mode 100644 index 0000000000..91ca89927a --- /dev/null +++ b/tests/composer.json @@ -0,0 +1,46 @@ +{ + "name": "spip/tests", + "description": "Test suite for SPIP.", + "license": [ + "MIT" + ], + "type": "library", + "keywords": [ + "cms", + "spip" + ], + "require": { + "php": ">=8.1.0", + "ext-ctype": "*", + "ext-json": "*" + }, + "require-dev": { + "lolli42/finediff": "^1.0", + "phpunit/phpunit": "^10.0", + "symfony/var-dumper": "^6.2", + "symplify/easy-coding-standard": "^11.1" + }, + "suggest": { + "ext-iconv": "Can be used as fallback when ext-mbstring is not available", + "ext-mbstring": "For best performance, mbstring should be installed as it is faster than ext-iconv" + }, + "repositories": [], + "autoload": { + "psr-4": { + "Spip\\Core\\Testing\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Spip\\Core\\Tests\\": "tests/", + "Utils\\Rector\\": "utils/rector/src", + "Utils\\Rector\\Tests\\": "utils/rector/tests" + } + }, + "config": { + "platform": { + "php": "8.1.17" + }, + "sort-packages": true + } +} diff --git a/tests/ecs.php b/tests/ecs.php new file mode 100644 index 0000000000..0d2398f44e --- /dev/null +++ b/tests/ecs.php @@ -0,0 +1,21 @@ +<?php + +// ecs.php +use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer; +use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer; +use Symplify\EasyCodingStandard\Config\ECSConfig; +use Symplify\EasyCodingStandard\ValueObject\Set\SetList; + +return static function (ECSConfig $ecsConfig): void { + // A. full sets + #$ecsConfig->sets([SetList::PSR_12]); + $ecsConfig->sets([SetList::PSR_12, SetList::SYMPLIFY, SetList::COMMON, SetList::CLEAN_CODE]); + $ecsConfig->rule(NoExtraBlankLinesFixer::class); + $ecsConfig->indentation('tab'); + + $ecsConfig->paths([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]); + +}; diff --git a/tests/index.php b/tests/index.php new file mode 100644 index 0000000000..3200493b6a --- /dev/null +++ b/tests/index.php @@ -0,0 +1,103 @@ +<?php + $dir = (isset($_GET['dir']) AND ($_GET['dir'])) ? $_GET['dir'] : '..'; + chdir($dir); + require 'ecrire/inc_version.php'; + + // pas admin ? passe ton chemin (ce script est un vilain trou de securite) + if ((!isset($GLOBALS['visiteur_session']['statut']) + OR $GLOBALS['visiteur_session']['statut'] != '0minirezo') + AND !in_array($_SERVER["REMOTE_ADDR"], array('127.0.0.1', '127.0.1.1', '::1')) ) { + die('Administrateur local requis !'); + } + + // supprimer le vieux logs de tests + spip_unlink(_DIR_TMP."testrunner.log"); + + // chercher les bases de tests + $bases = array('tests/unit'); + foreach (creer_chemin() as $d) { + if ($d && @is_dir("{$d}tests")) + $bases[] = "{$d}tests"; + } + + // déclarations + $sectionold = ''; + + echo + "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' + 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>\n", + "<html><head><title>Tests de SPIP</title>", + "<script src='tests/legacy/js/jquery-3.2.js' type='text/javascript'></script>\n", + "<script src='tests/legacy/js/testrunner.js' type='text/javascript'></script>\n", + "<link rel='stylesheet' href='tests/legacy/css/tests.css' type='text/css' />\n", + "</head><body>\n", + "<h1>", + "Tests SPIP ", version_spip(), + "</h1>\n"; + + include_once __DIR__ . '/tests/legacy/test_fonctions.php'; + + define('_DIR_TESTS', basename(__DIR__).'/'); + + $tests = tests_legacy_lister(); + + // utiliser le parametre $_GET['fichier'] pour limiter les tests a un seul fichier + if (isset($_GET['fichier']) AND $_GET['fichier'] != '' AND preg_match('[^\d\w-.]', $_GET['fichier']) != 1) + $fic = $_GET['fichier']; + + + foreach ($tests as $joli => $test) { + if (isset($fic) AND $fic != '' AND substr_count($test, $fic) == 0) + continue; + + + if (preg_match(',\.php$,', $test)) + $url = '../'.$test.'?mode=test_general'; + else + $url = "tests/legacy/squel.php?test=$test&var_mode=recalcul"; + + $section = dirname($joli); + $dirTests = true; + $section_vcs = ""; + if (strpos($section, 'tests/') !== 0) { + $dirTests = false; + if ($vcs = decrire_version_git(dirname(dirname($test)))) { + $section_vcs = ' ['.$vcs['commit_short'].']'; + } + } + if ($section <> $sectionold) { + if ($sectionold) echo "</dl>\n"; + $titre = $dirTests ? $section : "<a href='../$section'>$section</a>$section_vcs"; + echo "<dl><dt>$titre</dt>\n"; + $sectionold = $section; + } + + echo "<dd> + <a href='$url' class='joli' title='".basename($test)."'>".basename($joli).":</a> + </dd>\n"; + } + + echo "</dl>\n"; + + echo "<div id='count'>"; + echo "<span id='succes'>0</span> succès, "; + echo "<span id='echec'>0</span> échec / "; + echo "<span id='total'>0</span> total"; + echo "<br />tests expédiés en <span id='timer'>0</span>ms"; + echo "</div>"; + + echo "</body></html>"; + + +function version_spip() { + include_spip('inc/minipres'); + $version = $GLOBALS['spip_version_affichee']; + if ($vcs = decrire_version_git(_DIR_RACINE)) { + $version .= ' ' . ($vcs['vcs'] ?? '') + . "[<a href='https://git.spip.net/spip/spip/commit/" + . $vcs['commit'] . "' onclick=\"window.open(this.href); return false;\">" + . $vcs['commit_short'] . "</a>]"; + } + + return $version; +} diff --git a/tests/phpunit.xml.dist b/tests/phpunit.xml.dist new file mode 100755 index 0000000000..c364dc76fa --- /dev/null +++ b/tests/phpunit.xml.dist @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phpunit + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + bootstrap="./tests/bootstrap.php" + colors="true" + stopOnFailure="false" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" + cacheDirectory=".phpunit.cache" +> + <coverage/> + <testsuites> + <testsuite name="core"><directory>./tests/</directory></testsuite> + </testsuites> +</phpunit> diff --git a/tests/rector.php b/tests/rector.php new file mode 100644 index 0000000000..2d6cbac1f5 --- /dev/null +++ b/tests/rector.php @@ -0,0 +1,24 @@ +<?php + +declare(strict_types=1); + +use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; +use Rector\Config\RectorConfig; +use Rector\Set\ValueObject\LevelSetList; +use Rector\Set\ValueObject\SetList; +use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector; +use Utils\Rector\Rector\Set\ValueObject\SpipTestSetList; + +return static function (RectorConfig $rectorConfig): void { + $rectorConfig->disableParallel(); + + $rectorConfig->paths([ + __DIR__ . '/src', + __DIR__ . '/tests' + ]); + + // define sets of rules + #$rectorConfig->sets([ + # SpipTestSetList::ESSAIS_MIGRATION + #]); +}; diff --git a/tests/src/Constraint/IsOk.php b/tests/src/Constraint/IsOk.php new file mode 100644 index 0000000000..344d7bde3a --- /dev/null +++ b/tests/src/Constraint/IsOk.php @@ -0,0 +1,41 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Testing\Constraint; + +use PHPUnit\Framework\Constraint\Constraint; + +final class IsOk extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is OK'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return substr(strtolower(trim($other)), 0, 2) === 'ok'; + } + + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most cases. This method should return the second + * part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return sprintf('"%s" is OK', $other); + } +} diff --git a/tests/src/Exception/TemplateCompilationErrorException.php b/tests/src/Exception/TemplateCompilationErrorException.php new file mode 100644 index 0000000000..e7472dad65 --- /dev/null +++ b/tests/src/Exception/TemplateCompilationErrorException.php @@ -0,0 +1,14 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Testing\Exception; + +class TemplateCompilationErrorException extends \Exception +{ + public function __construct($message = '', $code = 0, \Throwable $previous = null) + { + $message = sprintf("Compilation error '%s'", $message); + parent::__construct($message, $code, $previous); + } +} diff --git a/tests/src/Exception/TemplateNotFoundException.php b/tests/src/Exception/TemplateNotFoundException.php new file mode 100644 index 0000000000..8e656878f6 --- /dev/null +++ b/tests/src/Exception/TemplateNotFoundException.php @@ -0,0 +1,14 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Testing\Exception; + +class TemplateNotFoundException extends \Exception +{ + public function __construct($message = '', $code = 0, \Throwable $previous = null) + { + $message = sprintf("'%s' template not found", $message); + parent::__construct($message, $code, $previous); + } +} diff --git a/tests/src/SquelettesTestCase.php b/tests/src/SquelettesTestCase.php new file mode 100644 index 0000000000..7af4018369 --- /dev/null +++ b/tests/src/SquelettesTestCase.php @@ -0,0 +1,292 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Testing; + +use PHPUnit\Framework\Constraint\LogicalNot; +use PHPUnit\Framework\TestCase; +use Spip\Core\Testing\Constraint\IsOk; +use Spip\Core\Testing\Template\FileLoader; +use Spip\Core\Testing\Template\StringLoader; + +abstract class SquelettesTestCase extends TestCase +{ + /** + * Determine si une chaine débute par 'NA' (non applicable) + */ + public static function isNa(string $chaine): bool + { + return substr(strtolower(trim($chaine)), 0, 2) === 'na'; + } + + /** + * Retourne le chemin relatif depuis la racine de SPIP + */ + public static function relativePath(string $fullDirectory): string + { + if (! defined('_SPIP_TEST_CHDIR')) { + throw new \RuntimeException('_SPIP_TEST_CHDIR needs to be defined'); + } + + return substr($fullDirectory, strlen(_SPIP_TEST_CHDIR) + 1); + } + + /** + * Determine si une chaine débute par 'OK' + */ + public static function assertOk($actual, string $message = ''): void + { + $constraint = new IsOk($actual); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Determine si une chaine ne débute pas par 'OK' + */ + public static function assertNotOk($actual, string $message = ''): void + { + $constraint = new LogicalNot(new IsOk($actual)); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Assertion qui vérifie que le résultat d’un template est 'OK' + * + * @example + * $templating = new Templating(new StringLoader()); + * $this->assertOkTemplate($templating, '[(#CONFIG{pasla}|non)ok]'); + * + * $templating = new Templating(new FileLoader()); + * $this->assertOkTemplate($templating, __DIR__ . '/data/truc.html'); + * + * @uses Template + * @param string $code Code ou chemin du squelette + * @param array $contexte Contexte de calcul du squelette + * @param string $message Message pour une eventuelle erreur + */ + public static function assertOkTemplate( + Templating $templating, + string $code, + array $contexte = [], + string $message = '' + ): void { + $actual = $templating->render($code, $contexte); + + static::assertOk($actual, $message); + } + + /** + * Assertion qui vérifie que le résultat d’un template est vide + * + * @see assertOkTemplate() + */ + public static function assertNotOkTemplate( + Templating $templating, + string $code, + array $contexte = [], + string $message = '' + ): void { + $actual = $templating->render($code, $contexte); + + static::assertNotOk($actual, $message); + } + + /** + * Assertion qui vérifie que le résultat d’un template est vide + * + * @see assertOkTemplate() + */ + public static function assertEmptyTemplate( + Templating $templating, + string $code, + array $contexte = [], + string $message = '' + ): void { + $actual = $templating->render($code, $contexte); + + static::assertEmpty($actual, $message); + } + + /** + * Assertion qui vérifie que le résultat d’un template n’est pas vide + * + * @see assertOkTemplate() + */ + public static function assertNotEmptyTemplate( + Templating $templating, + string $code, + array $contexte = [], + string $message = '' + ): void { + $actual = $templating->render($code, $contexte); + + static::assertNotEmpty($actual, $message); + } + + /** + * Assertion qui vérifie le résultat d’un template + * + * @see assertOkTemplate() + */ + public static function assertEqualsTemplate( + string $expected, + Templating $templating, + string $code, + array $contexte = [], + string $message = '' + ): void { + $actual = $templating->render($code, $contexte); + + static::assertEquals($expected, $actual, $message); + } + + /** + * Assertion qui vérifie le résultat d’un template + * + * @see assertOkTemplate() + */ + public static function assertNotEqualsTemplate( + string $expected, + Templating $templating, + string $code, + array $contexte = [], + string $message = '' + ): void { + $actual = $templating->render($code, $contexte); + + static::assertNotEquals($expected, $actual, $message); + } + + /** + * Assertion qui vérifie que le résultat d’un code de squelette est 'OK' + * + * @example $this->assertOkCode('[(#CONFIG{pasla}|non)ok]'); + * + * @uses Template + * @param string $code Code ou chemin du squelette + * @param array $contexte Contexte de calcul du squelette + * @param string $message Message pour une eventuelle erreur + */ + public static function assertOkCode(string $code, array $contexte = [], string $message = ''): void + { + static::assertOkTemplate(Templating::fromString(), $code, $contexte); + } + + /** + * Assertion qui vérifie que le résultat d’un code de squelette n’est pas 'OK' + * + * @see assertOkCode() + */ + public function assertNotOkCode(string $code, array $contexte = [], $message = ''): void + { + static::assertNotOkTemplate(Templating::fromString(), $code, $contexte); + } + + /** + * Assertion qui vérifie que le résultat d’un code de squelette est vide + * + * @see assertOkCode() + */ + public static function assertEmptyCode(string $code, array $contexte = [], string $message = ''): void + { + static::assertEmptyTemplate(Templating::fromString(), $code, $contexte); + } + + /** + * Assertion qui vérifie que le résultat d’un code de squelette n’est pas vide + * + * @see assertOkCode() + */ + public static function assertNotEmptyCode(string $code, array $contexte = [], string $message = ''): void + { + static::assertNotEmptyTemplate(Templating::fromString(), $code, $contexte); + } + + /** + * Assertion qui vérifie le résultat d’un code de squelette + * + * @see assertOkCode() + */ + public function assertEqualsCode(string $expected, string $code, array $contexte = [], $message = ''): void + { + static::assertEqualsTemplate($expected, Templating::fromString(), $code, $contexte); + } + + /** + * Assertion qui vérifie le résultat d’un code de squelette + * + * @see assertOkCode() + */ + public function assertNotEqualsCode(string $expected, string $code, array $contexte = [], $message = '') + { + static::assertNotEqualsTemplate($expected, Templating::fromString(), $code, $contexte); + } + + /** + * Assertion qui vérifie que le résultat d’un fichier de squelette est 'OK' + * + * @example $this->assertOkSquelette(__DIR__ . '/data/squelette.html'); + * + * @uses Template + * @param string $code Code ou chemin du squelette + * @param array $contexte Contexte de calcul du squelette + * @param string $message Message pour une eventuelle erreur + */ + public static function assertOkSquelette(string $code, array $contexte = [], string $message = ''): void + { + static::assertOkTemplate(Templating::fromFile(), $code, $contexte); + } + + /** + * Assertion qui vérifie que le résultat d’un fichier de squelette n’est pas 'OK' + * + * @see assertOkSquelette() + */ + public function assertNotOkSquelette(string $code, array $contexte = [], $message = ''): void + { + static::assertNotOkTemplate(Templating::fromFile(), $code, $contexte); + } + + /** + * Assertion qui vérifie que le résultat d’un fichier de squelette est vide + * + * @see assertOkSquelette() + */ + public static function assertEmptySquelette(string $code, array $contexte = [], string $message = ''): void + { + static::assertEmptyTemplate(Templating::fromFile(), $code, $contexte); + } + + /** + * Assertion qui vérifie que le résultat d’un fichier de squelette n’est pas vide + * + * @see assertOkSquelette() + */ + public static function assertNotEmptySquelette(string $code, array $contexte = [], string $message = ''): void + { + static::assertNotEmptyTemplate(Templating::fromFile(), $code, $contexte); + } + + /** + * Assertion qui vérifie le résultat d’un fichier de squelette + * + * @see assertOkSquelette() + */ + public function assertEqualsSquelette(string $expected, string $code, array $contexte = [], $message = ''): void + { + static::assertEqualsTemplate($expected, Templating::fromFile(), $code, $contexte); + } + + /** + * Assertion qui vérifie le résultat d’un fichier de squelette + * + * @see assertOkSquelette() + */ + public function assertNotEqualsSquelette(string $expected, string $code, array $contexte = [], $message = '') + { + static::assertNotEqualsTemplate($expected, Templating::fromFile(), $code, $contexte); + } +} diff --git a/tests/src/Template.php b/tests/src/Template.php new file mode 100644 index 0000000000..38bd1a1a91 --- /dev/null +++ b/tests/src/Template.php @@ -0,0 +1,84 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Testing; + +use Spip\Core\Testing\Exception\TemplateCompilationErrorException; + +class Template +{ + private string $fond; + + public function __construct(string $fond) + { + $this->fond = $fond; + } + + public function render(array $contexte = [], string $connect = ''): string + { + $infos = $this->rawRender($contexte, $connect); + if (!empty($infos['erreurs'])) { + $message = json_encode($infos['erreurs'], \JSON_UNESCAPED_UNICODE|\JSON_PRETTY_PRINT); + if (!$message) { + $erreurs = $infos['erreurs']; + foreach ($erreurs as &$erreur) { + $erreur = reset($erreur); + } + $message = json_encode($erreurs, \JSON_UNESCAPED_UNICODE|\JSON_PRETTY_PRINT); + } + throw new TemplateCompilationErrorException($message); + } + return $infos['texte']; + } + + /** + * Appele recuperer_fond avec l'option raw pour obtenir un tableau d'informations que l'on complete avec le nom du fond + * et les erreurs de compilations generees + */ + public function rawRender(array $contexte = [], string $connect = ''): array + { + // vider les erreurs + $this->init_compilation_errors(); + + // en mode 'raw' ça ne trim pas le texte, sacrebleu ! + $infos = recuperer_fond($this->fond, $contexte, [ + 'raw' => true, + 'trim' => true, + ], $connect); + $infos['texte'] = trim($infos['texte']); + + // on ajoute des infos supplementaires a celles retournees + $path = pathinfo($infos['source']); + $infos['fond'] = $path['dirname'] . '/' . $path['filename']; // = $fond; + $infos['erreurs'] = $this->get_compilation_errors(); + + return $infos; + } + + /** + * Retourne un tableau des erreurs de compilation + */ + private function get_compilation_errors(): array + { + $debusquer = charger_fonction('debusquer', 'public'); + $erreurs = $debusquer('', '', [ + 'erreurs' => 'get', + ]); + $debusquer('', '', [ + 'erreurs' => 'reset', + ]); + return $erreurs; + } + + /** + * Raz les erreurs de compilation + */ + private function init_compilation_errors(): void + { + $debusquer = charger_fonction('debusquer', 'public'); + $debusquer('', '', [ + 'erreurs' => 'reset', + ]); + } +} diff --git a/tests/src/Template/Loader/ChainLoader.php b/tests/src/Template/Loader/ChainLoader.php new file mode 100644 index 0000000000..59146f1cb6 --- /dev/null +++ b/tests/src/Template/Loader/ChainLoader.php @@ -0,0 +1,71 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Testing\Template\Loader; + +use Spip\Core\Testing\Exception\TemplateNotFoundException; + +class ChainLoader implements LoaderInterface +{ + /** + * @var LoaderInterface[] + */ + private array $loaders = []; + + private array $cache = []; + + public function __construct(array $loaders) + { + foreach ($loaders as $loader) { + $this->addLoader($loader); + } + } + + public function exists(string $name): bool + { + if (isset($this->cache[$name])) { + return $this->cache[$name]; + } + + foreach ($this->loaders as $loader) { + if ($loader->exists($name)) { + return $this->cache[$name] = true; + } + } + + return $this->cache[$name] = false; + } + + public function getCacheKey(string $name): string + { + foreach ($this->loaders as $loader) { + if (! $loader->exists($name)) { + continue; + } + + return $loader->getCacheKey($name); + } + + throw new TemplateNotFoundException($name); + } + + public function getSourceFile(string $name): string + { + foreach ($this->loaders as $loader) { + if (! $loader->exists($name)) { + continue; + } + + return $loader->getSourceFile($name); + } + + throw new TemplateNotFoundException($name); + } + + private function addLoader(LoaderInterface $loader) + { + $this->loaders[] = $loader; + $this->cache = []; + } +} diff --git a/tests/src/Template/Loader/FileLoader.php b/tests/src/Template/Loader/FileLoader.php new file mode 100644 index 0000000000..0a93229887 --- /dev/null +++ b/tests/src/Template/Loader/FileLoader.php @@ -0,0 +1,41 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Testing\Template\Loader; + +use Spip\Core\Testing\Exception\TemplateNotFoundException; + +class FileLoader implements LoaderInterface +{ + private int $rootLen; + + public function __construct() + { + $this->rootLen = strlen(_SPIP_TEST_CHDIR) + 1; + } + + public function exists(string $name): bool + { + $filepath = realpath($name); + return ($filepath !== false) && file_exists($filepath); + } + + public function getCacheKey(string $name): string + { + return $this->getSourceFile($name); + } + + public function getSourceFile(string $name): string + { + $filepath = realpath($name); + if (!$filepath or !file_exists($filepath)) { + throw new TemplateNotFoundException($name); + } + + $desc = pathinfo($name); + $fond = $desc['dirname'] . '/' . $desc['filename']; + + return substr($fond, $this->rootLen); + } +} diff --git a/tests/src/Template/Loader/LoaderInterface.php b/tests/src/Template/Loader/LoaderInterface.php new file mode 100644 index 0000000000..c63ccd160a --- /dev/null +++ b/tests/src/Template/Loader/LoaderInterface.php @@ -0,0 +1,14 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Testing\Template\Loader; + +interface LoaderInterface +{ + public function exists(string $name): bool; + + public function getSourceFile(string $name): string; + + public function getCacheKey(string $name): string; +} diff --git a/tests/src/Template/Loader/StringLoader.php b/tests/src/Template/Loader/StringLoader.php new file mode 100644 index 0000000000..be3dc0058e --- /dev/null +++ b/tests/src/Template/Loader/StringLoader.php @@ -0,0 +1,106 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Testing\Template\Loader; + +class StringLoader implements LoaderInterface +{ + private string $adresse_dernier_fichier_pour_code = ''; + + private string $cacheDirectory = ''; + + private array $options = []; + + public function __construct(array $options = []) + { + include_spip('inc/flock'); + $this->cacheDirectory = sous_repertoire(_DIR_CACHE, 'Tests'); + $this->setOptions($options); + } + + public function exists(string $name): bool + { + return true; + } + + public function getCacheKey(string $name): string + { + return md5($name . serialize($this->options)); + } + + /** + * Écrit le code du squelette dans un fichier temporaire de cache + */ + public function getSourceFile(string $name): string + { + $fond = $this->cacheDirectory . $this->getCacheKey($name); + $options = $this->options; + $code = $name; + + if (isset($options['avant_code'])) { + $code = $options['avant_code'] . $code; + } + + if (isset($options['apres_code'])) { + $code .= $options['apres_code']; + } + + $this->ecrire_fichier($fond . '.html', $code); + + if (! empty($options['fonctions'])) { + // un fichier unique pour ces fonctions + $func = $this->cacheDirectory . 'func_' . md5($options['fonctions']) . '.php'; + $this->ecrire_fichier($func, $this->php($options['fonctions'])); + // une inclusion unique de ces fichiers + $this->ecrire_fichier($fond . '_fonctions.php', $this->php(sprintf('include_once(\'%s\');', $func))); + } + + return $fond; + } + + /** + * Définit des options de compilation du code, + * + * Notamment permet de déclarer des filtres (fonctions) pour le code à compiler + * + * Stocke des options : + * - fonctions : pour ajouter un fichier de fonction au squelette cree (on passe le contenu du fichier) + * - avant_code : pour inserer du contenu avant le code + * - apres_code : pour inserer du contenu apres le code + * + * @param array $options : param->valeur des options + */ + private function setOptions(array $options = []): void + { + $this->options = $options; + } + + /** + * Retourne "<?php $code ?>" + * + * @param string $code Code php + * @return string Code php complet + */ + private function php(string $code): string + { + return '<' . "?php\n" . $code . "\n?" . '>'; + } + + /** + * Ecrire un fichier à l'endroit indique + * + * Le réécrit systématiquement. + * + * @param string $filename Adresse du fichier a ecrire + * @param string $content Contenu du fichier + */ + private function ecrire_fichier(string $filename, string $content): void + { + if (file_exists($filename)) { + supprimer_fichier($filename); + } + + ecrire_fichier($filename, $content); + } +} diff --git a/tests/src/Templating.php b/tests/src/Templating.php new file mode 100644 index 0000000000..a46cacfb7a --- /dev/null +++ b/tests/src/Templating.php @@ -0,0 +1,52 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Testing; + +use Spip\Core\Testing\Template\Loader\FileLoader; +use Spip\Core\Testing\Template\Loader\LoaderInterface; +use Spip\Core\Testing\Template\Loader\StringLoader; + +class Templating +{ + private LoaderInterface $loader; + + public function __construct(LoaderInterface $loader) + { + $this->loader = $loader; + } + + public static function fromString(array $options = []): self + { + return new static(new StringLoader($options)); + } + + public static function fromFile(): self + { + return new static(new FileLoader()); + } + + public function getLoader(): LoaderInterface + { + return $this->loader; + } + + public function load(string $name): Template + { + $source = $this->loader->getSourceFile($name); + return new Template($source); + } + + public function render(string $name, array $contexte = [], string $connect = ''): string + { + return $this->load($name) + ->render($contexte, $connect); + } + + public function rawRender(string $name, array $contexte = [], string $connect = ''): array + { + return $this->load($name) + ->rawRender($contexte, $connect); + } +} diff --git a/tests/tests/Action/EditerLiensTest.php b/tests/tests/Action/EditerLiensTest.php new file mode 100644 index 0000000000..e7147ee88f --- /dev/null +++ b/tests/tests/Action/EditerLiensTest.php @@ -0,0 +1,305 @@ +<?php + +declare(strict_types=1); + +/***************************************************************************\ + * SPIP, Système de publication pour l'internet * + * * + * Copyright © avec tendresse depuis 2001 * + * Arnaud Martin, Antoine Pitrou, Philippe Rivière, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribué sous licence GNU/GPL. * + * Pour plus de détails voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +namespace Spip\Core\Tests\Action; + +use PHPUnit\Framework\TestCase; + +class EditerLiensTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + include_spip('action/editer_liens'); + } + + public static function tearDownAfterClass(): void + { + include_spip('base/abstract_sql'); + sql_delete('spip_auteurs_liens', "objet='spirou'"); + sql_delete('spip_auteurs_liens', "objet='zorglub'"); + } + + public function testObjetAssociable() + { + $essais = [ + [ + 0 => false, + 1 => 'article', + ], + [ + 0 => ['id_auteur', 'spip_auteurs_liens'], + 1 => 'auteur', + ], + [ + 0 => ['id_mot', 'spip_mots_liens'], + 1 => 'mot', + ], + [ + 0 => ['id_document', 'spip_documents_liens'], + 1 => 'document', + ], + [ + 0 => false, + 1 => "mot' OR 1=1'", + ], + ]; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, objet_associable(...$essai), "Echec {$k} : objet_associable " . end($essai)); + } + } + + /** + * @depends testObjetAssociable + */ + public function testObjetAssocier() + { + $essais = [ + [ + 0 => false, + 1 => [ + 'article' => 1, + ], + 2 => [ + 'spirou' => 1, + ], + ], + [ + 0 => 1, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'spirou' => 1, + ], + ], + [ + 0 => 0, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'spirou' => 1, + ], + ], + [ + 0 => 2, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'spirou' => [2, 3], + ], + ], + [ + 0 => 1, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'spirou' => [2, 3, 4], + ], + ], + [ + 10, + [ + 'auteur' => 1, + ], + [ + 'zorglub' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], + ], + ], + [ + 6, + [ + 'auteur' => 1, + ], + [ + 'spirou' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], + ], + ], + ]; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals( + $expected, + objet_associer(...$essai), + "Echec {$k} : objet_associer " . json_encode($essai, JSON_THROW_ON_ERROR) + ); + } + } + + /** + * @depends testObjetAssocier + */ + public function testObjetQualifierLiens() + { + $essais = [ + [ + 0 => false, + 1 => [ + 'article' => 1, + ], + 2 => [ + 'zorglub' => 1, + ], + 3 => [ + 'vu' => 'oui', + ], + ], + [ + 0 => 1, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'zorglub' => 1, + ], + 3 => [ + 'vu' => 'oui', + ], + ], + [ + 0 => 1, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'zorglub' => 1, + ], + 3 => [ + 'vu' => 'oui', + ], + ], + [ + 0 => false, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'zorglub' => 1, + ], + 3 => [ + 'veraer' => 'oui', + ], + ], + [ + 0 => 2, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'zorglub' => [2, 3], + ], + 3 => [ + 'vu' => 'oui', + ], + ], + ]; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals( + $expected, + objet_qualifier_liens(...$essai), + "Echec {$k} : objet_qualifier_liens " . json_encode($essai, JSON_THROW_ON_ERROR) + ); + } + } + + /** + * @depends testObjetQualifierLiens + */ + public function testObjetDissocier() + { + $essais = [ + [ + 0 => false, + 1 => [ + 'article' => 1, + ], + 2 => [ + 'zorglub' => 1, + ], + ], + [ + 0 => 1, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'zorglub' => 1, + ], + ], + [ + 0 => 0, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'zorglub' => 1, + ], + ], + [ + 0 => 2, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'zorglub' => [2, 3], + ], + ], + [ + 0 => 1, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'zorglub' => [2, 3, 4], + ], + ], + [ + 0 => 4, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'zorglub' => [5], + 'spirou' => [2, 3, 4], + ], + ], + [ + 0 => 12, + 1 => [ + 'auteur' => 1, + ], + 2 => [ + 'zorglub' => '*', + 'spirou' => '*', + ], + ], + ]; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals( + $expected, + objet_dissocier(...$essai), + "Echec {$k} : objet_dissocier " . json_encode($essai, JSON_THROW_ON_ERROR) + ); + } + } +} diff --git a/tests/tests/Api/AutoriserTest.php b/tests/tests/Api/AutoriserTest.php new file mode 100644 index 0000000000..923fc41687 --- /dev/null +++ b/tests/tests/Api/AutoriserTest.php @@ -0,0 +1,39 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Api; + +use PHPUnit\Framework\TestCase; + +class AutoriserTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + include_spip('inc/autoriser'); + require_once(__DIR__ . '/data/autoriser.php'); + } + + public function testAutoriserOkNiet(): void + { + $this->assertFalse(autoriser('niet')); + $this->assertTrue(autoriser('ok')); + } + + public function testAutoriserNouvelleFonction(): void + { + $this->assertTrue(autoriser('chaparder')); + $this->assertFalse(autoriser('paschaparder')); + $this->assertTrue(autoriser('chaparder', 'velo')); + $this->assertTrue(autoriser('velo', 'chaparder')); + $this->assertTrue(autoriser('chaparder', 'carottes')); + $this->assertTrue(autoriser('carottes', 'chaparder')); + } + + public function testAutoriserIdentifiant(): void + { + $this->assertFalse(autoriser('unidentifiant')); + $this->assertTrue(autoriser('unidentifiant', '', 1)); + $this->assertFalse(autoriser('unidentifiant', '', 2)); + } +} diff --git a/tests/tests/Api/data/autoriser.php b/tests/tests/Api/data/autoriser.php new file mode 100644 index 0000000000..f9c8bec0de --- /dev/null +++ b/tests/tests/Api/data/autoriser.php @@ -0,0 +1,33 @@ +<?php + +declare(strict_types=1); + +function autoriser_chaparder(string $faire, string $type, $id, array $qui, array $opt): bool +{ + return true; +} + +function autoriser_paschaparder(string $faire, string $type, $id, array $qui, array $opt): bool +{ + return false; +} + +function autoriser_chaparder_velo(string $faire, string $type, $id, array $qui, array $opt): bool +{ + return true; +} + +function autoriser_chaparder_carottes_dist(string $faire, string $type, $id, array $qui, array $opt): bool +{ + return false; +} + +function autoriser_chaparder_carottes(string $faire, string $type, $id, array $qui, array $opt): bool +{ + return true; +} + +function autoriser_unidentifiant(string $faire, string $type, $id, array $qui, array $opt): bool +{ + return $id === 1; +} diff --git a/tests/tests/Config/DepotMetaPackTest.php b/tests/tests/Config/DepotMetaPackTest.php new file mode 100644 index 0000000000..b95a946eef --- /dev/null +++ b/tests/tests/Config/DepotMetaPackTest.php @@ -0,0 +1,217 @@ +<?php + +declare(strict_types=1); + +/***************************************************************************\ + * SPIP, Système de publication pour l'internet * + * * + * Copyright © avec tendresse depuis 2001 * + * Arnaud Martin, Antoine Pitrou, Philippe Rivière, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribué sous licence GNU/GPL. * + * Pour plus de détails voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +namespace Spip\Core\Tests\Config; + +use PHPUnit\Framework\TestCase; + +class DepotMetaPackTest extends TestCase +{ + protected static $savedMeta; + + // les bases de test + protected static $assoc; + + protected static $serassoc; + + public static function setUpBeforeClass(): void + { + self::$savedMeta = $GLOBALS['meta']; + self::$assoc = [ + 'one' => 'element 1', + 'two' => 'element 2', + 'three' => [ + 'un' => 1, + 'deux' => 2, + 'troisc' => '3', + ], + ]; + self::$serassoc = serialize(self::$assoc); + } + + public static function tearDownAfterClass(): void + { + $GLOBALS['meta'] = self::$savedMeta; + } + + /** + * lire_config meta + */ + public function testLireConfig1() + { + include_spip('inc/config'); + $meta = $GLOBALS['meta']; + + // on flingue meta a juste nos donnees + $GLOBALS['meta'] = [ + 'zero' => serialize(0), + 'zeroc' => serialize('0'), + 'chaine' => serialize('une chaine'), + 'assoc' => serialize(self::$assoc), + 'serie' => serialize(self::$serassoc), + ]; + + $essais = []; + $essais[] = [$GLOBALS['meta'], 'metapack::']; + $essais[] = [serialize($GLOBALS['meta']), 'metapack::', '', false]; + // racine + $essais[] = [0, 'metapack::zero']; + $essais[] = ['0', 'metapack::zeroc']; + $essais[] = ['une chaine', 'metapack::chaine']; + $essais[] = [self::$assoc, 'metapack::assoc']; + $essais[] = [self::$serassoc, 'metapack::serie']; + $essais[] = [null, 'metapack::rien']; + $essais[] = ['defaut', 'metapack::rien', 'defaut']; + // chemins + $essais[] = [self::$assoc, 'metapack::assoc/']; + $essais[] = ['element 1', 'metapack::assoc/one']; + $essais[] = [[ + 'un' => 1, + 'deux' => 2, + 'troisc' => '3', + ], 'metapack::assoc/three']; + $essais[] = [1, 'metapack::assoc/three/un']; + $essais[] = ['3', 'metapack::assoc/three/troisc']; + // racourcis + $essais[] = [self::$assoc, 'assoc/']; + $essais[] = ['element 1', 'assoc/one']; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, lire_config(...$essai), "Echec {$k} : lecture " . reset($essai)); + } + + $GLOBALS['meta'] = $meta; + } + + /** + * ecrire_config meta + * + * @depends testLireConfig1 + */ + public function testEcrireConfig() + { + /* + * Notes sur l'ecriture : + * - dans le tableau $GLOBALS['meta'], les valeurs transmises + * conservent effectivement leur type + * - si l'on applique un lire_metas() (reecriture du tableau $GLOBALS['meta'] + * depuis les informations de la table spip_meta, les types de valeurs + * sont tous des types string (puisque la colonne 'valeur' de spip_meta est + * varchar (ou text). + * - 0 devient alors '0' + * - array(xxx) devient 'Array' + * + * Cela ne se produit pas avec le depot 'metapack' qui serialize systematiquement + * tout ce qu'on lui donne (et peut donc restituer le type de donnee correctement). + * + */ + $essais = []; + $essais[] = [true, 'metapack::test_cfg_zero', 0]; + $essais[] = [true, 'metapack::test_cfg_zeroc', '0']; + $essais[] = [true, 'metapack::test_cfg_chaine', 'une chaine']; + $essais[] = [true, 'metapack::test_cfg_assoc', self::$assoc]; + $essais[] = [true, 'metapack::test_cfg_serie', self::$serassoc]; + // chemins + $essais[] = [true, 'metapack::test_cfg_chemin/casier', self::$assoc]; + $essais[] = [true, 'metapack::test_cfg_chemin/casier/truc', 'trac']; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, ecrire_config(...$essai), "Echec {$k} : ecriture " . reset($essai)); + } + } + + /** + * re lire_config meta + * + * @depends testEcrireConfig + */ + public function testLireConfig2() + { + $essais = []; + $essais[] = [0, 'metapack::test_cfg_zero']; + $essais[] = ['0', 'metapack::test_cfg_zeroc']; + $essais[] = ['une chaine', 'metapack::test_cfg_chaine']; + $essais[] = [self::$assoc, 'metapack::test_cfg_assoc']; + $essais[] = [self::$serassoc, 'metapack::test_cfg_serie']; + // chemins + $essais[] = [self::$assoc + [ + 'truc' => 'trac', + ], 'metapack::test_cfg_chemin/casier']; + $essais[] = ['trac', 'metapack::test_cfg_chemin/casier/truc']; + $essais[] = [1, 'metapack::test_cfg_chemin/casier/three/un']; + // chemin pas la + $essais[] = [null, 'metapack::test_cfg_chemin/casier/three/huit']; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, lire_config(...$essai), "Echec {$k} : lecture " . reset($essai)); + } + } + + /** + * effacer_config meta + * + * @depends testLireConfig2 + */ + public function testEffacerConfig() + { + $essais = []; + $essais[] = [true, 'metapack::test_cfg_zero']; + $essais[] = [true, 'metapack::test_cfg_zeroc']; + $essais[] = [true, 'metapack::test_cfg_chaine']; + $essais[] = [true, 'metapack::test_cfg_assoc']; + $essais[] = [true, 'metapack::test_cfg_serie']; + // chemins + // on enleve finement tout test_cfg_chemin : il ne doit rien rester + $essais[] = [true, 'metapack::test_cfg_chemin/casier/three/huit']; // n'existe pas + $essais[] = [true, 'metapack::test_cfg_chemin/casier/three/troisc']; + $essais[] = [true, 'metapack::test_cfg_chemin/casier/three/deux']; + $essais[] = [true, 'metapack::test_cfg_chemin/casier/three/un']; // supprime three + $essais[] = [true, 'metapack::test_cfg_chemin/casier/one']; + $essais[] = [true, 'metapack::test_cfg_chemin/casier/two']; + $essais[] = [true, 'metapack::test_cfg_chemin/casier/truc']; // supprimer chemin/casier + + // on essaye d'effacer une meta qui n'existe pas + $essais[] = [true, 'metapack::test_cfg_dummy/casier/truc']; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, effacer_config(...$essai), "Echec {$k} : effacer " . reset($essai)); + } + } + + /** + * re lire_config meta + * + * @depends testEffacerConfig + */ + public function testLireConfig3() + { + $essais = []; + $essais[] = [null, 'metapack::test_cfg_zero']; + $essais[] = [null, 'metapack::test_cfg_zeroc']; + $essais[] = [null, 'metapack::test_cfg_chaine']; + $essais[] = [null, 'metapack::test_cfg_assoc']; + $essais[] = [null, 'metapack::test_cfg_serie']; + $essais[] = [null, 'metapack::test_cfg_chemin']; + $essais[] = [null, 'metapack::test_cfg_dummy']; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, lire_config(...$essai), "Echec {$k} : lecture " . reset($essai)); + } + } +} diff --git a/tests/tests/Config/DepotMetaPersoTest.php b/tests/tests/Config/DepotMetaPersoTest.php new file mode 100644 index 0000000000..72985b6325 --- /dev/null +++ b/tests/tests/Config/DepotMetaPersoTest.php @@ -0,0 +1,198 @@ +<?php + +declare(strict_types=1); + +/***************************************************************************\ + * SPIP, Système de publication pour l'internet * + * * + * Copyright © avec tendresse depuis 2001 * + * Arnaud Martin, Antoine Pitrou, Philippe Rivière, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribué sous licence GNU/GPL. * + * Pour plus de détails voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +namespace Spip\Core\Tests\Config; + +use PHPUnit\Framework\TestCase; + +class DepotMetaPersoTest extends TestCase +{ + protected static $savedMeta; + + // les bases de test + protected static $assoc; + + protected static $serassoc; + + public static function setUpBeforeClass(): void + { + self::$savedMeta = $GLOBALS['meta']; + self::$assoc = [ + 'one' => 'element 1', + 'two' => 'element 2', + ]; + self::$serassoc = serialize(self::$assoc); + } + + public static function tearDownAfterClass(): void + { + $GLOBALS['meta'] = self::$savedMeta; + unset($GLOBALS['toto']); + } + + /** + * lire_config meta + */ + public function testLireConfig1() + { + include_spip('inc/config'); + $meta = $GLOBALS['meta']; + + $trouver_table = charger_fonction('trouver_table', 'base'); + $this->assertArrayNotHasKey('toto', $GLOBALS, 'Une table spip_toto existe deja !'); + $this->assertEmpty($trouver_table('spip_toto'), 'Une table spip_toto existe deja !'); + + // on flingue meta a juste nos donnees + $GLOBALS['meta'] = [ + 'dummy' => '', + ]; + $GLOBALS['toto'] = [ + 'zero' => 0, + 'zeroc' => '0', + 'chaine' => 'une chaine', + 'assoc' => self::$assoc, + 'serie' => self::$serassoc, + ]; + + $essais = []; + $essais[] = [0, '/toto/zero']; + $essais[] = ['0', '/toto/zeroc']; + $essais[] = ['une chaine', '/toto/chaine']; + $essais[] = [self::$assoc, '/toto/assoc']; + $essais[] = [self::$assoc, '/toto/serie']; + $essais[] = [self::$serassoc, '/toto/serie', '', 0]; + $essais[] = [null, '/toto/rien']; + $essais[] = ['defaut', '/toto/rien', 'defaut']; + $essais[] = [null, '/meta/chaine']; + $essais[] = [null, 'chaine']; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, lire_config(...$essai), "Echec {$k} : lecture " . reset($essai)); + } + + $GLOBALS['meta'] = $meta; + unset($GLOBALS['toto']); + } + + /** + * ecrire_config meta + * + * @depends testLireConfig1 + */ + public function testEcrireConfig() + { + /* + * Notes sur l'ecriture : + * - dans le tableau $GLOBALS['meta'], les valeurs transmises + * conservent effectivement leur type + * - si l'on applique un lire_metas() (reecriture du tableau $GLOBALS['meta'] + * depuis les informations de la table spip_meta, les types de valeurs + * sont tous des types string (puisque la colonne 'valeur' de spip_meta est + * varchar (ou text). + * - 0 devient alors '0' + * - array(xxx) devient 'Array' + * + * Cela ne se produit pas avec le depot 'metapack' qui serialize systematiquement + * tout ce qu'on lui donne (et peut donc restituer le type de donnee correctement). + * + */ + $essais = []; + $essais[] = [true, '/toto/test_cfg_zero', 0]; + $essais[] = [true, '/toto/test_cfg_zeroc', '0']; + $essais[] = [true, '/toto/test_cfg_chaine', 'une chaine']; + $essais[] = [true, '/toto/test_cfg_assoc', self::$assoc]; + $essais[] = [true, '/toto/test_cfg_serie', self::$serassoc]; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, ecrire_config(...$essai), "Echec {$k} : ecriture " . reset($essai)); + } + + $trouver_table = charger_fonction('trouver_table', 'base'); + $this->assertNotEmpty($GLOBALS['toto'], "La table spip_toto n'a pas ete cree !"); + $this->assertNotEmpty($trouver_table('spip_toto'), "La table spip_toto n'a pas ete cree !"); + } + + /** + * re lire_config meta + * + * @depends testEcrireConfig + */ + public function testLireConfig2() + { + $essais = []; + $essais[] = [0, '/toto/test_cfg_zero']; + $essais[] = ['0', '/toto/test_cfg_zeroc']; + $essais[] = ['une chaine', '/toto/test_cfg_chaine']; + $essais[] = [self::$assoc, '/toto/test_cfg_assoc']; + $essais[] = [self::$serassoc, '/toto/test_cfg_serie', '', 0]; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, lire_config(...$essai), "Echec {$k} : lecture " . reset($essai)); + } + } + + /** + * effacer_config meta + * + * @depends testLireConfig2 + */ + public function testEffacerConfig() + { + $essais = []; + $essais[] = [true, '/toto/test_cfg_zero']; + $essais[] = [true, '/toto/test_cfg_zeroc']; + $essais[] = [true, '/toto/test_cfg_chaine']; + $essais[] = [true, '/toto/test_cfg_assoc']; + $essais[] = [true, '/toto/test_cfg_serie']; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, effacer_config(...$essai), "Echec {$k} : effacer " . reset($essai)); + } + } + + /** + * re lire_config meta + * + * @depends testEffacerConfig + */ + public function testLireConfig3() + { + $essais = []; + $essais[] = [null, '/toto/test_cfg_zero']; + $essais[] = [null, '/toto/test_cfg_zeroc']; + $essais[] = [null, '/toto/test_cfg_chaine']; + $essais[] = [null, '/toto/test_cfg_assoc']; + $essais[] = [null, '/toto/test_cfg_serie']; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, lire_config(...$essai), "Echec {$k} : lecture " . reset($essai)); + } + + $trouver_table = charger_fonction('trouver_table', 'base'); + $this->assertArrayNotHasKey( + 'toto', + $GLOBALS, + "La table spip_toto n'a pas ete supprimee par le dernier effacement de config !" + ); + $this->assertEmpty( + $trouver_table('spip_toto'), + "La table spip_toto n'a pas ete supprimee par le dernier effacement de config !" + ); + } +} diff --git a/tests/tests/Config/DepotMetaTest.php b/tests/tests/Config/DepotMetaTest.php new file mode 100644 index 0000000000..5eb02720d9 --- /dev/null +++ b/tests/tests/Config/DepotMetaTest.php @@ -0,0 +1,205 @@ +<?php + +declare(strict_types=1); + +/***************************************************************************\ + * SPIP, Système de publication pour l'internet * + * * + * Copyright © avec tendresse depuis 2001 * + * Arnaud Martin, Antoine Pitrou, Philippe Rivière, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribué sous licence GNU/GPL. * + * Pour plus de détails voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +namespace Spip\Core\Tests\Config; + +use PHPUnit\Framework\TestCase; + +class DepotMetaTest extends TestCase +{ + protected static $savedMeta; + + // les bases de test + protected static $assoc; + + protected static $serassoc; + + public static function setUpBeforeClass(): void + { + self::$savedMeta = $GLOBALS['meta']; + self::$assoc = [ + 'one' => 'element 1', + 'two' => 'element 2', + ]; + self::$serassoc = serialize(self::$assoc); + include_spip('inc/config'); + } + + public static function tearDownAfterClass(): void + { + $GLOBALS['meta'] = self::$savedMeta; + } + + /** + * expliquer_config + */ + public function testExpliquerConfig() + { + $essais = []; + $essais[] = [['meta', null, []], '']; + $essais[] = [['meta', '0', []], '0']; + $essais[] = [['meta', 'casier', []], 'casier']; + $essais[] = [['meta', 'casier', ['sous']], 'casier/sous']; + $essais[] = [['meta', 'casier', ['sous', 'plus', 'bas', 'encore']], 'casier/sous/plus/bas/encore']; + + $essais[] = [['meta', null, []], '/meta']; + $essais[] = [['meta', 'casier', []], '/meta/casier']; + $essais[] = [['meta', 'casier', ['sous']], '/meta/casier/sous']; + $essais[] = [['meta', 'casier', ['sous', 'plus', 'bas', 'encore']], '/meta/casier/sous/plus/bas/encore']; + + $essais[] = [['toto', null, []], '/toto']; + $essais[] = [['toto', 'casier', []], '/toto/casier']; + $essais[] = [['toto', 'casier', ['sous']], '/toto/casier/sous']; + $essais[] = [['toto', 'casier', ['sous', 'plus', 'bas', 'encore']], '/toto/casier/sous/plus/bas/encore']; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, expliquer_config(...$essai), "Echec {$k} : lecture " . end($essai)); + } + } + + /** + * lire_config meta + * + * @depends testExpliquerConfig + */ + public function testLireConfig1() + { + $meta = $GLOBALS['meta']; + + // on flingue meta a juste nos donnees + $GLOBALS['meta'] = [ + 'zero' => 0, + 'zeroc' => '0', + 'chaine' => 'une chaine', + 'assoc' => self::$assoc, + 'serie' => self::$serassoc, + ]; + + $essais = []; + $essais[] = [$GLOBALS['meta'], '']; + $essais[] = [0, 'zero']; + $essais[] = ['0', 'zeroc']; + $essais[] = ['une chaine', 'chaine']; + $essais[] = [self::$assoc, 'assoc']; + $essais[] = [self::$assoc, 'serie']; + $essais[] = [self::$serassoc, 'serie', '', 0]; + $essais[] = [null, 'rien']; + $essais[] = ['defaut', 'rien', 'defaut']; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, lire_config(...$essai), "Echec {$k} : lecture " . reset($essai)); + } + + $GLOBALS['meta'] = $meta; + } + + /** + * ecrire_config meta + * + * @depends testLireConfig1 + */ + public function testEcrireConfig() + { + /* + * Notes sur l'ecriture : + * - dans le tableau $GLOBALS['meta'], les valeurs transmises + * conservent effectivement leur type + * - si l'on applique un lire_metas() (reecriture du tableau $GLOBALS['meta'] + * depuis les informations de la table spip_meta, les types de valeurs + * sont tous des types string (puisque la colonne 'valeur' de spip_meta est + * varchar (ou text). + * - 0 devient alors '0' + * - array(xxx) devient 'Array' + * + * Cela ne se produit pas avec le depot 'metapack' qui serialize systematiquement + * tout ce qu'on lui donne (et peut donc restituer le type de donnee correctement). + * + */ + $essais = []; + $essais[] = [true, 'test_cfg_zero', 0]; + $essais[] = [true, 'test_cfg_zeroc', '0']; + $essais[] = [true, 'test_cfg_chaine', 'une chaine']; + $essais[] = [true, 'test_cfg_assoc', self::$assoc]; + $essais[] = [true, 'test_cfg_serie', self::$serassoc]; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, ecrire_config(...$essai), "Echec {$k} : ecriture " . reset($essai)); + } + } + + /** + * re lire_config meta + * + * @depends testEcrireConfig + */ + public function testLireConfig2() + { + $essais = []; + $essais[] = [0, 'test_cfg_zero']; + $essais[] = ['0', 'test_cfg_zeroc']; + $essais[] = ['une chaine', 'test_cfg_chaine']; + $essais[] = [self::$assoc, 'test_cfg_assoc']; + $essais[] = [self::$serassoc, 'test_cfg_serie', '', 0]; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, lire_config(...$essai), "Echec {$k} : lecture " . reset($essai)); + } + } + + /** + * effacer_config meta + * + * @depends testLireConfig2 + */ + public function testEffacerConfig() + { + $essais = []; + $essais[] = [true, 'test_cfg_zero']; + $essais[] = [true, 'test_cfg_zeroc']; + $essais[] = [true, 'test_cfg_chaine']; + $essais[] = [true, 'test_cfg_assoc']; + $essais[] = [true, 'test_cfg_serie']; + $essais[] = [true, 'test_cfg_dummy']; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, effacer_config(...$essai), "Echec {$k} : effacer " . reset($essai)); + } + } + + /** + * re lire_config meta + * + * @depends testEffacerConfig + */ + public function testLireConfig3() + { + $essais = []; + $essais[] = [null, 'test_cfg_zero']; + $essais[] = [null, 'test_cfg_zeroc']; + $essais[] = [null, 'test_cfg_chaine']; + $essais[] = [null, 'test_cfg_assoc']; + $essais[] = [null, 'test_cfg_serie']; + $essais[] = [null, 'test_cfg_dummy']; + + foreach ($essais as $k => $essai) { + $expected = array_shift($essai); + $this->assertEquals($expected, lire_config(...$essai), "Echec {$k} : lecture " . reset($essai)); + } + } +} diff --git a/tests/tests/Distant/NeedProxyTest.php b/tests/tests/Distant/NeedProxyTest.php new file mode 100644 index 0000000000..33c00f71b3 --- /dev/null +++ b/tests/tests/Distant/NeedProxyTest.php @@ -0,0 +1,65 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction need_proxy du fichier ./inc/distant.php + */ + +namespace Spip\Core\Tests\Distant; + +use PHPUnit\Framework\TestCase; + +class NeedProxyTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/distant.php', '', true); + } + + /** + * @dataProvider providerDistantNeedProxy + */ + public function testDistantNeedProxy($expected, ...$args): void + { + $actual = need_proxy(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerDistantNeedProxy(): array + { + return [ + 0 => [ + 0 => 'http://monproxy.example.org', + 1 => 'sous.domaine.spip.net', + 2 => 'http://monproxy.example.org', + 3 => 'spip.net', + ], + 1 => [ + 0 => '', + 1 => 'sous.domaine.spip.net', + 2 => 'http://monproxy.example.org', + 3 => '.spip.net', + ], + 2 => [ + 0 => '', + 1 => 'sous.domaine.spip.net', + 2 => 'http://monproxy.example.org', + 3 => '.spip.net +.net', + ], + 3 => [ + 0 => '', + 1 => 'sous.domaine.spip.net', + 2 => 'http://monproxy.example.org', + 3 => 'sous.domaine.spip.net', + ], + 4 => [ + 0 => 'http://monproxy.example.org', + 1 => 'sous.domaine.spip.net', + 2 => 'http://monproxy.example.org', + 3 => '.sous.domaine.spip.net', + ], + ]; + } +} diff --git a/tests/tests/Distant/UrlToAsciiTest.php b/tests/tests/Distant/UrlToAsciiTest.php new file mode 100644 index 0000000000..f4856a67be --- /dev/null +++ b/tests/tests/Distant/UrlToAsciiTest.php @@ -0,0 +1,58 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction url_to_ascii du fichier ./inc/distant.php + */ + +namespace Spip\Core\Tests\Distant; + +use PHPUnit\Framework\TestCase; + +class UrlToAsciiTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/distant.php', '', true); + } + + /** + * @dataProvider providerDistantUrlToAscii + */ + public function testDistantUrlToAscii($expected, ...$args): void + { + $actual = url_to_ascii(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerDistantUrlToAscii(): array + { + return [ + 0 => [ + 0 => 'http://www.spip.net/', + 1 => 'http://www.spip.net/', + ], + 1 => [ + 0 => 'http://www.spip.net/fr_article879.html#BOUCLE-ARTICLES-', + 1 => 'http://www.spip.net/fr_article879.html#BOUCLE-ARTICLES-', + ], + 2 => [ + 0 => 'http://user:pass@www.spip.net:80/fr_article879.html#BOUCLE-ARTICLES-', + 1 => 'http://user:pass@www.spip.net:80/fr_article879.html#BOUCLE-ARTICLES-', + ], + 3 => [ + 0 => 'http://www.xn--spap-7pa.net/', + 1 => 'http://www.spaïp.net/', + ], + 4 => [ + 0 => 'http://www.xn--spap-7pa.net/fr_article879.html#BOUCLE-ARTICLES-', + 1 => 'http://www.spaïp.net/fr_article879.html#BOUCLE-ARTICLES-', + ], + 5 => [ + 0 => 'http://user:pass@www.xn--spap-7pa.net:80/fr_article879.html#BOUCLE-ARTICLES-', + 1 => 'http://user:pass@www.spaïp.net:80/fr_article879.html#BOUCLE-ARTICLES-', + ], + ]; + } +} diff --git a/tests/tests/Distant/ValiderUrlDistanteTest.php b/tests/tests/Distant/ValiderUrlDistanteTest.php new file mode 100644 index 0000000000..e20882094a --- /dev/null +++ b/tests/tests/Distant/ValiderUrlDistanteTest.php @@ -0,0 +1,87 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction valider_url_distante du fichier ./inc/distant.php + */ + +namespace Spip\Core\Tests\Distant; + +use PHPUnit\Framework\TestCase; + +class ValiderUrlDistanteTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/distant.php', '', true); + } + + /** + * @dataProvider providerDistantValiderUrlDistante + */ + public function testDistantValiderUrlDistante($expected, ...$args): void + { + $actual = valider_url_distante(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerDistantValiderUrlDistante(): array + { + return [ + 0 => [ + 0 => 'http://www.spip.net', + 1 => 'http://www.spip.net', + ], + 1 => [ + 0 => 'https://www.spip.net', + 1 => 'https://www.spip.net', + ], + 2 => [ + 0 => false, + 1 => 'ftp://www.spip.net', + ], + 3 => [ + 0 => false, + 1 => 'http://user@www.spip.net', + ], + 4 => [ + 0 => false, + 1 => 'https://user:password@www.spip.net', + ], + 5 => [ + 0 => false, + 1 => 'http://127.0.0.1/munin/graph.png', + ], + 6 => [ + 0 => false, + 1 => 'http://localhost:8765', + ], + 7 => [ + 0 => 'http://localhost:8765/test.png', + 1 => 'http://localhost:8765/test.png', + 2 => [ + 0 => 'localhost:8765', + ], + ], + 8 => [ + 0 => false, + 1 => 'http://localhost:9100/test.png', + ], + 9 => [ + 0 => false, + 1 => 'http://user@password:localhost:8765/test.png', + 2 => [ + 0 => 'localhost:8765', + ], + ], + 10 => [ + 0 => false, + 1 => 'http://user@password:localhost:8765/test.png', + 2 => [ + 0 => 'http://user@password:localhost:8765', + ], + ], + ]; + } +} diff --git a/tests/tests/Filtre/AjouterClassTest.php b/tests/tests/Filtre/AjouterClassTest.php new file mode 100644 index 0000000000..dad5df2be2 --- /dev/null +++ b/tests/tests/Filtre/AjouterClassTest.php @@ -0,0 +1,54 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction ajouter_class du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class AjouterClassTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresAjouterClass + */ + public function testFiltresAjouterClass($expected, ...$args): void + { + $actual = ajouter_class(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresAjouterClass(): array + { + return [ + 0 => [ + 0 => "<span class='maclasse maclasse-prefixe suffixe-maclasse maclasse--bem autreclass'>toto</span>", + 1 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 2 => 'autreclass', + ], + 1 => [ + 0 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 1 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 2 => 'maclasse', + ], + 2 => [ + 0 => "<span class='maclasse-prefixe suffixe-maclasse maclasse--bem maclasse'>toto</span>", + 1 => '<span class="maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 2 => 'maclasse', + ], + 3 => [ + 0 => "<span class='maclasse maclasse-prefixe suffixe-maclasse maclasse--bem maclasse1 maclasse2'>toto</span>", + 1 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 2 => 'maclasse1 maclasse maclasse2', + ], + ]; + } +} diff --git a/tests/tests/Filtre/AntispamTest.php b/tests/tests/Filtre/AntispamTest.php new file mode 100644 index 0000000000..b51e6343c9 --- /dev/null +++ b/tests/tests/Filtre/AntispamTest.php @@ -0,0 +1,26 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction antispam du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class AntispamTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + public function testFiltresAntispam(): void + { + $actual = antispam('email@domain.tld'); + $this->assertStringNotContainsString('@', $actual); + } + +} diff --git a/tests/tests/Filtre/AppliquerFiltreTest.php b/tests/tests/Filtre/AppliquerFiltreTest.php new file mode 100644 index 0000000000..2e42be4f51 --- /dev/null +++ b/tests/tests/Filtre/AppliquerFiltreTest.php @@ -0,0 +1,44 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction appliquer_filtre du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class AppliquerFiltreTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresAppliquerFiltre + */ + public function testFiltresAppliquerFiltre($expected, ...$args): void + { + $actual = appliquer_filtre(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresAppliquerFiltre(): array + { + return [ + 0 => [ + 0 => '<>"'&', + 1 => '<>"\'&', + 2 => 'entites_html', + ], + 1 => [ + 0 => '&', + 1 => '&', + 2 => 'entites_html', + ], + ]; + } +} diff --git a/tests/tests/Filtre/ChercherFiltreTest.php b/tests/tests/Filtre/ChercherFiltreTest.php new file mode 100644 index 0000000000..0c43c1206e --- /dev/null +++ b/tests/tests/Filtre/ChercherFiltreTest.php @@ -0,0 +1,480 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction chercher_filtre du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class ChercherFiltreTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresChercherFiltre + */ + public function testFiltresChercherFiltre($expected, ...$args): void + { + $actual = chercher_filtre(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresChercherFiltre(): array + { + return [ + 0 => [ + 0 => 'filtre_identite_dist', + 1 => 'identite', + ], + 1 => [ + 0 => 'identite', + 1 => 'zzhkezhkf', + 2 => 'identite', + ], + 3 => [ + 0 => 'identite', + 1 => null, + 2 => 'identite', + ], + 4 => [ + 0 => 'filtre_text_dist', + 1 => 'text', + ], + 5 => [ + 0 => 'filtre_implode_dist', + 1 => 'implode', + ], + 6 => [ + 0 => 'filtre_image_dist', + 1 => 'image/jpeg', + ], + 7 => [ + 0 => 'filtre_image_dist', + 1 => 'image/png', + ], + 8 => [ + 0 => 'filtre_image_dist', + 1 => 'image/gif', + ], + 9 => [ + 0 => 'filtre_image_dist', + 1 => 'image/x-ms-bmp', + ], + 10 => [ + 0 => 'filtre_image_dist', + 1 => 'image/tiff', + ], + 11 => [ + 0 => 'filtre_audio_dist', + 1 => 'audio/x-aiff', + ], + 12 => [ + 0 => 'filtre_video_dist', + 1 => 'video/x-ms-asf', + ], + 13 => [ + 0 => 'filtre_video_dist', + 1 => 'video/x-msvideo', + ], + 14 => [ + 0 => 'filtre_application_dist', + 1 => 'application/annodex', + ], + 15 => [ + 0 => 'filtre_audio_dist', + 1 => 'audio/annodex', + ], + 16 => [ + 0 => 'filtre_video_dist', + 1 => 'video/annodex', + ], + 17 => [ + 0 => 'filtre_video_dist', + 1 => 'video/x-dv', + ], + 18 => [ + 0 => 'filtre_audio_dist', + 1 => 'audio/x-flac', + ], + 19 => [ + 0 => 'filtre_video_dist', + 1 => 'video/x-flv', + ], + 20 => [ + 0 => 'filtre_audio_dist', + 1 => 'audio/mp4a-latm', + ], + 23 => [ + 0 => 'filtre_video_dist', + 1 => 'video/vnd.mpegurl', + ], + 24 => [ + 0 => 'filtre_video_dist', + 1 => 'video/x-m4v', + ], + 25 => [ + 0 => 'filtre_audio_dist', + 1 => 'audio/midi', + ], + 26 => [ + 0 => 'filtre_audio_dist', + 1 => 'audio/mka', + ], + 27 => [ + 0 => 'filtre_video_dist', + 1 => 'video/mkv', + ], + 28 => [ + 0 => 'filtre_video_dist', + 1 => 'video/x-mng', + ], + 29 => [ + 0 => 'filtre_video_dist', + 1 => 'video/quicktime', + ], + 30 => [ + 0 => 'filtre_audio_dist', + 1 => 'audio/mpeg', + ], + 31 => [ + 0 => 'filtre_application_dist', + 1 => 'application/mp4', + ], + 32 => [ + 0 => 'filtre_video_dist', + 1 => 'video/mpeg', + ], + 33 => [ + 0 => 'filtre_audio_dist', + 1 => 'audio/ogg', + ], + 34 => [ + 0 => 'filtre_audio_dist', + 1 => 'audio/ogg ', + ], + 35 => [ + 0 => 'filtre_video_dist', + 1 => 'video/ogg ', + ], + 36 => [ + 0 => 'filtre_application_dist', + 1 => 'application/ogg ', + ], + 38 => [ + 0 => 'filtre_audio_x_pn_realaudio', + 1 => 'audio/x-pn-realaudio', + ], + 42 => [ + 0 => 'filtre_image_dist', + 1 => 'image/svg+xml', + ], + 43 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-shockwave-flash', + ], + 44 => [ + 0 => 'filtre_audio_dist', + 1 => 'audio/x-wav', + ], + 45 => [ + 0 => 'filtre_video_dist', + 1 => 'video/x-ms-wmv', + ], + 46 => [ + 0 => 'filtre_video_dist', + 1 => 'video/3gpp', + ], + 47 => [ + 0 => 'filtre_application_dist', + 1 => 'application/illustrator', + ], + 48 => [ + 0 => 'filtre_application_dist', + 1 => 'application/abiword', + ], + 49 => [ + 0 => 'filtre_application_dist', + 1 => 'application/octet-stream', + ], + 50 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-blender', + ], + 51 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-bzip2', + ], + 52 => [ + 0 => 'filtre_text_dist', + 1 => 'text/x-csrc', + ], + 53 => [ + 0 => 'filtre_text_dist', + 1 => 'text/css', + ], + 54 => [ + 0 => 'filtre_text_csv_dist', + 1 => 'text/csv', + ], + 55 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-debian-package', + ], + 56 => [ + 0 => 'filtre_application_dist', + 1 => 'application/msword', + ], + 57 => [ + 0 => 'filtre_image_dist', + 1 => 'image/vnd.djvu', + ], + 58 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-dvi', + ], + 59 => [ + 0 => 'filtre_application_dist', + 1 => 'application/postscript', + ], + 60 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-gzip', + ], + 61 => [ + 0 => 'filtre_text_dist', + 1 => 'text/x-chdr', + ], + 62 => [ + 0 => 'filtre_text_html_dist', + 1 => 'text/html', + ], + 63 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.google-earth.kml+xml', + ], + 64 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.google-earth.kmz', + ], + 65 => [ + 0 => 'filtre_text_dist', + 1 => 'text/x-pascal', + ], + 66 => [ + 0 => 'filtre_application_dist', + 1 => 'application/pdf', + ], + 67 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-chess-pgn', + ], + 68 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.ms-powerpoint', + ], + 70 => [ + 0 => 'filtre_image_dist', + 1 => 'image/x-photoshop', + ], + 71 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-redhat-package-manager', + ], + 72 => [ + 0 => 'filtre_application_dist', + 1 => 'application/rtf', + ], + 73 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.stardivision.impress', + ], + 74 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.stardivision.writer', + ], + 75 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-stuffit', + ], + 76 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.sun.xml.calc', + ], + 77 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.sun.xml.impress', + ], + 78 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.sun.xml.writer', + ], + 79 => [ + 0 => 'filtre_text_dist', + 1 => 'text/x-tex', + ], + 80 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-gtar', + ], + 81 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-bittorrent', + ], + 82 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-font-ttf', + ], + 83 => [ + 0 => 'filtre_text_dist', + 1 => 'text/plain', + ], + 84 => [ + 0 => 'filtre_application_dist', + 1 => 'application/x-xcf', + ], + 85 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.ms-excel', + ], + 86 => [ + 0 => 'filtre_application_dist', + 1 => 'application/xspf+xml', + ], + 87 => [ + 0 => 'filtre_application_dist', + 1 => 'application/xml', + ], + 88 => [ + 0 => 'filtre_application_dist', + 1 => 'application/zip', + ], + 89 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.text', + ], + 90 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.spreadsheet', + ], + 91 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.presentation', + ], + 92 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.graphics', + ], + 93 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.chart', + ], + 94 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.formula', + ], + 95 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.database', + ], + 96 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.image', + ], + 97 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.text-master', + ], + 98 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.text-template', + ], + 99 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.spreadsheet-template', + ], + 100 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.presentation-template', + ], + 101 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.oasis.opendocument.graphics-template', + ], + 104 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.ms-word.document.macroEnabled.12', + ], + 105 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + ], + 106 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.ms-word.template.macroEnabled.12', + ], + 107 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + ], + 108 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.ms-powerpoint.template.macroEnabled.12', + ], + 109 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.openxmlformats-officedocument.presentationml.template', + ], + 110 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', + ], + 111 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + ], + 112 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + ], + 113 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + ], + 114 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + ], + 115 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.ms-excel.addin.macroEnabled.12', + ], + 116 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + ], + 117 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.ms-excel.sheet.macroEnabled.12', + ], + 118 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + ], + 119 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.ms-excel.template.macroEnabled.12', + ], + 120 => [ + 0 => 'filtre_application_dist', + 1 => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + ], + ]; + } +} diff --git a/tests/tests/Filtre/CommuterClassTest.php b/tests/tests/Filtre/CommuterClassTest.php new file mode 100644 index 0000000000..d6bd45deee --- /dev/null +++ b/tests/tests/Filtre/CommuterClassTest.php @@ -0,0 +1,54 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction commuter_class du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class CommuterClassTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresCommuterClass + */ + public function testFiltresCommuterClass($expected, ...$args): void + { + $actual = commuter_class(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresCommuterClass(): array + { + return [ + 0 => [ + 0 => "<span class='maclasse-prefixe suffixe-maclasse maclasse--bem'>toto</span>", + 1 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 2 => 'maclasse', + ], + 1 => [ + 0 => "<span class='maclasse maclasse-prefixe suffixe-maclasse maclasse--bem autreclass'>toto</span>", + 1 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 2 => 'autreclass', + ], + 2 => [ + 0 => "<span class='maclasse-prefixe suffixe-maclasse maclasse--bem maclasse1 maclasse2'>toto</span>", + 1 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 2 => 'maclasse1 maclasse maclasse2', + ], + 3 => [ + 0 => "<span class='maclasse maclasse--bem <span class="maclasse maclasse--bem">toto</span>'>toto</span>", + 1 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 2 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + ], + ]; + } +} diff --git a/tests/tests/Filtre/CorrigerEntitesHtmlTest.php b/tests/tests/Filtre/CorrigerEntitesHtmlTest.php new file mode 100644 index 0000000000..a401744cde --- /dev/null +++ b/tests/tests/Filtre/CorrigerEntitesHtmlTest.php @@ -0,0 +1,84 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction corriger_entites_html du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class CorrigerEntitesHtmlTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresCorrigerEntitesHtml + */ + public function testFiltresCorrigerEntitesHtml($expected, ...$args): void + { + $actual = corriger_entites_html(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresCorrigerEntitesHtml(): array + { + return [ + 0 => [ + 0 => '', + 1 => '', + ], + 1 => [ + 0 => '0', + 1 => '0', + ], + 2 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 3 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + ], + 4 => [ + 0 => 'Un texte avec des entit&eacute;s echap&eacute; &&lt;&gt;&quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + ], + 5 => [ + 0 => 'Un texte avec des entités numériques &<>"', + 1 => 'Un texte avec des entités numériques &<>"', + ], + 6 => [ + 0 => 'Un texte avec des entités numériques echapées &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + ], + 7 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + ], + 8 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 9 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 10 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/AffdateCourtTest.php b/tests/tests/Filtre/Date/AffdateCourtTest.php new file mode 100644 index 0000000000..39a1d8353f --- /dev/null +++ b/tests/tests/Filtre/Date/AffdateCourtTest.php @@ -0,0 +1,405 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction affdate_court du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class AffdateCourtTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresAffdateCourt + */ + public function testFiltresAffdateCourt($expected, ...$args): void + { + changer_langue('fr'); + $actual = affdate_court(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresAffdateCourt(): array + { + return [ + 0 => [ + 0 => ' 2001', + 1 => '2001-00-00 12:33:44', + 2 => '2011', + ], + 1 => [ + 0 => 'Mars 2001', + 1 => '2001-03-00 09:12:57', + 2 => '2011', + ], + 2 => [ + 0 => 'Février 2001', + 1 => '2001-02-29 14:12:33', + 2 => '2011', + ], + 3 => [ + 0 => '0000', + 1 => '0000-00-00', + 2 => '2011', + ], + 4 => [ + 0 => '0001', + 1 => '0001-01-01', + 2 => '2011', + ], + 5 => [ + 0 => 'Janvier 1970', + 1 => '1970-01-01', + 2 => '2011', + ], + 6 => [ + 0 => 'Juillet 2001', + 1 => '2001-07-05 18:25:24', + 2 => '2011', + ], + 7 => [ + 0 => 'Janvier 2001', + 1 => '2001-01-01 00:00:00', + 2 => '2011', + ], + 8 => [ + 0 => 'Décembre 2001', + 1 => '2001-12-31 23:59:59', + 2 => '2011', + ], + 9 => [ + 0 => 'Mars 2001', + 1 => '2001-03-01 14:12:33', + 2 => '2011', + ], + 10 => [ + 0 => 'Février 2004', + 1 => '2004-02-29 14:12:33', + 2 => '2011', + ], + 11 => [ + 0 => 'Mars 2012', + 1 => '2012-03-20 12:00:00', + 2 => '2011', + ], + 12 => [ + 0 => 'Mars 2012', + 1 => '2012-03-21 12:00:00', + 2 => '2011', + ], + 13 => [ + 0 => 'Mars 2012', + 1 => '2012-03-22 12:00:00', + 2 => '2011', + ], + 14 => [ + 0 => 'Juin 2012', + 1 => '2012-06-20 12:00:00', + 2 => '2011', + ], + 15 => [ + 0 => 'Juin 2012', + 1 => '2012-06-21 12:00:00', + 2 => '2011', + ], + 16 => [ + 0 => 'Juin 2012', + 1 => '2012-06-22 12:00:00', + 2 => '2011', + ], + 17 => [ + 0 => 'Septembre 2012', + 1 => '2012-09-20 12:00:00', + 2 => '2011', + ], + 18 => [ + 0 => 'Septembre 2012', + 1 => '2012-09-21 12:00:00', + 2 => '2011', + ], + 19 => [ + 0 => 'Septembre 2012', + 1 => '2012-09-22 12:00:00', + 2 => '2011', + ], + 20 => [ + 0 => 'Décembre 2012', + 1 => '2012-12-20 12:00:00', + 2 => '2011', + ], + 21 => [ + 0 => 'Décembre 2012', + 1 => '2012-12-21 12:00:00', + 2 => '2011', + ], + 22 => [ + 0 => 'Décembre 2012', + 1 => '2012-12-22 12:00:00', + 2 => '2011', + ], + 23 => [ + 0 => 'Juillet 2001', + 1 => '2001-07-05', + 2 => '2011', + ], + 24 => [ + 0 => 'Janvier 2001', + 1 => '2001-01-01', + 2 => '2011', + ], + 25 => [ + 0 => 'Décembre 2001', + 1 => '2001-12-31', + 2 => '2011', + ], + 26 => [ + 0 => 'Mars 2001', + 1 => '2001-03-01', + 2 => '2011', + ], + 27 => [ + 0 => 'Février 2004', + 1 => '2004-02-29', + 2 => '2011', + ], + 28 => [ + 0 => 'Mars 2012', + 1 => '2012-03-20', + 2 => '2011', + ], + 29 => [ + 0 => 'Mars 2012', + 1 => '2012-03-21', + 2 => '2011', + ], + 30 => [ + 0 => 'Mars 2012', + 1 => '2012-03-22', + 2 => '2011', + ], + 31 => [ + 0 => 'Juin 2012', + 1 => '2012-06-20', + 2 => '2011', + ], + 32 => [ + 0 => 'Juin 2012', + 1 => '2012-06-21', + 2 => '2011', + ], + 33 => [ + 0 => 'Juin 2012', + 1 => '2012-06-22', + 2 => '2011', + ], + 34 => [ + 0 => 'Septembre 2012', + 1 => '2012-09-20', + 2 => '2011', + ], + 35 => [ + 0 => 'Septembre 2012', + 1 => '2012-09-21', + 2 => '2011', + ], + 36 => [ + 0 => 'Septembre 2012', + 1 => '2012-09-22', + 2 => '2011', + ], + 37 => [ + 0 => 'Décembre 2012', + 1 => '2012-12-20', + 2 => '2011', + ], + 38 => [ + 0 => 'Décembre 2012', + 1 => '2012-12-21', + 2 => '2011', + ], + 39 => [ + 0 => 'Décembre 2012', + 1 => '2012-12-22', + 2 => '2011', + ], + 40 => [ + 0 => 'Juillet 2005', + 1 => '2001/07/05', + 2 => '2011', + ], + 41 => [ + 0 => 'Janvier 2001', + 1 => '2001/01/01', + 2 => '2011', + ], + 42 => [ + 0 => 'Décembre 2031', + 1 => '2001/12/31', + 2 => '2011', + ], + 43 => [ + 0 => 'Mars 2001', + 1 => '2001/03/01', + 2 => '2011', + ], + 44 => [ + 0 => 'Février 2029', + 1 => '2004/02/29', + 2 => '2011', + ], + 45 => [ + 0 => 'Mars 2020', + 1 => '2012/03/20', + 2 => '2011', + ], + 46 => [ + 0 => 'Mars 2021', + 1 => '2012/03/21', + 2 => '2011', + ], + 47 => [ + 0 => 'Mars 2022', + 1 => '2012/03/22', + 2 => '2011', + ], + 48 => [ + 0 => 'Juin 2020', + 1 => '2012/06/20', + 2 => '2011', + ], + 49 => [ + 0 => 'Juin 2021', + 1 => '2012/06/21', + 2 => '2011', + ], + 50 => [ + 0 => 'Juin 2022', + 1 => '2012/06/22', + 2 => '2011', + ], + 51 => [ + 0 => 'Septembre 2020', + 1 => '2012/09/20', + 2 => '2011', + ], + 52 => [ + 0 => 'Septembre 2021', + 1 => '2012/09/21', + 2 => '2011', + ], + 53 => [ + 0 => 'Septembre 2022', + 1 => '2012/09/22', + 2 => '2011', + ], + 54 => [ + 0 => 'Décembre 2020', + 1 => '2012/12/20', + 2 => '2011', + ], + 55 => [ + 0 => 'Décembre 2021', + 1 => '2012/12/21', + 2 => '2011', + ], + 56 => [ + 0 => 'Décembre 2022', + 1 => '2012/12/22', + 2 => '2011', + ], + 57 => [ + 0 => 'Juillet 2001', + 1 => '05/07/2001', + 2 => '2011', + ], + 58 => [ + 0 => 'Janvier 2001', + 1 => '01/01/2001', + 2 => '2011', + ], + 59 => [ + 0 => 'Décembre 2001', + 1 => '31/12/2001', + 2 => '2011', + ], + 60 => [ + 0 => 'Mars 2001', + 1 => '01/03/2001', + 2 => '2011', + ], + 61 => [ + 0 => 'Février 2004', + 1 => '29/02/2004', + 2 => '2011', + ], + 62 => [ + 0 => 'Mars 2012', + 1 => '20/03/2012', + 2 => '2011', + ], + 63 => [ + 0 => 'Mars 2012', + 1 => '21/03/2012', + 2 => '2011', + ], + 64 => [ + 0 => 'Mars 2012', + 1 => '22/03/2012', + 2 => '2011', + ], + 65 => [ + 0 => 'Juin 2012', + 1 => '20/06/2012', + 2 => '2011', + ], + 66 => [ + 0 => 'Juin 2012', + 1 => '21/06/2012', + 2 => '2011', + ], + 67 => [ + 0 => 'Juin 2012', + 1 => '22/06/2012', + 2 => '2011', + ], + 68 => [ + 0 => 'Septembre 2012', + 1 => '20/09/2012', + 2 => '2011', + ], + 69 => [ + 0 => 'Septembre 2012', + 1 => '21/09/2012', + 2 => '2011', + ], + 70 => [ + 0 => 'Septembre 2012', + 1 => '22/09/2012', + 2 => '2011', + ], + 71 => [ + 0 => 'Décembre 2012', + 1 => '20/12/2012', + 2 => '2011', + ], + 72 => [ + 0 => 'Décembre 2012', + 1 => '21/12/2012', + 2 => '2011', + ], + 73 => [ + 0 => 'Décembre 2012', + 1 => '22/12/2012', + 2 => '2011', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/AffdateDebutFinTest.php b/tests/tests/Filtre/Date/AffdateDebutFinTest.php new file mode 100644 index 0000000000..80c1eee6f9 --- /dev/null +++ b/tests/tests/Filtre/Date/AffdateDebutFinTest.php @@ -0,0 +1,279 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +/** + * Test unitaire de la fonction affdate_debut_fin du fichier ./inc/filtres.php + */ +class AffDateDebutFinTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + // Pour que le tests soit independant de la timezone du serveur + ini_set('date.timezone', 'Europe/Paris'); + changer_langue('fr'); // ce test est en fr + } + + /** + * @dataProvider providerAffdateDebutFin + */ + public function testAffdateDebutFin($expected, ...$args): void + { + $this->assertEquals($expected, affdate_debut_fin(...$args)); + } + + public static function providerAffdateDebutFin(): array + { + return [ + 0 => + [ + 0 => 'Dimanche 1er juillet 2001 à 12h34', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-01 12:34:00', + 3 => true, + ], + 1 => + [ + 0 => 'Dimanche 1er juillet 2001', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-01 12:34:00', + 3 => false, + ], + 2 => + [ + 0 => 'Dimanche 1er juillet 2001 de 12h34 à 13h34', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-01 13:34:00', + 3 => true, + ], + 3 => + [ + 0 => 'Dimanche 1er juillet 2001', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-01 13:34:00', + 3 => false, + ], + 4 => + [ + 0 => 'Du 1er juillet à 12h34 au 2 juillet 2001 à 12h34', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-02 12:34:00', + 3 => true, + ], + 5 => + [ + 0 => 'Du 1er au 2 juillet 2001', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-02 12:34:00', + 3 => false, + ], + 6 => + [ + 0 => 'Du 1er juillet à 12h34 au 2 juillet 2001 à 13h34', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-02 13:34:00', + 3 => true, + ], + 7 => + [ + 0 => 'Du 1er au 2 juillet 2001', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-02 13:34:00', + 3 => false, + ], + 8 => + [ + 0 => 'Du 1er juillet à 12h34 au 1er août 2001 à 12h34', + 1 => '2001-07-01 12:34:00', + 2 => '2001-08-01 12:34:00', + 3 => true, + ], + 9 => + [ + 0 => 'Du 1er juillet au 1er août 2001', + 1 => '2001-07-01 12:34:00', + 2 => '2001-08-01 12:34:00', + 3 => false, + ], + 10 => + [ + 0 => 'Du 1er juillet 2001 à 12h34 au 1er juillet 2011 à 12h34', + 1 => '2001-07-01 12:34:00', + 2 => '2011-07-01 12:34:00', + 3 => true, + ], + 11 => + [ + 0 => 'Du 1er juillet 2001 au 1er juillet 2011', + 1 => '2001-07-01 12:34:00', + 2 => '2011-07-01 12:34:00', + 3 => false, + ], + 12 => + [ + 0 => 'Dim. 1er juillet 2001 à 12h34', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-01 12:34:00', + 3 => true, + 4 => 'abbr', + ], + 13 => + [ + 0 => 'Dim. 1er juillet 2001', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-01 12:34:00', + 3 => false, + 4 => 'abbr', + ], + 14 => + [ + 0 => 'Dim. 1er juillet 2001 de 12h34 à 13h34', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-01 13:34:00', + 3 => true, + 4 => 'abbr', + ], + 15 => + [ + 0 => 'Dim. 1er juillet 2001', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-01 13:34:00', + 3 => false, + 4 => 'abbr', + ], + 16 => + [ + 0 => 'Du 1er juillet à 12h34 au 2 juillet 2001 à 12h34', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-02 12:34:00', + 3 => true, + 4 => 'abbr', + ], + 17 => + [ + 0 => 'Du 1er au 2 juillet 2001', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-02 12:34:00', + 3 => false, + 4 => 'abbr', + ], + 18 => + [ + 0 => 'Du 1er juillet à 12h34 au 1er août 2001 à 12h34', + 1 => '2001-07-01 12:34:00', + 2 => '2001-08-01 12:34:00', + 3 => true, + 4 => 'abbr', + ], + 19 => + [ + 0 => 'Du 1er juillet au 1er août 2001', + 1 => '2001-07-01 12:34:00', + 2 => '2001-08-01 12:34:00', + 3 => false, + 4 => 'abbr', + ], + 20 => + [ + 0 => 'Du 1er juillet 2001 à 12h34 au 1er juillet 2011 à 12h34', + 1 => '2001-07-01 12:34:00', + 2 => '2011-07-01 12:34:00', + 3 => true, + 4 => 'abbr', + ], + 21 => + [ + 0 => 'Du 1er juillet 2001 au 1er juillet 2011', + 1 => '2001-07-01 12:34:00', + 2 => '2011-07-01 12:34:00', + 3 => false, + 4 => 'abbr', + ], + 22 => + [ + 0 => "<abbr class='dtstart' title='2001-07-01T10:34:00Z'>Dimanche 1er juillet 2001 à 12h34</abbr>", + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-01 12:34:00', + 3 => true, + 4 => 'hcal', + ], + 23 => + [ + 0 => "<abbr class='dtstart' title='2001-07-01T10:34:00Z'>Dimanche 1er juillet 2001</abbr>", + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-01 12:34:00', + 3 => false, + 4 => 'hcal', + ], + 24 => + [ + 0 => "<abbr class='dtstart' title='2001-07-01T10:34:00Z'>Dimanche 1er juillet 2001 de 12h34</abbr> à <abbr class='dtend' title='2001-07-01T11:34:00Z'>13h34</abbr>", + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-01 13:34:00', + 3 => true, + 4 => 'hcal', + ], + 25 => + [ + 0 => "<abbr class='dtstart' title='2001-07-01T10:34:00Z'>Dimanche 1er juillet 2001</abbr>", + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-01 13:34:00', + 3 => false, + 4 => 'hcal', + ], + 26 => + [ + 0 => 'Du <abbr class="dtstart" title="2001-07-01T10:34:00Z">1er juillet à 12h34</abbr> au <abbr class="dtend" title="2001-07-02T10:34:00Z">2 juillet 2001 à 12h34</abbr>', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-02 12:34:00', + 3 => true, + 4 => 'hcal', + ], + 27 => + [ + 0 => 'Du <abbr class="dtstart" title="2001-07-01T10:34:00Z">1er</abbr> au <abbr class="dtend" title="2001-07-02T10:34:00Z">2 juillet 2001</abbr>', + 1 => '2001-07-01 12:34:00', + 2 => '2001-07-02 12:34:00', + 3 => false, + 4 => 'hcal', + ], + 28 => + [ + 0 => 'Du <abbr class="dtstart" title="2001-07-01T10:34:00Z">1er juillet à 12h34</abbr> au <abbr class="dtend" title="2001-08-01T10:34:00Z">1er août 2001 à 12h34</abbr>', + 1 => '2001-07-01 12:34:00', + 2 => '2001-08-01 12:34:00', + 3 => true, + 4 => 'hcal', + ], + 29 => + [ + 0 => 'Du <abbr class="dtstart" title="2001-07-01T10:34:00Z">1er juillet</abbr> au <abbr class="dtend" title="2001-08-01T10:34:00Z">1er août 2001</abbr>', + 1 => '2001-07-01 12:34:00', + 2 => '2001-08-01 12:34:00', + 3 => false, + 4 => 'hcal', + ], + 30 => + [ + 0 => 'Du <abbr class="dtstart" title="2001-07-01T10:34:00Z">1er juillet 2001 à 12h34</abbr> au <abbr class="dtend" title="2011-07-01T10:34:00Z">1er juillet 2011 à 12h34</abbr>', + 1 => '2001-07-01 12:34:00', + 2 => '2011-07-01 12:34:00', + 3 => true, + 4 => 'hcal', + ], + 31 => + [ + 0 => 'Du <abbr class="dtstart" title="2001-07-01T10:34:00Z">1er juillet 2001</abbr> au <abbr class="dtend" title="2011-07-01T10:34:00Z">1er juillet 2011</abbr>', + 1 => '2001-07-01 12:34:00', + 2 => '2011-07-01 12:34:00', + 3 => false, + 4 => 'hcal', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/AffdateHeureTest.php b/tests/tests/Filtre/Date/AffdateHeureTest.php new file mode 100644 index 0000000000..a45adddc79 --- /dev/null +++ b/tests/tests/Filtre/Date/AffdateHeureTest.php @@ -0,0 +1,336 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction affdate_heure du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class AffdateHeureTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + changer_langue('fr'); + // ce test est en fr + } + + /** + * @dataProvider providerFiltresAffdateHeure + */ + public function testFiltresAffdateHeure($expected, ...$args): void + { + $actual = affdate_heure(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresAffdateHeure(): array + { + return [ + 0 => [ + 0 => '2001 à 12h33min', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => 'mars 2001 à 09h12min', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => '29 février 2001 à 14h12min', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '0000 à 0h0min', + 1 => '0000-00-00', + ], + 4 => [ + 0 => '1er janvier 0001 à 0h0min', + 1 => '0001-01-01', + ], + 5 => [ + 0 => '1er janvier 1970 à 0h0min', + 1 => '1970-01-01', + ], + 6 => [ + 0 => '5 juillet 2001 à 18h25min', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => '1er janvier 2001 à 00h00min', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => '31 décembre 2001 à 23h59min', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => '1er mars 2001 à 14h12min', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => '29 février 2004 à 14h12min', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => '20 mars 2012 à 12h00min', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => '21 mars 2012 à 12h00min', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => '22 mars 2012 à 12h00min', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => '20 juin 2012 à 12h00min', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => '21 juin 2012 à 12h00min', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => '22 juin 2012 à 12h00min', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => '20 septembre 2012 à 12h00min', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => '21 septembre 2012 à 12h00min', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => '22 septembre 2012 à 12h00min', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => '20 décembre 2012 à 12h00min', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => '21 décembre 2012 à 12h00min', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => '22 décembre 2012 à 12h00min', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => '5 juillet 2001 à 0h0min', + 1 => '2001-07-05', + ], + 24 => [ + 0 => '1er janvier 2001 à 0h0min', + 1 => '2001-01-01', + ], + 25 => [ + 0 => '31 décembre 2001 à 0h0min', + 1 => '2001-12-31', + ], + 26 => [ + 0 => '1er mars 2001 à 0h0min', + 1 => '2001-03-01', + ], + 27 => [ + 0 => '29 février 2004 à 0h0min', + 1 => '2004-02-29', + ], + 28 => [ + 0 => '20 mars 2012 à 0h0min', + 1 => '2012-03-20', + ], + 29 => [ + 0 => '21 mars 2012 à 0h0min', + 1 => '2012-03-21', + ], + 30 => [ + 0 => '22 mars 2012 à 0h0min', + 1 => '2012-03-22', + ], + 31 => [ + 0 => '20 juin 2012 à 0h0min', + 1 => '2012-06-20', + ], + 32 => [ + 0 => '21 juin 2012 à 0h0min', + 1 => '2012-06-21', + ], + 33 => [ + 0 => '22 juin 2012 à 0h0min', + 1 => '2012-06-22', + ], + 34 => [ + 0 => '20 septembre 2012 à 0h0min', + 1 => '2012-09-20', + ], + 35 => [ + 0 => '21 septembre 2012 à 0h0min', + 1 => '2012-09-21', + ], + 36 => [ + 0 => '22 septembre 2012 à 0h0min', + 1 => '2012-09-22', + ], + 37 => [ + 0 => '20 décembre 2012 à 0h0min', + 1 => '2012-12-20', + ], + 38 => [ + 0 => '21 décembre 2012 à 0h0min', + 1 => '2012-12-21', + ], + 39 => [ + 0 => '22 décembre 2012 à 0h0min', + 1 => '2012-12-22', + ], + 40 => [ + 0 => '1er juillet 2005 à 0h0min', + 1 => '2001/07/05', + ], + 41 => [ + 0 => '1er janvier 2001 à 0h0min', + 1 => '2001/01/01', + ], + 42 => [ + 0 => '1er décembre 2031 à 0h0min', + 1 => '2001/12/31', + ], + 43 => [ + 0 => '1er mars 2001 à 0h0min', + 1 => '2001/03/01', + ], + 44 => [ + 0 => '4 février 2029 à 0h0min', + 1 => '2004/02/29', + ], + 45 => [ + 0 => '12 mars 2020 à 0h0min', + 1 => '2012/03/20', + ], + 46 => [ + 0 => '12 mars 2021 à 0h0min', + 1 => '2012/03/21', + ], + 47 => [ + 0 => '12 mars 2022 à 0h0min', + 1 => '2012/03/22', + ], + 48 => [ + 0 => '12 juin 2020 à 0h0min', + 1 => '2012/06/20', + ], + 49 => [ + 0 => '12 juin 2021 à 0h0min', + 1 => '2012/06/21', + ], + 50 => [ + 0 => '12 juin 2022 à 0h0min', + 1 => '2012/06/22', + ], + 51 => [ + 0 => '12 septembre 2020 à 0h0min', + 1 => '2012/09/20', + ], + 52 => [ + 0 => '12 septembre 2021 à 0h0min', + 1 => '2012/09/21', + ], + 53 => [ + 0 => '12 septembre 2022 à 0h0min', + 1 => '2012/09/22', + ], + 54 => [ + 0 => '12 décembre 2020 à 0h0min', + 1 => '2012/12/20', + ], + 55 => [ + 0 => '12 décembre 2021 à 0h0min', + 1 => '2012/12/21', + ], + 56 => [ + 0 => '12 décembre 2022 à 0h0min', + 1 => '2012/12/22', + ], + 57 => [ + 0 => '5 juillet 2001 à 0h0min', + 1 => '05/07/2001', + ], + 58 => [ + 0 => '1er janvier 2001 à 0h0min', + 1 => '01/01/2001', + ], + 59 => [ + 0 => '31 décembre 2001 à 0h0min', + 1 => '31/12/2001', + ], + 60 => [ + 0 => '1er mars 2001 à 0h0min', + 1 => '01/03/2001', + ], + 61 => [ + 0 => '29 février 2004 à 0h0min', + 1 => '29/02/2004', + ], + 62 => [ + 0 => '20 mars 2012 à 0h0min', + 1 => '20/03/2012', + ], + 63 => [ + 0 => '21 mars 2012 à 0h0min', + 1 => '21/03/2012', + ], + 64 => [ + 0 => '22 mars 2012 à 0h0min', + 1 => '22/03/2012', + ], + 65 => [ + 0 => '20 juin 2012 à 0h0min', + 1 => '20/06/2012', + ], + 66 => [ + 0 => '21 juin 2012 à 0h0min', + 1 => '21/06/2012', + ], + 67 => [ + 0 => '22 juin 2012 à 0h0min', + 1 => '22/06/2012', + ], + 68 => [ + 0 => '20 septembre 2012 à 0h0min', + 1 => '20/09/2012', + ], + 69 => [ + 0 => '21 septembre 2012 à 0h0min', + 1 => '21/09/2012', + ], + 70 => [ + 0 => '22 septembre 2012 à 0h0min', + 1 => '22/09/2012', + ], + 71 => [ + 0 => '20 décembre 2012 à 0h0min', + 1 => '20/12/2012', + ], + 72 => [ + 0 => '21 décembre 2012 à 0h0min', + 1 => '21/12/2012', + ], + 73 => [ + 0 => '22 décembre 2012 à 0h0min', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/AffdateJourcourtTest.php b/tests/tests/Filtre/Date/AffdateJourcourtTest.php new file mode 100644 index 0000000000..3e3509331d --- /dev/null +++ b/tests/tests/Filtre/Date/AffdateJourcourtTest.php @@ -0,0 +1,410 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction affdate_jourcourt du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class AffdateJourcourtTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + changer_langue('fr'); + // ce test est en fr + } + + /** + * @dataProvider providerFiltresAffdateJourcourt + */ + public function testFiltresAffdateJourcourt($expected, ...$args): void + { + $actual = affdate_jourcourt(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresAffdateJourcourt(): array + { + return [ + 0 => [ + 0 => ' 2001', + 1 => '2001-00-00 12:33:44', + 2 => '2011', + ], + 1 => [ + 0 => ' mars 2001', + 1 => '2001-03-00 09:12:57', + 2 => '2011', + ], + 2 => [ + 0 => '29 février 2001', + 1 => '2001-02-29 14:12:33', + 2 => '2011', + ], + 3 => [ + 0 => '0000', + 1 => '0000-00-00', + 2 => '2011', + ], + 4 => [ + 0 => '0001', + 1 => '0001-01-01', + 2 => '2011', + ], + 5 => [ + 0 => '1er janvier 1970', + 1 => '1970-01-01', + 2 => '2011', + ], + 6 => [ + 0 => '5 juillet 2001', + 1 => '2001-07-05 18:25:24', + 2 => '2011', + ], + 7 => [ + 0 => '1er janvier 2001', + 1 => '2001-01-01 00:00:00', + 2 => '2011', + ], + 8 => [ + 0 => '31 décembre 2001', + 1 => '2001-12-31 23:59:59', + 2 => '2011', + ], + 9 => [ + 0 => '1er mars 2001', + 1 => '2001-03-01 14:12:33', + 2 => '2011', + ], + 10 => [ + 0 => '29 février 2004', + 1 => '2004-02-29 14:12:33', + 2 => '2011', + ], + 11 => [ + 0 => '20 mars 2012', + 1 => '2012-03-20 12:00:00', + 2 => '2011', + ], + 12 => [ + 0 => '21 mars 2012', + 1 => '2012-03-21 12:00:00', + 2 => '2011', + ], + 13 => [ + 0 => '22 mars 2012', + 1 => '2012-03-22 12:00:00', + 2 => '2011', + ], + 14 => [ + 0 => '20 juin 2012', + 1 => '2012-06-20 12:00:00', + 2 => '2011', + ], + 15 => [ + 0 => '21 juin 2012', + 1 => '2012-06-21 12:00:00', + 2 => '2011', + ], + 16 => [ + 0 => '22 juin 2012', + 1 => '2012-06-22 12:00:00', + 2 => '2011', + ], + 17 => [ + 0 => '20 septembre 2012', + 1 => '2012-09-20 12:00:00', + 2 => '2011', + ], + 18 => [ + 0 => '21 septembre 2012', + 1 => '2012-09-21 12:00:00', + 2 => '2011', + ], + 19 => [ + 0 => '22 septembre 2012', + 1 => '2012-09-22 12:00:00', + 2 => '2011', + ], + 20 => [ + 0 => '20 décembre 2012', + 1 => '2012-12-20 12:00:00', + 2 => '2011', + ], + 21 => [ + 0 => '21 décembre 2012', + 1 => '2012-12-21 12:00:00', + 2 => '2011', + ], + 22 => [ + 0 => '22 décembre 2012', + 1 => '2012-12-22 12:00:00', + 2 => '2011', + ], + 23 => [ + 0 => '5 juillet 2001', + 1 => '2001-07-05', + 2 => '2011', + ], + 24 => [ + 0 => '1er janvier 2001', + 1 => '2001-01-01', + 2 => '2011', + ], + 25 => [ + 0 => '31 décembre 2001', + 1 => '2001-12-31', + 2 => '2011', + ], + 26 => [ + 0 => '1er mars 2001', + 1 => '2001-03-01', + 2 => '2011', + ], + 27 => [ + 0 => '29 février 2004', + 1 => '2004-02-29', + 2 => '2011', + ], + 28 => [ + 0 => '20 mars 2012', + 1 => '2012-03-20', + 2 => '2011', + ], + 29 => [ + 0 => '21 mars 2012', + 1 => '2012-03-21', + 2 => '2011', + ], + 30 => [ + 0 => '22 mars 2012', + 1 => '2012-03-22', + 2 => '2011', + ], + 31 => [ + 0 => '20 juin 2012', + 1 => '2012-06-20', + 2 => '2011', + ], + 32 => [ + 0 => '21 juin 2012', + 1 => '2012-06-21', + 2 => '2011', + ], + 33 => [ + 0 => '22 juin 2012', + 1 => '2012-06-22', + 2 => '2011', + ], + 34 => [ + 0 => '20 septembre 2012', + 1 => '2012-09-20', + 2 => '2011', + ], + 35 => [ + 0 => '21 septembre 2012', + 1 => '2012-09-21', + 2 => '2011', + ], + 36 => [ + 0 => '22 septembre 2012', + 1 => '2012-09-22', + 2 => '2011', + ], + 37 => [ + 0 => '20 décembre 2012', + 1 => '2012-12-20', + 2 => '2011', + ], + 38 => [ + 0 => '21 décembre 2012', + 1 => '2012-12-21', + 2 => '2011', + ], + 39 => [ + 0 => '22 décembre 2012', + 1 => '2012-12-22', + 2 => '2011', + ], + 40 => [ + 0 => '1er juillet 2005', + 1 => '2001/07/05', + 2 => '2011', + ], + 41 => [ + 0 => '1er janvier 2001', + 1 => '2001/01/01', + 2 => '2011', + ], + 42 => [ + 0 => '1er décembre 2031', + 1 => '2001/12/31', + 2 => '2011', + ], + 43 => [ + 0 => '1er mars 2001', + 1 => '2001/03/01', + 2 => '2011', + ], + 44 => [ + 0 => '4 février 2029', + 1 => '2004/02/29', + 2 => '2011', + ], + 45 => [ + 0 => '12 mars 2020', + 1 => '2012/03/20', + 2 => '2011', + ], + 46 => [ + 0 => '12 mars 2021', + 1 => '2012/03/21', + 2 => '2011', + ], + 47 => [ + 0 => '12 mars 2022', + 1 => '2012/03/22', + 2 => '2011', + ], + 48 => [ + 0 => '12 juin 2020', + 1 => '2012/06/20', + 2 => '2011', + ], + 49 => [ + 0 => '12 juin 2021', + 1 => '2012/06/21', + 2 => '2011', + ], + 50 => [ + 0 => '12 juin 2022', + 1 => '2012/06/22', + 2 => '2011', + ], + 51 => [ + 0 => '12 septembre 2020', + 1 => '2012/09/20', + 2 => '2011', + ], + 52 => [ + 0 => '12 septembre 2021', + 1 => '2012/09/21', + 2 => '2011', + ], + 53 => [ + 0 => '12 septembre 2022', + 1 => '2012/09/22', + 2 => '2011', + ], + 54 => [ + 0 => '12 décembre 2020', + 1 => '2012/12/20', + 2 => '2011', + ], + 55 => [ + 0 => '12 décembre 2021', + 1 => '2012/12/21', + 2 => '2011', + ], + 56 => [ + 0 => '12 décembre 2022', + 1 => '2012/12/22', + 2 => '2011', + ], + 57 => [ + 0 => '5 juillet 2001', + 1 => '05/07/2001', + 2 => '2011', + ], + 58 => [ + 0 => '1er janvier 2001', + 1 => '01/01/2001', + 2 => '2011', + ], + 59 => [ + 0 => '31 décembre 2001', + 1 => '31/12/2001', + 2 => '2011', + ], + 60 => [ + 0 => '1er mars 2001', + 1 => '01/03/2001', + 2 => '2011', + ], + 61 => [ + 0 => '29 février 2004', + 1 => '29/02/2004', + 2 => '2011', + ], + 62 => [ + 0 => '20 mars 2012', + 1 => '20/03/2012', + 2 => '2011', + ], + 63 => [ + 0 => '21 mars 2012', + 1 => '21/03/2012', + 2 => '2011', + ], + 64 => [ + 0 => '22 mars 2012', + 1 => '22/03/2012', + 2 => '2011', + ], + 65 => [ + 0 => '20 juin 2012', + 1 => '20/06/2012', + 2 => '2011', + ], + 66 => [ + 0 => '21 juin 2012', + 1 => '21/06/2012', + 2 => '2011', + ], + 67 => [ + 0 => '22 juin 2012', + 1 => '22/06/2012', + 2 => '2011', + ], + 68 => [ + 0 => '20 septembre 2012', + 1 => '20/09/2012', + 2 => '2011', + ], + 69 => [ + 0 => '21 septembre 2012', + 1 => '21/09/2012', + 2 => '2011', + ], + 70 => [ + 0 => '22 septembre 2012', + 1 => '22/09/2012', + 2 => '2011', + ], + 71 => [ + 0 => '20 décembre 2012', + 1 => '20/12/2012', + 2 => '2011', + ], + 72 => [ + 0 => '21 décembre 2012', + 1 => '21/12/2012', + 2 => '2011', + ], + 73 => [ + 0 => '22 décembre 2012', + 1 => '22/12/2012', + 2 => '2011', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/AffdateMoisAnneeTest.php b/tests/tests/Filtre/Date/AffdateMoisAnneeTest.php new file mode 100644 index 0000000000..53a75dc0fe --- /dev/null +++ b/tests/tests/Filtre/Date/AffdateMoisAnneeTest.php @@ -0,0 +1,336 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction affdate_mois_annee du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class AffdateMoisAnneeTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + changer_langue('fr'); + // ce test est en fr + } + + /** + * @dataProvider providerFiltresAffdateMoisAnnee + */ + public function testFiltresAffdateMoisAnnee($expected, ...$args): void + { + $actual = affdate_mois_annee(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresAffdateMoisAnnee(): array + { + return [ + 0 => [ + 0 => '2001', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => 'mars 2001', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => 'février 2001', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '0000', + 1 => '0000-00-00', + ], + 4 => [ + 0 => 'janvier 0001', + 1 => '0001-01-01', + ], + 5 => [ + 0 => 'janvier 1970', + 1 => '1970-01-01', + ], + 6 => [ + 0 => 'juillet 2001', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => 'janvier 2001', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => 'décembre 2001', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => 'mars 2001', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => 'février 2004', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => 'mars 2012', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => 'mars 2012', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => 'mars 2012', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => 'juin 2012', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => 'juin 2012', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => 'juin 2012', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => 'septembre 2012', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => 'septembre 2012', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => 'septembre 2012', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => 'décembre 2012', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => 'décembre 2012', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => 'décembre 2012', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => 'juillet 2001', + 1 => '2001-07-05', + ], + 24 => [ + 0 => 'janvier 2001', + 1 => '2001-01-01', + ], + 25 => [ + 0 => 'décembre 2001', + 1 => '2001-12-31', + ], + 26 => [ + 0 => 'mars 2001', + 1 => '2001-03-01', + ], + 27 => [ + 0 => 'février 2004', + 1 => '2004-02-29', + ], + 28 => [ + 0 => 'mars 2012', + 1 => '2012-03-20', + ], + 29 => [ + 0 => 'mars 2012', + 1 => '2012-03-21', + ], + 30 => [ + 0 => 'mars 2012', + 1 => '2012-03-22', + ], + 31 => [ + 0 => 'juin 2012', + 1 => '2012-06-20', + ], + 32 => [ + 0 => 'juin 2012', + 1 => '2012-06-21', + ], + 33 => [ + 0 => 'juin 2012', + 1 => '2012-06-22', + ], + 34 => [ + 0 => 'septembre 2012', + 1 => '2012-09-20', + ], + 35 => [ + 0 => 'septembre 2012', + 1 => '2012-09-21', + ], + 36 => [ + 0 => 'septembre 2012', + 1 => '2012-09-22', + ], + 37 => [ + 0 => 'décembre 2012', + 1 => '2012-12-20', + ], + 38 => [ + 0 => 'décembre 2012', + 1 => '2012-12-21', + ], + 39 => [ + 0 => 'décembre 2012', + 1 => '2012-12-22', + ], + 40 => [ + 0 => 'juillet 2005', + 1 => '2001/07/05', + ], + 41 => [ + 0 => 'janvier 2001', + 1 => '2001/01/01', + ], + 42 => [ + 0 => 'décembre 2031', + 1 => '2001/12/31', + ], + 43 => [ + 0 => 'mars 2001', + 1 => '2001/03/01', + ], + 44 => [ + 0 => 'février 2029', + 1 => '2004/02/29', + ], + 45 => [ + 0 => 'mars 2020', + 1 => '2012/03/20', + ], + 46 => [ + 0 => 'mars 2021', + 1 => '2012/03/21', + ], + 47 => [ + 0 => 'mars 2022', + 1 => '2012/03/22', + ], + 48 => [ + 0 => 'juin 2020', + 1 => '2012/06/20', + ], + 49 => [ + 0 => 'juin 2021', + 1 => '2012/06/21', + ], + 50 => [ + 0 => 'juin 2022', + 1 => '2012/06/22', + ], + 51 => [ + 0 => 'septembre 2020', + 1 => '2012/09/20', + ], + 52 => [ + 0 => 'septembre 2021', + 1 => '2012/09/21', + ], + 53 => [ + 0 => 'septembre 2022', + 1 => '2012/09/22', + ], + 54 => [ + 0 => 'décembre 2020', + 1 => '2012/12/20', + ], + 55 => [ + 0 => 'décembre 2021', + 1 => '2012/12/21', + ], + 56 => [ + 0 => 'décembre 2022', + 1 => '2012/12/22', + ], + 57 => [ + 0 => 'juillet 2001', + 1 => '05/07/2001', + ], + 58 => [ + 0 => 'janvier 2001', + 1 => '01/01/2001', + ], + 59 => [ + 0 => 'décembre 2001', + 1 => '31/12/2001', + ], + 60 => [ + 0 => 'mars 2001', + 1 => '01/03/2001', + ], + 61 => [ + 0 => 'février 2004', + 1 => '29/02/2004', + ], + 62 => [ + 0 => 'mars 2012', + 1 => '20/03/2012', + ], + 63 => [ + 0 => 'mars 2012', + 1 => '21/03/2012', + ], + 64 => [ + 0 => 'mars 2012', + 1 => '22/03/2012', + ], + 65 => [ + 0 => 'juin 2012', + 1 => '20/06/2012', + ], + 66 => [ + 0 => 'juin 2012', + 1 => '21/06/2012', + ], + 67 => [ + 0 => 'juin 2012', + 1 => '22/06/2012', + ], + 68 => [ + 0 => 'septembre 2012', + 1 => '20/09/2012', + ], + 69 => [ + 0 => 'septembre 2012', + 1 => '21/09/2012', + ], + 70 => [ + 0 => 'septembre 2012', + 1 => '22/09/2012', + ], + 71 => [ + 0 => 'décembre 2012', + 1 => '20/12/2012', + ], + 72 => [ + 0 => 'décembre 2012', + 1 => '21/12/2012', + ], + 73 => [ + 0 => 'décembre 2012', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/AnneeTest.php b/tests/tests/Filtre/Date/AnneeTest.php new file mode 100644 index 0000000000..a945daa711 --- /dev/null +++ b/tests/tests/Filtre/Date/AnneeTest.php @@ -0,0 +1,330 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction annee du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class AnneeTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresAnnee + */ + public function testFiltresAnnee($expected, ...$args): void + { + $actual = annee(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresAnnee(): array + { + return [ + 0 => [ + 0 => '2001', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => '2001', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => '2001', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '0000', + 1 => '0000-00-00', + ], + 4 => [ + 0 => '0001', + 1 => '0001-01-01', + ], + 5 => [ + 0 => '1970', + 1 => '1970-01-01', + ], + 6 => [ + 0 => '2001', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => '2001', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => '2001', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => '2001', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => '2004', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => '2012', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => '2012', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => '2012', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => '2012', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => '2012', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => '2012', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => '2012', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => '2012', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => '2012', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => '2012', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => '2012', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => '2012', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => '2001', + 1 => '2001-07-05', + ], + 24 => [ + 0 => '2001', + 1 => '2001-01-01', + ], + 25 => [ + 0 => '2001', + 1 => '2001-12-31', + ], + 26 => [ + 0 => '2001', + 1 => '2001-03-01', + ], + 27 => [ + 0 => '2004', + 1 => '2004-02-29', + ], + 28 => [ + 0 => '2012', + 1 => '2012-03-20', + ], + 29 => [ + 0 => '2012', + 1 => '2012-03-21', + ], + 30 => [ + 0 => '2012', + 1 => '2012-03-22', + ], + 31 => [ + 0 => '2012', + 1 => '2012-06-20', + ], + 32 => [ + 0 => '2012', + 1 => '2012-06-21', + ], + 33 => [ + 0 => '2012', + 1 => '2012-06-22', + ], + 34 => [ + 0 => '2012', + 1 => '2012-09-20', + ], + 35 => [ + 0 => '2012', + 1 => '2012-09-21', + ], + 36 => [ + 0 => '2012', + 1 => '2012-09-22', + ], + 37 => [ + 0 => '2012', + 1 => '2012-12-20', + ], + 38 => [ + 0 => '2012', + 1 => '2012-12-21', + ], + 39 => [ + 0 => '2012', + 1 => '2012-12-22', + ], + 40 => [ + 0 => '2005', + 1 => '2001/07/05', + ], + 41 => [ + 0 => '2001', + 1 => '2001/01/01', + ], + 42 => [ + 0 => '2031', + 1 => '2001/12/31', + ], + 43 => [ + 0 => '2001', + 1 => '2001/03/01', + ], + 44 => [ + 0 => '2029', + 1 => '2004/02/29', + ], + 45 => [ + 0 => '2020', + 1 => '2012/03/20', + ], + 46 => [ + 0 => '2021', + 1 => '2012/03/21', + ], + 47 => [ + 0 => '2022', + 1 => '2012/03/22', + ], + 48 => [ + 0 => '2020', + 1 => '2012/06/20', + ], + 49 => [ + 0 => '2021', + 1 => '2012/06/21', + ], + 50 => [ + 0 => '2022', + 1 => '2012/06/22', + ], + 51 => [ + 0 => '2020', + 1 => '2012/09/20', + ], + 52 => [ + 0 => '2021', + 1 => '2012/09/21', + ], + 53 => [ + 0 => '2022', + 1 => '2012/09/22', + ], + 54 => [ + 0 => '2020', + 1 => '2012/12/20', + ], + 55 => [ + 0 => '2021', + 1 => '2012/12/21', + ], + 56 => [ + 0 => '2022', + 1 => '2012/12/22', + ], + 57 => [ + 0 => '2001', + 1 => '05/07/2001', + ], + 58 => [ + 0 => '2001', + 1 => '01/01/2001', + ], + 59 => [ + 0 => '2001', + 1 => '31/12/2001', + ], + 60 => [ + 0 => '2001', + 1 => '01/03/2001', + ], + 61 => [ + 0 => '2004', + 1 => '29/02/2004', + ], + 62 => [ + 0 => '2012', + 1 => '20/03/2012', + ], + 63 => [ + 0 => '2012', + 1 => '21/03/2012', + ], + 64 => [ + 0 => '2012', + 1 => '22/03/2012', + ], + 65 => [ + 0 => '2012', + 1 => '20/06/2012', + ], + 66 => [ + 0 => '2012', + 1 => '21/06/2012', + ], + 67 => [ + 0 => '2012', + 1 => '22/06/2012', + ], + 68 => [ + 0 => '2012', + 1 => '20/09/2012', + ], + 69 => [ + 0 => '2012', + 1 => '21/09/2012', + ], + 70 => [ + 0 => '2012', + 1 => '22/09/2012', + ], + 71 => [ + 0 => '2012', + 1 => '20/12/2012', + ], + 72 => [ + 0 => '2012', + 1 => '21/12/2012', + ], + 73 => [ + 0 => '2012', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/DateIcalTest.php b/tests/tests/Filtre/Date/DateIcalTest.php new file mode 100644 index 0000000000..a1f82e8df9 --- /dev/null +++ b/tests/tests/Filtre/Date/DateIcalTest.php @@ -0,0 +1,335 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction date_ical du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class DateIcalTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + date_default_timezone_set('UTC'); + } + + /** + * @dataProvider providerFiltresDateIcal + */ + public function testFiltresDateIcal($expected, ...$args): void + { + $actual = date_ical(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresDateIcal(): array + { + return [ + 0 => [ + 0 => '20010101T123344Z', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => '20010301T091257Z', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => '20010301T141233Z', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '20000101T000000Z', + 1 => '0000-00-00', + ], + 4 => [ + 0 => '20010101T000000Z', + 1 => '0001-01-01', + ], + 5 => [ + 0 => '19700101T000000Z', + 1 => '1970-01-01', + ], + 6 => [ + 0 => '20010705T182524Z', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => '20010101T000000Z', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => '20011231T235959Z', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => '20010301T141233Z', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => '20040229T141233Z', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => '20120320T120000Z', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => '20120321T120000Z', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => '20120322T120000Z', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => '20120620T120000Z', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => '20120621T120000Z', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => '20120622T120000Z', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => '20120920T120000Z', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => '20120921T120000Z', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => '20120922T120000Z', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => '20121220T120000Z', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => '20121221T120000Z', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => '20121222T120000Z', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => '20010705T000000Z', + 1 => '2001-07-05', + ], + 24 => [ + 0 => '20010101T000000Z', + 1 => '2001-01-01', + ], + 25 => [ + 0 => '20011231T000000Z', + 1 => '2001-12-31', + ], + 26 => [ + 0 => '20010301T000000Z', + 1 => '2001-03-01', + ], + 27 => [ + 0 => '20040229T000000Z', + 1 => '2004-02-29', + ], + 28 => [ + 0 => '20120320T000000Z', + 1 => '2012-03-20', + ], + 29 => [ + 0 => '20120321T000000Z', + 1 => '2012-03-21', + ], + 30 => [ + 0 => '20120322T000000Z', + 1 => '2012-03-22', + ], + 31 => [ + 0 => '20120620T000000Z', + 1 => '2012-06-20', + ], + 32 => [ + 0 => '20120621T000000Z', + 1 => '2012-06-21', + ], + 33 => [ + 0 => '20120622T000000Z', + 1 => '2012-06-22', + ], + 34 => [ + 0 => '20120920T000000Z', + 1 => '2012-09-20', + ], + 35 => [ + 0 => '20120921T000000Z', + 1 => '2012-09-21', + ], + 36 => [ + 0 => '20120922T000000Z', + 1 => '2012-09-22', + ], + 37 => [ + 0 => '20121220T000000Z', + 1 => '2012-12-20', + ], + 38 => [ + 0 => '20121221T000000Z', + 1 => '2012-12-21', + ], + 39 => [ + 0 => '20121222T000000Z', + 1 => '2012-12-22', + ], + 40 => [ + 0 => '20050701T000000Z', + 1 => '2001/07/05', + ], + 41 => [ + 0 => '20010101T000000Z', + 1 => '2001/01/01', + ], + 42 => [ + 0 => '20311201T000000Z', + 1 => '2001/12/31', + ], + 43 => [ + 0 => '20010301T000000Z', + 1 => '2001/03/01', + ], + 44 => [ + 0 => '20290204T000000Z', + 1 => '2004/02/29', + ], + 45 => [ + 0 => '20200312T000000Z', + 1 => '2012/03/20', + ], + 46 => [ + 0 => '20210312T000000Z', + 1 => '2012/03/21', + ], + 47 => [ + 0 => '20220312T000000Z', + 1 => '2012/03/22', + ], + 48 => [ + 0 => '20200612T000000Z', + 1 => '2012/06/20', + ], + 49 => [ + 0 => '20210612T000000Z', + 1 => '2012/06/21', + ], + 50 => [ + 0 => '20220612T000000Z', + 1 => '2012/06/22', + ], + 51 => [ + 0 => '20200912T000000Z', + 1 => '2012/09/20', + ], + 52 => [ + 0 => '20210912T000000Z', + 1 => '2012/09/21', + ], + 53 => [ + 0 => '20220912T000000Z', + 1 => '2012/09/22', + ], + 54 => [ + 0 => '20201212T000000Z', + 1 => '2012/12/20', + ], + 55 => [ + 0 => '20211212T000000Z', + 1 => '2012/12/21', + ], + 56 => [ + 0 => '20221212T000000Z', + 1 => '2012/12/22', + ], + 57 => [ + 0 => '20010705T000000Z', + 1 => '05/07/2001', + ], + 58 => [ + 0 => '20010101T000000Z', + 1 => '01/01/2001', + ], + 59 => [ + 0 => '20011231T000000Z', + 1 => '31/12/2001', + ], + 60 => [ + 0 => '20010301T000000Z', + 1 => '01/03/2001', + ], + 61 => [ + 0 => '20040229T000000Z', + 1 => '29/02/2004', + ], + 62 => [ + 0 => '20120320T000000Z', + 1 => '20/03/2012', + ], + 63 => [ + 0 => '20120321T000000Z', + 1 => '21/03/2012', + ], + 64 => [ + 0 => '20120322T000000Z', + 1 => '22/03/2012', + ], + 65 => [ + 0 => '20120620T000000Z', + 1 => '20/06/2012', + ], + 66 => [ + 0 => '20120621T000000Z', + 1 => '21/06/2012', + ], + 67 => [ + 0 => '20120622T000000Z', + 1 => '22/06/2012', + ], + 68 => [ + 0 => '20120920T000000Z', + 1 => '20/09/2012', + ], + 69 => [ + 0 => '20120921T000000Z', + 1 => '21/09/2012', + ], + 70 => [ + 0 => '20120922T000000Z', + 1 => '22/09/2012', + ], + 71 => [ + 0 => '20121220T000000Z', + 1 => '20/12/2012', + ], + 72 => [ + 0 => '20121221T000000Z', + 1 => '21/12/2012', + ], + 73 => [ + 0 => '20121222T000000Z', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/DateInterfaceTest.php b/tests/tests/Filtre/Date/DateInterfaceTest.php new file mode 100644 index 0000000000..08f4acca21 --- /dev/null +++ b/tests/tests/Filtre/Date/DateInterfaceTest.php @@ -0,0 +1,336 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction date_interface du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class DateInterfaceTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + changer_langue('fr'); + // ce test est en fr + } + + /** + * @dataProvider providerFiltresDateInterface + */ + public function testFiltresDateInterface($expected, ...$args): void + { + $actual = date_interface(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresDateInterface(): array + { + return [ + 0 => [ + 0 => '2001 à 12h33min', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => 'mars 2001 à 09h12min', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => '29 février 2001 à 14h12min', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '0000 à 0h0min', + 1 => '0000-00-00', + ], + 4 => [ + 0 => '1er janvier 0001 à 0h0min', + 1 => '0001-01-01', + ], + 5 => [ + 0 => '1er janvier 1970 à 0h0min', + 1 => '1970-01-01', + ], + 6 => [ + 0 => '5 juillet 2001 à 18h25min', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => '1er janvier 2001 à 00h00min', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => '31 décembre 2001 à 23h59min', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => '1er mars 2001 à 14h12min', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => '29 février 2004 à 14h12min', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => '20 mars 2012 à 12h00min', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => '21 mars 2012 à 12h00min', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => '22 mars 2012 à 12h00min', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => '20 juin 2012 à 12h00min', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => '21 juin 2012 à 12h00min', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => '22 juin 2012 à 12h00min', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => '20 septembre 2012 à 12h00min', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => '21 septembre 2012 à 12h00min', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => '22 septembre 2012 à 12h00min', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => '20 décembre 2012 à 12h00min', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => '21 décembre 2012 à 12h00min', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => '22 décembre 2012 à 12h00min', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => '5 juillet 2001 à 0h0min', + 1 => '2001-07-05', + ], + 24 => [ + 0 => '1er janvier 2001 à 0h0min', + 1 => '2001-01-01', + ], + 25 => [ + 0 => '31 décembre 2001 à 0h0min', + 1 => '2001-12-31', + ], + 26 => [ + 0 => '1er mars 2001 à 0h0min', + 1 => '2001-03-01', + ], + 27 => [ + 0 => '29 février 2004 à 0h0min', + 1 => '2004-02-29', + ], + 28 => [ + 0 => '20 mars 2012 à 0h0min', + 1 => '2012-03-20', + ], + 29 => [ + 0 => '21 mars 2012 à 0h0min', + 1 => '2012-03-21', + ], + 30 => [ + 0 => '22 mars 2012 à 0h0min', + 1 => '2012-03-22', + ], + 31 => [ + 0 => '20 juin 2012 à 0h0min', + 1 => '2012-06-20', + ], + 32 => [ + 0 => '21 juin 2012 à 0h0min', + 1 => '2012-06-21', + ], + 33 => [ + 0 => '22 juin 2012 à 0h0min', + 1 => '2012-06-22', + ], + 34 => [ + 0 => '20 septembre 2012 à 0h0min', + 1 => '2012-09-20', + ], + 35 => [ + 0 => '21 septembre 2012 à 0h0min', + 1 => '2012-09-21', + ], + 36 => [ + 0 => '22 septembre 2012 à 0h0min', + 1 => '2012-09-22', + ], + 37 => [ + 0 => '20 décembre 2012 à 0h0min', + 1 => '2012-12-20', + ], + 38 => [ + 0 => '21 décembre 2012 à 0h0min', + 1 => '2012-12-21', + ], + 39 => [ + 0 => '22 décembre 2012 à 0h0min', + 1 => '2012-12-22', + ], + 40 => [ + 0 => '1er juillet 2005 à 0h0min', + 1 => '2001/07/05', + ], + 41 => [ + 0 => '1er janvier 2001 à 0h0min', + 1 => '2001/01/01', + ], + 42 => [ + 0 => '1er décembre 2031 à 0h0min', + 1 => '2001/12/31', + ], + 43 => [ + 0 => '1er mars 2001 à 0h0min', + 1 => '2001/03/01', + ], + 44 => [ + 0 => '4 février 2029 à 0h0min', + 1 => '2004/02/29', + ], + 45 => [ + 0 => '12 mars 2020 à 0h0min', + 1 => '2012/03/20', + ], + 46 => [ + 0 => '12 mars 2021 à 0h0min', + 1 => '2012/03/21', + ], + 47 => [ + 0 => '12 mars 2022 à 0h0min', + 1 => '2012/03/22', + ], + 48 => [ + 0 => '12 juin 2020 à 0h0min', + 1 => '2012/06/20', + ], + 49 => [ + 0 => '12 juin 2021 à 0h0min', + 1 => '2012/06/21', + ], + 50 => [ + 0 => '12 juin 2022 à 0h0min', + 1 => '2012/06/22', + ], + 51 => [ + 0 => '12 septembre 2020 à 0h0min', + 1 => '2012/09/20', + ], + 52 => [ + 0 => '12 septembre 2021 à 0h0min', + 1 => '2012/09/21', + ], + 53 => [ + 0 => '12 septembre 2022 à 0h0min', + 1 => '2012/09/22', + ], + 54 => [ + 0 => '12 décembre 2020 à 0h0min', + 1 => '2012/12/20', + ], + 55 => [ + 0 => '12 décembre 2021 à 0h0min', + 1 => '2012/12/21', + ], + 56 => [ + 0 => '12 décembre 2022 à 0h0min', + 1 => '2012/12/22', + ], + 57 => [ + 0 => '5 juillet 2001 à 0h0min', + 1 => '05/07/2001', + ], + 58 => [ + 0 => '1er janvier 2001 à 0h0min', + 1 => '01/01/2001', + ], + 59 => [ + 0 => '31 décembre 2001 à 0h0min', + 1 => '31/12/2001', + ], + 60 => [ + 0 => '1er mars 2001 à 0h0min', + 1 => '01/03/2001', + ], + 61 => [ + 0 => '29 février 2004 à 0h0min', + 1 => '29/02/2004', + ], + 62 => [ + 0 => '20 mars 2012 à 0h0min', + 1 => '20/03/2012', + ], + 63 => [ + 0 => '21 mars 2012 à 0h0min', + 1 => '21/03/2012', + ], + 64 => [ + 0 => '22 mars 2012 à 0h0min', + 1 => '22/03/2012', + ], + 65 => [ + 0 => '20 juin 2012 à 0h0min', + 1 => '20/06/2012', + ], + 66 => [ + 0 => '21 juin 2012 à 0h0min', + 1 => '21/06/2012', + ], + 67 => [ + 0 => '22 juin 2012 à 0h0min', + 1 => '22/06/2012', + ], + 68 => [ + 0 => '20 septembre 2012 à 0h0min', + 1 => '20/09/2012', + ], + 69 => [ + 0 => '21 septembre 2012 à 0h0min', + 1 => '21/09/2012', + ], + 70 => [ + 0 => '22 septembre 2012 à 0h0min', + 1 => '22/09/2012', + ], + 71 => [ + 0 => '20 décembre 2012 à 0h0min', + 1 => '20/12/2012', + ], + 72 => [ + 0 => '21 décembre 2012 à 0h0min', + 1 => '21/12/2012', + ], + 73 => [ + 0 => '22 décembre 2012 à 0h0min', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/DateRelativeTest.php b/tests/tests/Filtre/Date/DateRelativeTest.php new file mode 100644 index 0000000000..527bc8f8e4 --- /dev/null +++ b/tests/tests/Filtre/Date/DateRelativeTest.php @@ -0,0 +1,318 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction date_relative du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class DateRelativeTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + // Pour que le tests soit independant de la timezone du serveur + date_default_timezone_set('Europe/Paris'); + changer_langue('fr'); + // ce test est en fr + } + + /** + * @dataProvider providerFiltresDateRelative + */ + public function testFiltresDateRelative($expected, ...$args): void + { + $actual = date_relative(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresDateRelative(): array + { + return [ + 0 => [ + 0 => 'dans 1 heure', + 1 => '2010-03-14 23:18:57', + 2 => 0, + 3 => '2010-03-14 22:18:57', + ], + 1 => [ + 0 => 'dans 2 heures', + 1 => '2010-03-15 00:19:47', + 2 => 0, + 3 => '2010-03-14 22:19:47', + ], + 2 => [ + 0 => 'dans 3 heures', + 1 => '2010-03-15 01:20:03', + 2 => 0, + 3 => '2010-03-14 22:20:03', + ], + 3 => [ + 0 => 'dans 4 heures', + 1 => '2010-03-15 02:20:18', + 2 => 0, + 3 => '2010-03-14 22:20:18', + ], + 4 => [ + 0 => 'dans 5 heures', + 1 => '2010-03-15 03:20:32', + 2 => 0, + 3 => '2010-03-14 22:20:32', + ], + 5 => [ + 0 => 'dans 12 heures', + 1 => '2010-03-15 10:21:08', + 2 => 0, + 3 => '2010-03-14 22:21:08', + ], + 6 => [ + 0 => 'dans 23 heures', + 1 => '2010-03-15 21:21:25', + 2 => 0, + 3 => '2010-03-14 22:21:25', + ], + 7 => [ + 0 => 'dans 24 heures', + 1 => '2010-03-15 22:21:35', + 2 => 0, + 3 => '2010-03-14 22:21:35', + ], + 8 => [ + 0 => 'demain', + 1 => '2010-03-15 23:21:56', + 2 => 0, + 3 => '2010-03-14 22:21:56', + ], + 9 => [ + 0 => 'dans 2 jours', + 1 => '2010-03-16 22:22:47', + 2 => 0, + 3 => '2010-03-14 22:22:47', + ], + 10 => [ + 0 => 'dans 3 jours', + 1 => '2010-03-17 22:23:30', + 2 => 0, + 3 => '2010-03-14 22:23:30', + ], + 11 => [ + 0 => 'dans 6 jours', + 1 => '2010-03-20 22:23:51', + 2 => 0, + 3 => '2010-03-14 22:23:51', + ], + 12 => [ + 0 => 'dans 7 jours', + 1 => '2010-03-21 22:24:17', + 2 => 0, + 3 => '2010-03-14 22:24:17', + ], + 13 => [ + 0 => 'dans 1 semaine', + 1 => '2010-03-22 22:24:31', + 2 => 0, + 3 => '2010-03-14 22:24:31', + ], + 14 => [ + 0 => 'dans 2 semaines', + 1 => '2010-03-28 23:25:03', + 2 => 0, + 3 => '2010-03-14 22:25:03', + ], + 15 => [ + 0 => 'dans 3 semaines', + 1 => '2010-04-04 23:25:14', + 2 => 0, + 3 => '2010-03-14 22:25:14', + ], + 16 => [ + 0 => 'dans 4 semaines', + 1 => '2010-04-11 23:25:29', + 2 => 0, + 3 => '2010-03-14 22:25:29', + ], + 17 => [ + 0 => 'dans 4 semaines', + 1 => '2010-04-13 23:26:31', + 2 => 0, + 3 => '2010-03-14 22:26:31', + ], + 18 => [ + 0 => 'dans 1 mois', + 1 => '2010-04-14 23:26:49', + 2 => 0, + 3 => '2010-03-14 22:26:49', + ], + 19 => [ + 0 => 'dans 1 minute', + 1 => '2010-03-14 22:30:48', + 2 => 0, + 3 => '2010-03-14 22:29:48', + ], + 20 => [ + 0 => 'dans 30 minutes', + 1 => '2010-03-14 23:00:01', + 2 => 0, + 3 => '2010-03-14 22:30:01', + ], + 21 => [ + 0 => 'dans 59 minutes', + 1 => '2010-03-14 23:29:10', + 2 => 0, + 3 => '2010-03-14 22:30:10', + ], + 22 => [ + 0 => 'dans 1 heure', + 1 => '2010-03-14 23:30:51', + 2 => 0, + 3 => '2010-03-14 22:30:51', + ], + 23 => [ + 0 => 'dans 1 seconde', + 1 => '2010-03-14 22:31:10', + 2 => 0, + 3 => '2010-03-14 22:31:09', + ], + 24 => [ + 0 => 'dans 1 minute', + 1 => '2010-03-14 22:32:37', + 2 => 0, + 3 => '2010-03-14 22:31:37', + ], + 25 => [ + 0 => 'il y a 1 seconde', + 1 => '2010-03-14 22:31:52', + 2 => 0, + 3 => '2010-03-14 22:31:53', + ], + 26 => [ + 0 => 'il y a 59 secondes', + 1 => '2010-03-14 22:31:03', + 2 => 0, + 3 => '2010-03-14 22:32:02', + ], + 27 => [ + 0 => 'il y a 1 minute', + 1 => '2010-03-14 22:31:12', + 2 => 0, + 3 => '2010-03-14 22:32:12', + ], + 28 => [ + 0 => 'il y a 59 minutes', + 1 => '2010-03-14 21:33:30', + 2 => 0, + 3 => '2010-03-14 22:32:30', + ], + 29 => [ + 0 => 'il y a 1 heure', + 1 => '2010-03-14 21:33:00', + 2 => 0, + 3 => '2010-03-14 22:33:00', + ], + 30 => [ + 0 => 'il y a 2 heures', + 1 => '2010-03-14 20:33:32', + 2 => 0, + 3 => '2010-03-14 22:33:32', + ], + 31 => [ + 0 => 'il y a 23 heures', + 1 => '2010-03-13 23:33:46', + 2 => 0, + 3 => '2010-03-14 22:33:46', + ], + 32 => [ + 0 => 'il y a 24 heures', + 1 => '2010-03-13 22:33:57', + 2 => 0, + 3 => '2010-03-14 22:33:57', + ], + 33 => [ + 0 => 'hier', + 1 => '2010-03-13 21:34:24', + 2 => 0, + 3 => '2010-03-14 22:34:24', + ], + 34 => [ + 0 => 'hier', + 1 => '2010-03-12 23:35:16', + 2 => 0, + 3 => '2010-03-14 22:35:16', + ], + 35 => [ + 0 => 'il y a 2 jours', + 1 => '2010-03-12 22:35:28', + 2 => 0, + 3 => '2010-03-14 22:35:28', + ], + 36 => [ + 0 => 'il y a 6 jours', + 1 => '2010-03-08 22:35:57', + 2 => 0, + 3 => '2010-03-14 22:35:57', + ], + 37 => [ + 0 => 'il y a 7 jours', + 1 => '2010-03-07 22:38:00', + 2 => 0, + 3 => '2010-03-14 22:38:00', + ], + 38 => [ + 0 => 'il y a 1 semaine', + 1 => '2010-03-06 22:38:23', + 2 => 0, + 3 => '2010-03-14 22:38:23', + ], + 39 => [ + 0 => 'il y a 2 semaines', + 1 => '2010-02-28 22:39:00', + 2 => 0, + 3 => '2010-03-14 22:39:00', + ], + 40 => [ + 0 => 'il y a 3 semaines', + 1 => '2010-02-21 22:39:14', + 2 => 0, + 3 => '2010-03-14 22:39:14', + ], + 41 => [ + 0 => 'il y a 4 semaines', + 1 => '2010-02-14 22:39:26', + 2 => 0, + 3 => '2010-03-14 22:39:26', + ], + 42 => [ + 0 => 'il y a 4 semaines', + 1 => '2010-02-13 22:39:39', + 2 => 0, + 3 => '2010-03-14 22:39:39', + ], + 43 => [ + 0 => 'il y a 4 semaines', + 1 => '2010-02-12 22:39:53', + 2 => 0, + 3 => '2010-03-14 22:39:53', + ], + 44 => [ + 0 => 'il y a 1 mois', + 1 => '2010-02-11 22:40:03', + 2 => 0, + 3 => '2010-03-14 22:40:03', + ], + 45 => [ + 0 => 'il y a 2 mois', + 1 => '2010-01-13 22:41:13', + 2 => 0, + 3 => '2010-03-14 22:41:13', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/HeuresMinutesTest.php b/tests/tests/Filtre/Date/HeuresMinutesTest.php new file mode 100644 index 0000000000..d75fe8b126 --- /dev/null +++ b/tests/tests/Filtre/Date/HeuresMinutesTest.php @@ -0,0 +1,336 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction heures_minutes du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class HeuresMinutesTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + changer_langue('fr'); + // ce test est en fr + } + + /** + * @dataProvider providerFiltresHeuresMinutes + */ + public function testFiltresHeuresMinutes($expected, ...$args): void + { + $actual = heures_minutes(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresHeuresMinutes(): array + { + return [ + 0 => [ + 0 => '12h33min', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => '09h12min', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => '14h12min', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '0h0min', + 1 => '0000-00-00', + ], + 4 => [ + 0 => '0h0min', + 1 => '0001-01-01', + ], + 5 => [ + 0 => '0h0min', + 1 => '1970-01-01', + ], + 6 => [ + 0 => '18h25min', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => '00h00min', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => '23h59min', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => '14h12min', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => '14h12min', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => '12h00min', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => '12h00min', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => '12h00min', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => '12h00min', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => '12h00min', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => '12h00min', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => '12h00min', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => '12h00min', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => '12h00min', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => '12h00min', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => '12h00min', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => '12h00min', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => '0h0min', + 1 => '2001-07-05', + ], + 24 => [ + 0 => '0h0min', + 1 => '2001-01-01', + ], + 25 => [ + 0 => '0h0min', + 1 => '2001-12-31', + ], + 26 => [ + 0 => '0h0min', + 1 => '2001-03-01', + ], + 27 => [ + 0 => '0h0min', + 1 => '2004-02-29', + ], + 28 => [ + 0 => '0h0min', + 1 => '2012-03-20', + ], + 29 => [ + 0 => '0h0min', + 1 => '2012-03-21', + ], + 30 => [ + 0 => '0h0min', + 1 => '2012-03-22', + ], + 31 => [ + 0 => '0h0min', + 1 => '2012-06-20', + ], + 32 => [ + 0 => '0h0min', + 1 => '2012-06-21', + ], + 33 => [ + 0 => '0h0min', + 1 => '2012-06-22', + ], + 34 => [ + 0 => '0h0min', + 1 => '2012-09-20', + ], + 35 => [ + 0 => '0h0min', + 1 => '2012-09-21', + ], + 36 => [ + 0 => '0h0min', + 1 => '2012-09-22', + ], + 37 => [ + 0 => '0h0min', + 1 => '2012-12-20', + ], + 38 => [ + 0 => '0h0min', + 1 => '2012-12-21', + ], + 39 => [ + 0 => '0h0min', + 1 => '2012-12-22', + ], + 40 => [ + 0 => '0h0min', + 1 => '2001/07/05', + ], + 41 => [ + 0 => '0h0min', + 1 => '2001/01/01', + ], + 42 => [ + 0 => '0h0min', + 1 => '2001/12/31', + ], + 43 => [ + 0 => '0h0min', + 1 => '2001/03/01', + ], + 44 => [ + 0 => '0h0min', + 1 => '2004/02/29', + ], + 45 => [ + 0 => '0h0min', + 1 => '2012/03/20', + ], + 46 => [ + 0 => '0h0min', + 1 => '2012/03/21', + ], + 47 => [ + 0 => '0h0min', + 1 => '2012/03/22', + ], + 48 => [ + 0 => '0h0min', + 1 => '2012/06/20', + ], + 49 => [ + 0 => '0h0min', + 1 => '2012/06/21', + ], + 50 => [ + 0 => '0h0min', + 1 => '2012/06/22', + ], + 51 => [ + 0 => '0h0min', + 1 => '2012/09/20', + ], + 52 => [ + 0 => '0h0min', + 1 => '2012/09/21', + ], + 53 => [ + 0 => '0h0min', + 1 => '2012/09/22', + ], + 54 => [ + 0 => '0h0min', + 1 => '2012/12/20', + ], + 55 => [ + 0 => '0h0min', + 1 => '2012/12/21', + ], + 56 => [ + 0 => '0h0min', + 1 => '2012/12/22', + ], + 57 => [ + 0 => '0h0min', + 1 => '05/07/2001', + ], + 58 => [ + 0 => '0h0min', + 1 => '01/01/2001', + ], + 59 => [ + 0 => '0h0min', + 1 => '31/12/2001', + ], + 60 => [ + 0 => '0h0min', + 1 => '01/03/2001', + ], + 61 => [ + 0 => '0h0min', + 1 => '29/02/2004', + ], + 62 => [ + 0 => '0h0min', + 1 => '20/03/2012', + ], + 63 => [ + 0 => '0h0min', + 1 => '21/03/2012', + ], + 64 => [ + 0 => '0h0min', + 1 => '22/03/2012', + ], + 65 => [ + 0 => '0h0min', + 1 => '20/06/2012', + ], + 66 => [ + 0 => '0h0min', + 1 => '21/06/2012', + ], + 67 => [ + 0 => '0h0min', + 1 => '22/06/2012', + ], + 68 => [ + 0 => '0h0min', + 1 => '20/09/2012', + ], + 69 => [ + 0 => '0h0min', + 1 => '21/09/2012', + ], + 70 => [ + 0 => '0h0min', + 1 => '22/09/2012', + ], + 71 => [ + 0 => '0h0min', + 1 => '20/12/2012', + ], + 72 => [ + 0 => '0h0min', + 1 => '21/12/2012', + ], + 73 => [ + 0 => '0h0min', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/HeuresTest.php b/tests/tests/Filtre/Date/HeuresTest.php new file mode 100644 index 0000000000..a1d545e81a --- /dev/null +++ b/tests/tests/Filtre/Date/HeuresTest.php @@ -0,0 +1,330 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction heures du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class HeuresTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresHeures + */ + public function testFiltresHeures($expected, ...$args): void + { + $actual = heures(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresHeures(): array + { + return [ + 0 => [ + 0 => '12', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => '09', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => '14', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '0', + 1 => '0000-00-00', + ], + 4 => [ + 0 => '0', + 1 => '0001-01-01', + ], + 5 => [ + 0 => '0', + 1 => '1970-01-01', + ], + 6 => [ + 0 => '18', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => '00', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => '23', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => '14', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => '14', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => '12', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => '12', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => '12', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => '12', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => '12', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => '12', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => '12', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => '12', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => '12', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => '12', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => '12', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => '12', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => '0', + 1 => '2001-07-05', + ], + 24 => [ + 0 => '0', + 1 => '2001-01-01', + ], + 25 => [ + 0 => '0', + 1 => '2001-12-31', + ], + 26 => [ + 0 => '0', + 1 => '2001-03-01', + ], + 27 => [ + 0 => '0', + 1 => '2004-02-29', + ], + 28 => [ + 0 => '0', + 1 => '2012-03-20', + ], + 29 => [ + 0 => '0', + 1 => '2012-03-21', + ], + 30 => [ + 0 => '0', + 1 => '2012-03-22', + ], + 31 => [ + 0 => '0', + 1 => '2012-06-20', + ], + 32 => [ + 0 => '0', + 1 => '2012-06-21', + ], + 33 => [ + 0 => '0', + 1 => '2012-06-22', + ], + 34 => [ + 0 => '0', + 1 => '2012-09-20', + ], + 35 => [ + 0 => '0', + 1 => '2012-09-21', + ], + 36 => [ + 0 => '0', + 1 => '2012-09-22', + ], + 37 => [ + 0 => '0', + 1 => '2012-12-20', + ], + 38 => [ + 0 => '0', + 1 => '2012-12-21', + ], + 39 => [ + 0 => '0', + 1 => '2012-12-22', + ], + 40 => [ + 0 => '0', + 1 => '2001/07/05', + ], + 41 => [ + 0 => '0', + 1 => '2001/01/01', + ], + 42 => [ + 0 => '0', + 1 => '2001/12/31', + ], + 43 => [ + 0 => '0', + 1 => '2001/03/01', + ], + 44 => [ + 0 => '0', + 1 => '2004/02/29', + ], + 45 => [ + 0 => '0', + 1 => '2012/03/20', + ], + 46 => [ + 0 => '0', + 1 => '2012/03/21', + ], + 47 => [ + 0 => '0', + 1 => '2012/03/22', + ], + 48 => [ + 0 => '0', + 1 => '2012/06/20', + ], + 49 => [ + 0 => '0', + 1 => '2012/06/21', + ], + 50 => [ + 0 => '0', + 1 => '2012/06/22', + ], + 51 => [ + 0 => '0', + 1 => '2012/09/20', + ], + 52 => [ + 0 => '0', + 1 => '2012/09/21', + ], + 53 => [ + 0 => '0', + 1 => '2012/09/22', + ], + 54 => [ + 0 => '0', + 1 => '2012/12/20', + ], + 55 => [ + 0 => '0', + 1 => '2012/12/21', + ], + 56 => [ + 0 => '0', + 1 => '2012/12/22', + ], + 57 => [ + 0 => '0', + 1 => '05/07/2001', + ], + 58 => [ + 0 => '0', + 1 => '01/01/2001', + ], + 59 => [ + 0 => '0', + 1 => '31/12/2001', + ], + 60 => [ + 0 => '0', + 1 => '01/03/2001', + ], + 61 => [ + 0 => '0', + 1 => '29/02/2004', + ], + 62 => [ + 0 => '0', + 1 => '20/03/2012', + ], + 63 => [ + 0 => '0', + 1 => '21/03/2012', + ], + 64 => [ + 0 => '0', + 1 => '22/03/2012', + ], + 65 => [ + 0 => '0', + 1 => '20/06/2012', + ], + 66 => [ + 0 => '0', + 1 => '21/06/2012', + ], + 67 => [ + 0 => '0', + 1 => '22/06/2012', + ], + 68 => [ + 0 => '0', + 1 => '20/09/2012', + ], + 69 => [ + 0 => '0', + 1 => '21/09/2012', + ], + 70 => [ + 0 => '0', + 1 => '22/09/2012', + ], + 71 => [ + 0 => '0', + 1 => '20/12/2012', + ], + 72 => [ + 0 => '0', + 1 => '21/12/2012', + ], + 73 => [ + 0 => '0', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/JourTest.php b/tests/tests/Filtre/Date/JourTest.php new file mode 100644 index 0000000000..9a85c8f3b6 --- /dev/null +++ b/tests/tests/Filtre/Date/JourTest.php @@ -0,0 +1,336 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction jour du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class JourTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + changer_langue('fr'); + // ce test est en fr + } + + /** + * @dataProvider providerFiltresJour + */ + public function testFiltresJour($expected, ...$args): void + { + $actual = jour(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresJour(): array + { + return [ + 0 => [ + 0 => '', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => '', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => '29', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '', + 1 => '0000-00-00', + ], + 4 => [ + 0 => '1er', + 1 => '0001-01-01', + ], + 5 => [ + 0 => '1er', + 1 => '1970-01-01', + ], + 6 => [ + 0 => '5', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => '1er', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => '31', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => '1er', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => '29', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => '20', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => '21', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => '22', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => '20', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => '21', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => '22', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => '20', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => '21', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => '22', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => '20', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => '21', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => '22', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => '5', + 1 => '2001-07-05', + ], + 24 => [ + 0 => '1er', + 1 => '2001-01-01', + ], + 25 => [ + 0 => '31', + 1 => '2001-12-31', + ], + 26 => [ + 0 => '1er', + 1 => '2001-03-01', + ], + 27 => [ + 0 => '29', + 1 => '2004-02-29', + ], + 28 => [ + 0 => '20', + 1 => '2012-03-20', + ], + 29 => [ + 0 => '21', + 1 => '2012-03-21', + ], + 30 => [ + 0 => '22', + 1 => '2012-03-22', + ], + 31 => [ + 0 => '20', + 1 => '2012-06-20', + ], + 32 => [ + 0 => '21', + 1 => '2012-06-21', + ], + 33 => [ + 0 => '22', + 1 => '2012-06-22', + ], + 34 => [ + 0 => '20', + 1 => '2012-09-20', + ], + 35 => [ + 0 => '21', + 1 => '2012-09-21', + ], + 36 => [ + 0 => '22', + 1 => '2012-09-22', + ], + 37 => [ + 0 => '20', + 1 => '2012-12-20', + ], + 38 => [ + 0 => '21', + 1 => '2012-12-21', + ], + 39 => [ + 0 => '22', + 1 => '2012-12-22', + ], + 40 => [ + 0 => '1er', + 1 => '2001/07/05', + ], + 41 => [ + 0 => '1er', + 1 => '2001/01/01', + ], + 42 => [ + 0 => '1er', + 1 => '2001/12/31', + ], + 43 => [ + 0 => '1er', + 1 => '2001/03/01', + ], + 44 => [ + 0 => '4', + 1 => '2004/02/29', + ], + 45 => [ + 0 => '12', + 1 => '2012/03/20', + ], + 46 => [ + 0 => '12', + 1 => '2012/03/21', + ], + 47 => [ + 0 => '12', + 1 => '2012/03/22', + ], + 48 => [ + 0 => '12', + 1 => '2012/06/20', + ], + 49 => [ + 0 => '12', + 1 => '2012/06/21', + ], + 50 => [ + 0 => '12', + 1 => '2012/06/22', + ], + 51 => [ + 0 => '12', + 1 => '2012/09/20', + ], + 52 => [ + 0 => '12', + 1 => '2012/09/21', + ], + 53 => [ + 0 => '12', + 1 => '2012/09/22', + ], + 54 => [ + 0 => '12', + 1 => '2012/12/20', + ], + 55 => [ + 0 => '12', + 1 => '2012/12/21', + ], + 56 => [ + 0 => '12', + 1 => '2012/12/22', + ], + 57 => [ + 0 => '5', + 1 => '05/07/2001', + ], + 58 => [ + 0 => '1er', + 1 => '01/01/2001', + ], + 59 => [ + 0 => '31', + 1 => '31/12/2001', + ], + 60 => [ + 0 => '1er', + 1 => '01/03/2001', + ], + 61 => [ + 0 => '29', + 1 => '29/02/2004', + ], + 62 => [ + 0 => '20', + 1 => '20/03/2012', + ], + 63 => [ + 0 => '21', + 1 => '21/03/2012', + ], + 64 => [ + 0 => '22', + 1 => '22/03/2012', + ], + 65 => [ + 0 => '20', + 1 => '20/06/2012', + ], + 66 => [ + 0 => '21', + 1 => '21/06/2012', + ], + 67 => [ + 0 => '22', + 1 => '22/06/2012', + ], + 68 => [ + 0 => '20', + 1 => '20/09/2012', + ], + 69 => [ + 0 => '21', + 1 => '21/09/2012', + ], + 70 => [ + 0 => '22', + 1 => '22/09/2012', + ], + 71 => [ + 0 => '20', + 1 => '20/12/2012', + ], + 72 => [ + 0 => '21', + 1 => '21/12/2012', + ], + 73 => [ + 0 => '22', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/JournumTest.php b/tests/tests/Filtre/Date/JournumTest.php new file mode 100644 index 0000000000..ab902812af --- /dev/null +++ b/tests/tests/Filtre/Date/JournumTest.php @@ -0,0 +1,330 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction journum du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class JournumTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresJournum + */ + public function testFiltresJournum($expected, ...$args): void + { + $actual = journum(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresJournum(): array + { + return [ + 0 => [ + 0 => '0', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => '0', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => '29', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '0', + 1 => '0000-00-00', + ], + 4 => [ + 0 => '1', + 1 => '0001-01-01', + ], + 5 => [ + 0 => '1', + 1 => '1970-01-01', + ], + 6 => [ + 0 => '5', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => '1', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => '31', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => '1', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => '29', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => '20', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => '21', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => '22', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => '20', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => '21', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => '22', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => '20', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => '21', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => '22', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => '20', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => '21', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => '22', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => '5', + 1 => '2001-07-05', + ], + 24 => [ + 0 => '1', + 1 => '2001-01-01', + ], + 25 => [ + 0 => '31', + 1 => '2001-12-31', + ], + 26 => [ + 0 => '1', + 1 => '2001-03-01', + ], + 27 => [ + 0 => '29', + 1 => '2004-02-29', + ], + 28 => [ + 0 => '20', + 1 => '2012-03-20', + ], + 29 => [ + 0 => '21', + 1 => '2012-03-21', + ], + 30 => [ + 0 => '22', + 1 => '2012-03-22', + ], + 31 => [ + 0 => '20', + 1 => '2012-06-20', + ], + 32 => [ + 0 => '21', + 1 => '2012-06-21', + ], + 33 => [ + 0 => '22', + 1 => '2012-06-22', + ], + 34 => [ + 0 => '20', + 1 => '2012-09-20', + ], + 35 => [ + 0 => '21', + 1 => '2012-09-21', + ], + 36 => [ + 0 => '22', + 1 => '2012-09-22', + ], + 37 => [ + 0 => '20', + 1 => '2012-12-20', + ], + 38 => [ + 0 => '21', + 1 => '2012-12-21', + ], + 39 => [ + 0 => '22', + 1 => '2012-12-22', + ], + 40 => [ + 0 => '1', + 1 => '2001/07/05', + ], + 41 => [ + 0 => '1', + 1 => '2001/01/01', + ], + 42 => [ + 0 => '1', + 1 => '2001/12/31', + ], + 43 => [ + 0 => '1', + 1 => '2001/03/01', + ], + 44 => [ + 0 => '4', + 1 => '2004/02/29', + ], + 45 => [ + 0 => '12', + 1 => '2012/03/20', + ], + 46 => [ + 0 => '12', + 1 => '2012/03/21', + ], + 47 => [ + 0 => '12', + 1 => '2012/03/22', + ], + 48 => [ + 0 => '12', + 1 => '2012/06/20', + ], + 49 => [ + 0 => '12', + 1 => '2012/06/21', + ], + 50 => [ + 0 => '12', + 1 => '2012/06/22', + ], + 51 => [ + 0 => '12', + 1 => '2012/09/20', + ], + 52 => [ + 0 => '12', + 1 => '2012/09/21', + ], + 53 => [ + 0 => '12', + 1 => '2012/09/22', + ], + 54 => [ + 0 => '12', + 1 => '2012/12/20', + ], + 55 => [ + 0 => '12', + 1 => '2012/12/21', + ], + 56 => [ + 0 => '12', + 1 => '2012/12/22', + ], + 57 => [ + 0 => '5', + 1 => '05/07/2001', + ], + 58 => [ + 0 => '1', + 1 => '01/01/2001', + ], + 59 => [ + 0 => '31', + 1 => '31/12/2001', + ], + 60 => [ + 0 => '1', + 1 => '01/03/2001', + ], + 61 => [ + 0 => '29', + 1 => '29/02/2004', + ], + 62 => [ + 0 => '20', + 1 => '20/03/2012', + ], + 63 => [ + 0 => '21', + 1 => '21/03/2012', + ], + 64 => [ + 0 => '22', + 1 => '22/03/2012', + ], + 65 => [ + 0 => '20', + 1 => '20/06/2012', + ], + 66 => [ + 0 => '21', + 1 => '21/06/2012', + ], + 67 => [ + 0 => '22', + 1 => '22/06/2012', + ], + 68 => [ + 0 => '20', + 1 => '20/09/2012', + ], + 69 => [ + 0 => '21', + 1 => '21/09/2012', + ], + 70 => [ + 0 => '22', + 1 => '22/09/2012', + ], + 71 => [ + 0 => '20', + 1 => '20/12/2012', + ], + 72 => [ + 0 => '21', + 1 => '21/12/2012', + ], + 73 => [ + 0 => '22', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/MinutesTest.php b/tests/tests/Filtre/Date/MinutesTest.php new file mode 100644 index 0000000000..06635b9fd1 --- /dev/null +++ b/tests/tests/Filtre/Date/MinutesTest.php @@ -0,0 +1,330 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction minutes du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class MinutesTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresMinutes + */ + public function testFiltresMinutes($expected, ...$args): void + { + $actual = minutes(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresMinutes(): array + { + return [ + 0 => [ + 0 => '33', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => '12', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => '12', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '0', + 1 => '0000-00-00', + ], + 4 => [ + 0 => '0', + 1 => '0001-01-01', + ], + 5 => [ + 0 => '0', + 1 => '1970-01-01', + ], + 6 => [ + 0 => '25', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => '00', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => '59', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => '12', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => '12', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => '00', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => '00', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => '00', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => '00', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => '00', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => '00', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => '00', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => '00', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => '00', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => '00', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => '00', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => '00', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => '0', + 1 => '2001-07-05', + ], + 24 => [ + 0 => '0', + 1 => '2001-01-01', + ], + 25 => [ + 0 => '0', + 1 => '2001-12-31', + ], + 26 => [ + 0 => '0', + 1 => '2001-03-01', + ], + 27 => [ + 0 => '0', + 1 => '2004-02-29', + ], + 28 => [ + 0 => '0', + 1 => '2012-03-20', + ], + 29 => [ + 0 => '0', + 1 => '2012-03-21', + ], + 30 => [ + 0 => '0', + 1 => '2012-03-22', + ], + 31 => [ + 0 => '0', + 1 => '2012-06-20', + ], + 32 => [ + 0 => '0', + 1 => '2012-06-21', + ], + 33 => [ + 0 => '0', + 1 => '2012-06-22', + ], + 34 => [ + 0 => '0', + 1 => '2012-09-20', + ], + 35 => [ + 0 => '0', + 1 => '2012-09-21', + ], + 36 => [ + 0 => '0', + 1 => '2012-09-22', + ], + 37 => [ + 0 => '0', + 1 => '2012-12-20', + ], + 38 => [ + 0 => '0', + 1 => '2012-12-21', + ], + 39 => [ + 0 => '0', + 1 => '2012-12-22', + ], + 40 => [ + 0 => '0', + 1 => '2001/07/05', + ], + 41 => [ + 0 => '0', + 1 => '2001/01/01', + ], + 42 => [ + 0 => '0', + 1 => '2001/12/31', + ], + 43 => [ + 0 => '0', + 1 => '2001/03/01', + ], + 44 => [ + 0 => '0', + 1 => '2004/02/29', + ], + 45 => [ + 0 => '0', + 1 => '2012/03/20', + ], + 46 => [ + 0 => '0', + 1 => '2012/03/21', + ], + 47 => [ + 0 => '0', + 1 => '2012/03/22', + ], + 48 => [ + 0 => '0', + 1 => '2012/06/20', + ], + 49 => [ + 0 => '0', + 1 => '2012/06/21', + ], + 50 => [ + 0 => '0', + 1 => '2012/06/22', + ], + 51 => [ + 0 => '0', + 1 => '2012/09/20', + ], + 52 => [ + 0 => '0', + 1 => '2012/09/21', + ], + 53 => [ + 0 => '0', + 1 => '2012/09/22', + ], + 54 => [ + 0 => '0', + 1 => '2012/12/20', + ], + 55 => [ + 0 => '0', + 1 => '2012/12/21', + ], + 56 => [ + 0 => '0', + 1 => '2012/12/22', + ], + 57 => [ + 0 => '0', + 1 => '05/07/2001', + ], + 58 => [ + 0 => '0', + 1 => '01/01/2001', + ], + 59 => [ + 0 => '0', + 1 => '31/12/2001', + ], + 60 => [ + 0 => '0', + 1 => '01/03/2001', + ], + 61 => [ + 0 => '0', + 1 => '29/02/2004', + ], + 62 => [ + 0 => '0', + 1 => '20/03/2012', + ], + 63 => [ + 0 => '0', + 1 => '21/03/2012', + ], + 64 => [ + 0 => '0', + 1 => '22/03/2012', + ], + 65 => [ + 0 => '0', + 1 => '20/06/2012', + ], + 66 => [ + 0 => '0', + 1 => '21/06/2012', + ], + 67 => [ + 0 => '0', + 1 => '22/06/2012', + ], + 68 => [ + 0 => '0', + 1 => '20/09/2012', + ], + 69 => [ + 0 => '0', + 1 => '21/09/2012', + ], + 70 => [ + 0 => '0', + 1 => '22/09/2012', + ], + 71 => [ + 0 => '0', + 1 => '20/12/2012', + ], + 72 => [ + 0 => '0', + 1 => '21/12/2012', + ], + 73 => [ + 0 => '0', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/MoisTest.php b/tests/tests/Filtre/Date/MoisTest.php new file mode 100644 index 0000000000..fd2f13f2ae --- /dev/null +++ b/tests/tests/Filtre/Date/MoisTest.php @@ -0,0 +1,330 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction mois du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class MoisTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresMois + */ + public function testFiltresMois($expected, ...$args): void + { + $actual = mois(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresMois(): array + { + return [ + 0 => [ + 0 => '00', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => '03', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => '02', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '00', + 1 => '0000-00-00', + ], + 4 => [ + 0 => '01', + 1 => '0001-01-01', + ], + 5 => [ + 0 => '01', + 1 => '1970-01-01', + ], + 6 => [ + 0 => '07', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => '01', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => '12', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => '03', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => '02', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => '03', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => '03', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => '03', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => '06', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => '06', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => '06', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => '09', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => '09', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => '09', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => '12', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => '12', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => '12', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => '07', + 1 => '2001-07-05', + ], + 24 => [ + 0 => '01', + 1 => '2001-01-01', + ], + 25 => [ + 0 => '12', + 1 => '2001-12-31', + ], + 26 => [ + 0 => '03', + 1 => '2001-03-01', + ], + 27 => [ + 0 => '02', + 1 => '2004-02-29', + ], + 28 => [ + 0 => '03', + 1 => '2012-03-20', + ], + 29 => [ + 0 => '03', + 1 => '2012-03-21', + ], + 30 => [ + 0 => '03', + 1 => '2012-03-22', + ], + 31 => [ + 0 => '06', + 1 => '2012-06-20', + ], + 32 => [ + 0 => '06', + 1 => '2012-06-21', + ], + 33 => [ + 0 => '06', + 1 => '2012-06-22', + ], + 34 => [ + 0 => '09', + 1 => '2012-09-20', + ], + 35 => [ + 0 => '09', + 1 => '2012-09-21', + ], + 36 => [ + 0 => '09', + 1 => '2012-09-22', + ], + 37 => [ + 0 => '12', + 1 => '2012-12-20', + ], + 38 => [ + 0 => '12', + 1 => '2012-12-21', + ], + 39 => [ + 0 => '12', + 1 => '2012-12-22', + ], + 40 => [ + 0 => '07', + 1 => '2001/07/05', + ], + 41 => [ + 0 => '01', + 1 => '2001/01/01', + ], + 42 => [ + 0 => '12', + 1 => '2001/12/31', + ], + 43 => [ + 0 => '03', + 1 => '2001/03/01', + ], + 44 => [ + 0 => '02', + 1 => '2004/02/29', + ], + 45 => [ + 0 => '03', + 1 => '2012/03/20', + ], + 46 => [ + 0 => '03', + 1 => '2012/03/21', + ], + 47 => [ + 0 => '03', + 1 => '2012/03/22', + ], + 48 => [ + 0 => '06', + 1 => '2012/06/20', + ], + 49 => [ + 0 => '06', + 1 => '2012/06/21', + ], + 50 => [ + 0 => '06', + 1 => '2012/06/22', + ], + 51 => [ + 0 => '09', + 1 => '2012/09/20', + ], + 52 => [ + 0 => '09', + 1 => '2012/09/21', + ], + 53 => [ + 0 => '09', + 1 => '2012/09/22', + ], + 54 => [ + 0 => '12', + 1 => '2012/12/20', + ], + 55 => [ + 0 => '12', + 1 => '2012/12/21', + ], + 56 => [ + 0 => '12', + 1 => '2012/12/22', + ], + 57 => [ + 0 => '07', + 1 => '05/07/2001', + ], + 58 => [ + 0 => '01', + 1 => '01/01/2001', + ], + 59 => [ + 0 => '12', + 1 => '31/12/2001', + ], + 60 => [ + 0 => '03', + 1 => '01/03/2001', + ], + 61 => [ + 0 => '02', + 1 => '29/02/2004', + ], + 62 => [ + 0 => '03', + 1 => '20/03/2012', + ], + 63 => [ + 0 => '03', + 1 => '21/03/2012', + ], + 64 => [ + 0 => '03', + 1 => '22/03/2012', + ], + 65 => [ + 0 => '06', + 1 => '20/06/2012', + ], + 66 => [ + 0 => '06', + 1 => '21/06/2012', + ], + 67 => [ + 0 => '06', + 1 => '22/06/2012', + ], + 68 => [ + 0 => '09', + 1 => '20/09/2012', + ], + 69 => [ + 0 => '09', + 1 => '21/09/2012', + ], + 70 => [ + 0 => '09', + 1 => '22/09/2012', + ], + 71 => [ + 0 => '12', + 1 => '20/12/2012', + ], + 72 => [ + 0 => '12', + 1 => '21/12/2012', + ], + 73 => [ + 0 => '12', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/NomJourTest.php b/tests/tests/Filtre/Date/NomJourTest.php new file mode 100644 index 0000000000..a1f2dc9bb7 --- /dev/null +++ b/tests/tests/Filtre/Date/NomJourTest.php @@ -0,0 +1,336 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction nom_jour du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class NomJourTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + changer_langue('fr'); + // ce test est en fr + } + + /** + * @dataProvider providerFiltresNomJour + */ + public function testFiltresNomJour($expected, ...$args): void + { + $actual = nom_jour(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresNomJour(): array + { + return [ + 0 => [ + 0 => '', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => '', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => 'jeudi', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '', + 1 => '0000-00-00', + ], + 4 => [ + 0 => 'lundi', + 1 => '0001-01-01', + ], + 5 => [ + 0 => 'jeudi', + 1 => '1970-01-01', + ], + 6 => [ + 0 => 'jeudi', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => 'lundi', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => 'lundi', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => 'jeudi', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => 'dimanche', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => 'mardi', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => 'mercredi', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => 'jeudi', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => 'mercredi', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => 'jeudi', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => 'vendredi', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => 'jeudi', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => 'vendredi', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => 'samedi', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => 'jeudi', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => 'vendredi', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => 'samedi', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => 'jeudi', + 1 => '2001-07-05', + ], + 24 => [ + 0 => 'lundi', + 1 => '2001-01-01', + ], + 25 => [ + 0 => 'lundi', + 1 => '2001-12-31', + ], + 26 => [ + 0 => 'jeudi', + 1 => '2001-03-01', + ], + 27 => [ + 0 => 'dimanche', + 1 => '2004-02-29', + ], + 28 => [ + 0 => 'mardi', + 1 => '2012-03-20', + ], + 29 => [ + 0 => 'mercredi', + 1 => '2012-03-21', + ], + 30 => [ + 0 => 'jeudi', + 1 => '2012-03-22', + ], + 31 => [ + 0 => 'mercredi', + 1 => '2012-06-20', + ], + 32 => [ + 0 => 'jeudi', + 1 => '2012-06-21', + ], + 33 => [ + 0 => 'vendredi', + 1 => '2012-06-22', + ], + 34 => [ + 0 => 'jeudi', + 1 => '2012-09-20', + ], + 35 => [ + 0 => 'vendredi', + 1 => '2012-09-21', + ], + 36 => [ + 0 => 'samedi', + 1 => '2012-09-22', + ], + 37 => [ + 0 => 'jeudi', + 1 => '2012-12-20', + ], + 38 => [ + 0 => 'vendredi', + 1 => '2012-12-21', + ], + 39 => [ + 0 => 'samedi', + 1 => '2012-12-22', + ], + 40 => [ + 0 => 'vendredi', + 1 => '2001/07/05', + ], + 41 => [ + 0 => 'lundi', + 1 => '2001/01/01', + ], + 42 => [ + 0 => 'lundi', + 1 => '2001/12/31', + ], + 43 => [ + 0 => 'jeudi', + 1 => '2001/03/01', + ], + 44 => [ + 0 => 'dimanche', + 1 => '2004/02/29', + ], + 45 => [ + 0 => 'jeudi', + 1 => '2012/03/20', + ], + 46 => [ + 0 => 'vendredi', + 1 => '2012/03/21', + ], + 47 => [ + 0 => 'samedi', + 1 => '2012/03/22', + ], + 48 => [ + 0 => 'vendredi', + 1 => '2012/06/20', + ], + 49 => [ + 0 => 'samedi', + 1 => '2012/06/21', + ], + 50 => [ + 0 => 'dimanche', + 1 => '2012/06/22', + ], + 51 => [ + 0 => 'samedi', + 1 => '2012/09/20', + ], + 52 => [ + 0 => 'dimanche', + 1 => '2012/09/21', + ], + 53 => [ + 0 => 'lundi', + 1 => '2012/09/22', + ], + 54 => [ + 0 => 'samedi', + 1 => '2012/12/20', + ], + 55 => [ + 0 => 'dimanche', + 1 => '2012/12/21', + ], + 56 => [ + 0 => 'lundi', + 1 => '2012/12/22', + ], + 57 => [ + 0 => 'jeudi', + 1 => '05/07/2001', + ], + 58 => [ + 0 => 'lundi', + 1 => '01/01/2001', + ], + 59 => [ + 0 => 'lundi', + 1 => '31/12/2001', + ], + 60 => [ + 0 => 'jeudi', + 1 => '01/03/2001', + ], + 61 => [ + 0 => 'dimanche', + 1 => '29/02/2004', + ], + 62 => [ + 0 => 'mardi', + 1 => '20/03/2012', + ], + 63 => [ + 0 => 'mercredi', + 1 => '21/03/2012', + ], + 64 => [ + 0 => 'jeudi', + 1 => '22/03/2012', + ], + 65 => [ + 0 => 'mercredi', + 1 => '20/06/2012', + ], + 66 => [ + 0 => 'jeudi', + 1 => '21/06/2012', + ], + 67 => [ + 0 => 'vendredi', + 1 => '22/06/2012', + ], + 68 => [ + 0 => 'jeudi', + 1 => '20/09/2012', + ], + 69 => [ + 0 => 'vendredi', + 1 => '21/09/2012', + ], + 70 => [ + 0 => 'samedi', + 1 => '22/09/2012', + ], + 71 => [ + 0 => 'jeudi', + 1 => '20/12/2012', + ], + 72 => [ + 0 => 'vendredi', + 1 => '21/12/2012', + ], + 73 => [ + 0 => 'samedi', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/NomMoisTest.php b/tests/tests/Filtre/Date/NomMoisTest.php new file mode 100644 index 0000000000..c5df63be72 --- /dev/null +++ b/tests/tests/Filtre/Date/NomMoisTest.php @@ -0,0 +1,336 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction nom_mois du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class NomMoisTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + changer_langue('fr'); + // ce test est en fr + } + + /** + * @dataProvider providerFiltresNomMois + */ + public function testFiltresNomMois($expected, ...$args): void + { + $actual = nom_mois(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresNomMois(): array + { + return [ + 0 => [ + 0 => '', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => 'mars', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => 'février', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '', + 1 => '0000-00-00', + ], + 4 => [ + 0 => 'janvier', + 1 => '0001-01-01', + ], + 5 => [ + 0 => 'janvier', + 1 => '1970-01-01', + ], + 6 => [ + 0 => 'juillet', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => 'janvier', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => 'décembre', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => 'mars', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => 'février', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => 'mars', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => 'mars', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => 'mars', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => 'juin', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => 'juin', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => 'juin', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => 'septembre', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => 'septembre', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => 'septembre', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => 'décembre', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => 'décembre', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => 'décembre', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => 'juillet', + 1 => '2001-07-05', + ], + 24 => [ + 0 => 'janvier', + 1 => '2001-01-01', + ], + 25 => [ + 0 => 'décembre', + 1 => '2001-12-31', + ], + 26 => [ + 0 => 'mars', + 1 => '2001-03-01', + ], + 27 => [ + 0 => 'février', + 1 => '2004-02-29', + ], + 28 => [ + 0 => 'mars', + 1 => '2012-03-20', + ], + 29 => [ + 0 => 'mars', + 1 => '2012-03-21', + ], + 30 => [ + 0 => 'mars', + 1 => '2012-03-22', + ], + 31 => [ + 0 => 'juin', + 1 => '2012-06-20', + ], + 32 => [ + 0 => 'juin', + 1 => '2012-06-21', + ], + 33 => [ + 0 => 'juin', + 1 => '2012-06-22', + ], + 34 => [ + 0 => 'septembre', + 1 => '2012-09-20', + ], + 35 => [ + 0 => 'septembre', + 1 => '2012-09-21', + ], + 36 => [ + 0 => 'septembre', + 1 => '2012-09-22', + ], + 37 => [ + 0 => 'décembre', + 1 => '2012-12-20', + ], + 38 => [ + 0 => 'décembre', + 1 => '2012-12-21', + ], + 39 => [ + 0 => 'décembre', + 1 => '2012-12-22', + ], + 40 => [ + 0 => 'juillet', + 1 => '2001/07/05', + ], + 41 => [ + 0 => 'janvier', + 1 => '2001/01/01', + ], + 42 => [ + 0 => 'décembre', + 1 => '2001/12/31', + ], + 43 => [ + 0 => 'mars', + 1 => '2001/03/01', + ], + 44 => [ + 0 => 'février', + 1 => '2004/02/29', + ], + 45 => [ + 0 => 'mars', + 1 => '2012/03/20', + ], + 46 => [ + 0 => 'mars', + 1 => '2012/03/21', + ], + 47 => [ + 0 => 'mars', + 1 => '2012/03/22', + ], + 48 => [ + 0 => 'juin', + 1 => '2012/06/20', + ], + 49 => [ + 0 => 'juin', + 1 => '2012/06/21', + ], + 50 => [ + 0 => 'juin', + 1 => '2012/06/22', + ], + 51 => [ + 0 => 'septembre', + 1 => '2012/09/20', + ], + 52 => [ + 0 => 'septembre', + 1 => '2012/09/21', + ], + 53 => [ + 0 => 'septembre', + 1 => '2012/09/22', + ], + 54 => [ + 0 => 'décembre', + 1 => '2012/12/20', + ], + 55 => [ + 0 => 'décembre', + 1 => '2012/12/21', + ], + 56 => [ + 0 => 'décembre', + 1 => '2012/12/22', + ], + 57 => [ + 0 => 'juillet', + 1 => '05/07/2001', + ], + 58 => [ + 0 => 'janvier', + 1 => '01/01/2001', + ], + 59 => [ + 0 => 'décembre', + 1 => '31/12/2001', + ], + 60 => [ + 0 => 'mars', + 1 => '01/03/2001', + ], + 61 => [ + 0 => 'février', + 1 => '29/02/2004', + ], + 62 => [ + 0 => 'mars', + 1 => '20/03/2012', + ], + 63 => [ + 0 => 'mars', + 1 => '21/03/2012', + ], + 64 => [ + 0 => 'mars', + 1 => '22/03/2012', + ], + 65 => [ + 0 => 'juin', + 1 => '20/06/2012', + ], + 66 => [ + 0 => 'juin', + 1 => '21/06/2012', + ], + 67 => [ + 0 => 'juin', + 1 => '22/06/2012', + ], + 68 => [ + 0 => 'septembre', + 1 => '20/09/2012', + ], + 69 => [ + 0 => 'septembre', + 1 => '21/09/2012', + ], + 70 => [ + 0 => 'septembre', + 1 => '22/09/2012', + ], + 71 => [ + 0 => 'décembre', + 1 => '20/12/2012', + ], + 72 => [ + 0 => 'décembre', + 1 => '21/12/2012', + ], + 73 => [ + 0 => 'décembre', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/NormaliserDateTest.php b/tests/tests/Filtre/Date/NormaliserDateTest.php new file mode 100644 index 0000000000..3a64f979d1 --- /dev/null +++ b/tests/tests/Filtre/Date/NormaliserDateTest.php @@ -0,0 +1,750 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction normaliser_date du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class NormaliserDateTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + // Pour que le tests soit independant de la timezone du serveur + date_default_timezone_set('Europe/Paris'); + } + + /** + * @dataProvider providerFiltresNormaliserDate + */ + public function testFiltresNormaliserDate($expected, ...$args): void + { + $actual = normaliser_date(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresNormaliserDate(): array + { + return [ + 0 => [ + 0 => '2001-01-01 12:33:44', + 1 => '2001-00-00 12:33:44', + 2 => true, + ], + 1 => [ + 0 => '2001-00-00 12:33:44', + 1 => '2001-00-00 12:33:44', + 2 => false, + ], + 2 => [ + 0 => '2001-03-01 09:12:57', + 1 => '2001-03-00 09:12:57', + 2 => true, + ], + 3 => [ + 0 => '2001-03-00 09:12:57', + 1 => '2001-03-00 09:12:57', + 2 => false, + ], + 4 => [ + 0 => '2001-03-01 14:12:33', + 1 => '2001-02-29 14:12:33', + 2 => true, + ], + 5 => [ + 0 => '2001-03-01 14:12:33', + 1 => '2001-02-29 14:12:33', + 2 => false, + ], + 6 => [ + 0 => '2001-07-05 18:25:24', + 1 => '2001-07-05 18:25:24', + 2 => true, + ], + 7 => [ + 0 => '2001-07-05 18:25:24', + 1 => '2001-07-05 18:25:24', + 2 => false, + ], + 8 => [ + 0 => '2001-01-01 00:00:00', + 1 => '2001-01-01 00:00:00', + 2 => true, + ], + 9 => [ + 0 => '2001-01-01 00:00:00', + 1 => '2001-01-01 00:00:00', + 2 => false, + ], + 10 => [ + 0 => '2001-12-31 23:59:59', + 1 => '2001-12-31 23:59:59', + 2 => true, + ], + 11 => [ + 0 => '2001-12-31 23:59:59', + 1 => '2001-12-31 23:59:59', + 2 => false, + ], + 12 => [ + 0 => '2001-03-01 14:12:33', + 1 => '2001-03-01 14:12:33', + 2 => true, + ], + 13 => [ + 0 => '2001-03-01 14:12:33', + 1 => '2001-03-01 14:12:33', + 2 => false, + ], + 14 => [ + 0 => '2004-02-29 14:12:33', + 1 => '2004-02-29 14:12:33', + 2 => true, + ], + 15 => [ + 0 => '2004-02-29 14:12:33', + 1 => '2004-02-29 14:12:33', + 2 => false, + ], + 16 => [ + 0 => '2012-03-20 12:00:00', + 1 => '2012-03-20 12:00:00', + 2 => true, + ], + 17 => [ + 0 => '2012-03-20 12:00:00', + 1 => '2012-03-20 12:00:00', + 2 => false, + ], + 18 => [ + 0 => '2012-03-21 12:00:00', + 1 => '2012-03-21 12:00:00', + 2 => true, + ], + 19 => [ + 0 => '2012-03-21 12:00:00', + 1 => '2012-03-21 12:00:00', + 2 => false, + ], + 20 => [ + 0 => '2012-03-22 12:00:00', + 1 => '2012-03-22 12:00:00', + 2 => true, + ], + 21 => [ + 0 => '2012-03-22 12:00:00', + 1 => '2012-03-22 12:00:00', + 2 => false, + ], + 22 => [ + 0 => '2012-06-20 12:00:00', + 1 => '2012-06-20 12:00:00', + 2 => true, + ], + 23 => [ + 0 => '2012-06-20 12:00:00', + 1 => '2012-06-20 12:00:00', + 2 => false, + ], + 24 => [ + 0 => '2012-06-21 12:00:00', + 1 => '2012-06-21 12:00:00', + 2 => true, + ], + 25 => [ + 0 => '2012-06-21 12:00:00', + 1 => '2012-06-21 12:00:00', + 2 => false, + ], + 26 => [ + 0 => '2012-06-22 12:00:00', + 1 => '2012-06-22 12:00:00', + 2 => true, + ], + 27 => [ + 0 => '2012-06-22 12:00:00', + 1 => '2012-06-22 12:00:00', + 2 => false, + ], + 28 => [ + 0 => '2012-09-20 12:00:00', + 1 => '2012-09-20 12:00:00', + 2 => true, + ], + 29 => [ + 0 => '2012-09-20 12:00:00', + 1 => '2012-09-20 12:00:00', + 2 => false, + ], + 30 => [ + 0 => '2012-09-21 12:00:00', + 1 => '2012-09-21 12:00:00', + 2 => true, + ], + 31 => [ + 0 => '2012-09-21 12:00:00', + 1 => '2012-09-21 12:00:00', + 2 => false, + ], + 32 => [ + 0 => '2012-09-22 12:00:00', + 1 => '2012-09-22 12:00:00', + 2 => true, + ], + 33 => [ + 0 => '2012-09-22 12:00:00', + 1 => '2012-09-22 12:00:00', + 2 => false, + ], + 34 => [ + 0 => '2012-12-20 12:00:00', + 1 => '2012-12-20 12:00:00', + 2 => true, + ], + 35 => [ + 0 => '2012-12-20 12:00:00', + 1 => '2012-12-20 12:00:00', + 2 => false, + ], + 36 => [ + 0 => '2012-12-21 12:00:00', + 1 => '2012-12-21 12:00:00', + 2 => true, + ], + 37 => [ + 0 => '2012-12-21 12:00:00', + 1 => '2012-12-21 12:00:00', + 2 => false, + ], + 38 => [ + 0 => '2012-12-22 12:00:00', + 1 => '2012-12-22 12:00:00', + 2 => true, + ], + 39 => [ + 0 => '2012-12-22 12:00:00', + 1 => '2012-12-22 12:00:00', + 2 => false, + ], + 40 => [ + 0 => '2001-07-05 00:00:00', + 1 => '2001-07-05', + 2 => true, + ], + 41 => [ + 0 => '2001-07-05 00:00:00', + 1 => '2001-07-05', + 2 => false, + ], + 42 => [ + 0 => '2001-01-01 00:00:00', + 1 => '2001-01-01', + 2 => true, + ], + 43 => [ + 0 => '2001-01-01 00:00:00', + 1 => '2001-01-01', + 2 => false, + ], + 44 => [ + 0 => '2001-12-31 00:00:00', + 1 => '2001-12-31', + 2 => true, + ], + 45 => [ + 0 => '2001-12-31 00:00:00', + 1 => '2001-12-31', + 2 => false, + ], + 46 => [ + 0 => '2001-03-01 00:00:00', + 1 => '2001-03-01', + 2 => true, + ], + 47 => [ + 0 => '2001-03-01 00:00:00', + 1 => '2001-03-01', + 2 => false, + ], + 48 => [ + 0 => '2004-02-29 00:00:00', + 1 => '2004-02-29', + 2 => true, + ], + 49 => [ + 0 => '2004-02-29 00:00:00', + 1 => '2004-02-29', + 2 => false, + ], + 50 => [ + 0 => '2012-03-20 00:00:00', + 1 => '2012-03-20', + 2 => true, + ], + 51 => [ + 0 => '2012-03-20 00:00:00', + 1 => '2012-03-20', + 2 => false, + ], + 52 => [ + 0 => '2012-03-21 00:00:00', + 1 => '2012-03-21', + 2 => true, + ], + 53 => [ + 0 => '2012-03-21 00:00:00', + 1 => '2012-03-21', + 2 => false, + ], + 54 => [ + 0 => '2012-03-22 00:00:00', + 1 => '2012-03-22', + 2 => true, + ], + 55 => [ + 0 => '2012-03-22 00:00:00', + 1 => '2012-03-22', + 2 => false, + ], + 56 => [ + 0 => '2012-06-20 00:00:00', + 1 => '2012-06-20', + 2 => true, + ], + 57 => [ + 0 => '2012-06-20 00:00:00', + 1 => '2012-06-20', + 2 => false, + ], + 58 => [ + 0 => '2012-06-21 00:00:00', + 1 => '2012-06-21', + 2 => true, + ], + 59 => [ + 0 => '2012-06-21 00:00:00', + 1 => '2012-06-21', + 2 => false, + ], + 60 => [ + 0 => '2012-06-22 00:00:00', + 1 => '2012-06-22', + 2 => true, + ], + 61 => [ + 0 => '2012-06-22 00:00:00', + 1 => '2012-06-22', + 2 => false, + ], + 62 => [ + 0 => '2012-09-20 00:00:00', + 1 => '2012-09-20', + 2 => true, + ], + 63 => [ + 0 => '2012-09-20 00:00:00', + 1 => '2012-09-20', + 2 => false, + ], + 64 => [ + 0 => '2012-09-21 00:00:00', + 1 => '2012-09-21', + 2 => true, + ], + 65 => [ + 0 => '2012-09-21 00:00:00', + 1 => '2012-09-21', + 2 => false, + ], + 66 => [ + 0 => '2012-09-22 00:00:00', + 1 => '2012-09-22', + 2 => true, + ], + 67 => [ + 0 => '2012-09-22 00:00:00', + 1 => '2012-09-22', + 2 => false, + ], + 68 => [ + 0 => '2012-12-20 00:00:00', + 1 => '2012-12-20', + 2 => true, + ], + 69 => [ + 0 => '2012-12-20 00:00:00', + 1 => '2012-12-20', + 2 => false, + ], + 70 => [ + 0 => '2012-12-21 00:00:00', + 1 => '2012-12-21', + 2 => true, + ], + 71 => [ + 0 => '2012-12-21 00:00:00', + 1 => '2012-12-21', + 2 => false, + ], + 72 => [ + 0 => '2012-12-22 00:00:00', + 1 => '2012-12-22', + 2 => true, + ], + 73 => [ + 0 => '2012-12-22 00:00:00', + 1 => '2012-12-22', + 2 => false, + ], + 74 => [ + 0 => '2001-07-05 00:00:00', + 1 => '2001/07/05', + 2 => true, + ], + 75 => [ + 0 => '2001-07-05 00:00:00', + 1 => '2001/07/05', + 2 => false, + ], + 76 => [ + 0 => '2001-01-01 00:00:00', + 1 => '2001/01/01', + 2 => true, + ], + 77 => [ + 0 => '2001-01-01 00:00:00', + 1 => '2001/01/01', + 2 => false, + ], + 78 => [ + 0 => '2001-12-31 00:00:00', + 1 => '2001/12/31', + 2 => true, + ], + 79 => [ + 0 => '2001-12-31 00:00:00', + 1 => '2001/12/31', + 2 => false, + ], + 80 => [ + 0 => '2001-03-01 00:00:00', + 1 => '2001/03/01', + 2 => true, + ], + 81 => [ + 0 => '2001-03-01 00:00:00', + 1 => '2001/03/01', + 2 => false, + ], + 82 => [ + 0 => '2004-02-29 00:00:00', + 1 => '2004/02/29', + 2 => true, + ], + 83 => [ + 0 => '2004-02-29 00:00:00', + 1 => '2004/02/29', + 2 => false, + ], + 84 => [ + 0 => '2012-03-20 00:00:00', + 1 => '2012/03/20', + 2 => true, + ], + 85 => [ + 0 => '2012-03-20 00:00:00', + 1 => '2012/03/20', + 2 => false, + ], + 86 => [ + 0 => '2012-03-21 00:00:00', + 1 => '2012/03/21', + 2 => true, + ], + 87 => [ + 0 => '2012-03-21 00:00:00', + 1 => '2012/03/21', + 2 => false, + ], + 88 => [ + 0 => '2012-03-22 00:00:00', + 1 => '2012/03/22', + 2 => true, + ], + 89 => [ + 0 => '2012-03-22 00:00:00', + 1 => '2012/03/22', + 2 => false, + ], + 90 => [ + 0 => '2012-06-20 00:00:00', + 1 => '2012/06/20', + 2 => true, + ], + 91 => [ + 0 => '2012-06-20 00:00:00', + 1 => '2012/06/20', + 2 => false, + ], + 92 => [ + 0 => '2012-06-21 00:00:00', + 1 => '2012/06/21', + 2 => true, + ], + 93 => [ + 0 => '2012-06-21 00:00:00', + 1 => '2012/06/21', + 2 => false, + ], + 94 => [ + 0 => '2012-06-22 00:00:00', + 1 => '2012/06/22', + 2 => true, + ], + 95 => [ + 0 => '2012-06-22 00:00:00', + 1 => '2012/06/22', + 2 => false, + ], + 96 => [ + 0 => '2012-09-20 00:00:00', + 1 => '2012/09/20', + 2 => true, + ], + 97 => [ + 0 => '2012-09-20 00:00:00', + 1 => '2012/09/20', + 2 => false, + ], + 98 => [ + 0 => '2012-09-21 00:00:00', + 1 => '2012/09/21', + 2 => true, + ], + 99 => [ + 0 => '2012-09-21 00:00:00', + 1 => '2012/09/21', + 2 => false, + ], + 100 => [ + 0 => '2012-09-22 00:00:00', + 1 => '2012/09/22', + 2 => true, + ], + 101 => [ + 0 => '2012-09-22 00:00:00', + 1 => '2012/09/22', + 2 => false, + ], + 102 => [ + 0 => '2012-12-20 00:00:00', + 1 => '2012/12/20', + 2 => true, + ], + 103 => [ + 0 => '2012-12-20 00:00:00', + 1 => '2012/12/20', + 2 => false, + ], + 104 => [ + 0 => '2012-12-21 00:00:00', + 1 => '2012/12/21', + 2 => true, + ], + 105 => [ + 0 => '2012-12-21 00:00:00', + 1 => '2012/12/21', + 2 => false, + ], + 106 => [ + 0 => '2012-12-22 00:00:00', + 1 => '2012/12/22', + 2 => true, + ], + 107 => [ + 0 => '2012-12-22 00:00:00', + 1 => '2012/12/22', + 2 => false, + ], + 108 => [ + 0 => '2001-05-07 00:00:00', + 1 => '05/07/2001', + 2 => true, + ], + 109 => [ + 0 => '2001-05-07 00:00:00', + 1 => '05/07/2001', + 2 => false, + ], + 110 => [ + 0 => '2001-01-01 00:00:00', + 1 => '01/01/2001', + 2 => true, + ], + 111 => [ + 0 => '2001-01-01 00:00:00', + 1 => '01/01/2001', + 2 => false, + ], + 112 => [ + 0 => '1970-01-01 01:00:00', + 1 => '31/12/2001', + 2 => true, + ], + 113 => [ + 0 => '1970-01-01 01:00:00', + 1 => '31/12/2001', + 2 => false, + ], + 114 => [ + 0 => '2001-01-03 00:00:00', + 1 => '01/03/2001', + 2 => true, + ], + 115 => [ + 0 => '2001-01-03 00:00:00', + 1 => '01/03/2001', + 2 => false, + ], + 116 => [ + 0 => '1970-01-01 01:00:00', + 1 => '29/02/2004', + 2 => true, + ], + 117 => [ + 0 => '1970-01-01 01:00:00', + 1 => '29/02/2004', + 2 => false, + ], + 118 => [ + 0 => '1970-01-01 01:00:00', + 1 => '20/03/2012', + 2 => true, + ], + 119 => [ + 0 => '1970-01-01 01:00:00', + 1 => '20/03/2012', + 2 => false, + ], + 120 => [ + 0 => '1970-01-01 01:00:00', + 1 => '21/03/2012', + 2 => true, + ], + 121 => [ + 0 => '1970-01-01 01:00:00', + 1 => '21/03/2012', + 2 => false, + ], + 122 => [ + 0 => '1970-01-01 01:00:00', + 1 => '22/03/2012', + 2 => true, + ], + 123 => [ + 0 => '1970-01-01 01:00:00', + 1 => '22/03/2012', + 2 => false, + ], + 124 => [ + 0 => '1970-01-01 01:00:00', + 1 => '20/06/2012', + 2 => true, + ], + 125 => [ + 0 => '1970-01-01 01:00:00', + 1 => '20/06/2012', + 2 => false, + ], + 126 => [ + 0 => '1970-01-01 01:00:00', + 1 => '21/06/2012', + 2 => true, + ], + 127 => [ + 0 => '1970-01-01 01:00:00', + 1 => '21/06/2012', + 2 => false, + ], + 128 => [ + 0 => '1970-01-01 01:00:00', + 1 => '22/06/2012', + 2 => true, + ], + 129 => [ + 0 => '1970-01-01 01:00:00', + 1 => '22/06/2012', + 2 => false, + ], + 130 => [ + 0 => '1970-01-01 01:00:00', + 1 => '20/09/2012', + 2 => true, + ], + 131 => [ + 0 => '1970-01-01 01:00:00', + 1 => '20/09/2012', + 2 => false, + ], + 132 => [ + 0 => '1970-01-01 01:00:00', + 1 => '21/09/2012', + 2 => true, + ], + 133 => [ + 0 => '1970-01-01 01:00:00', + 1 => '21/09/2012', + 2 => false, + ], + 134 => [ + 0 => '1970-01-01 01:00:00', + 1 => '22/09/2012', + 2 => true, + ], + 135 => [ + 0 => '1970-01-01 01:00:00', + 1 => '22/09/2012', + 2 => false, + ], + 136 => [ + 0 => '1970-01-01 01:00:00', + 1 => '20/12/2012', + 2 => true, + ], + 137 => [ + 0 => '1970-01-01 01:00:00', + 1 => '20/12/2012', + 2 => false, + ], + 138 => [ + 0 => '1970-01-01 01:00:00', + 1 => '21/12/2012', + 2 => true, + ], + 139 => [ + 0 => '1970-01-01 01:00:00', + 1 => '21/12/2012', + 2 => false, + ], + 140 => [ + 0 => '1970-01-01 01:00:00', + 1 => '22/12/2012', + 2 => true, + ], + 141 => [ + 0 => '1970-01-01 01:00:00', + 1 => '22/12/2012', + 2 => false, + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/RecupDateTest.php b/tests/tests/Filtre/Date/RecupDateTest.php new file mode 100644 index 0000000000..8b9fca856c --- /dev/null +++ b/tests/tests/Filtre/Date/RecupDateTest.php @@ -0,0 +1,1810 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction recup_date du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class RecupDateTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresRecupDate + */ + public function testFiltresRecupDate($expected, ...$args): void + { + $actual = recup_date(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresRecupDate(): array + { + return [ + 0 => [ + 0 => [ + 0 => '2001', + 1 => '1', + 2 => '1', + 3 => '12', + 4 => '33', + 5 => '44', + ], + 1 => '2001-00-00 12:33:44', + 2 => true, + ], + 1 => [ + 0 => [ + 0 => '2001', + 1 => '00', + 2 => '0', + 3 => '12', + 4 => '33', + 5 => '44', + ], + 1 => '2001-00-00 12:33:44', + 2 => false, + ], + 2 => [ + 0 => [ + 0 => '2001', + 1 => '03', + 2 => '1', + 3 => '09', + 4 => '12', + 5 => '57', + ], + 1 => '2001-03-00 09:12:57', + 2 => true, + ], + 3 => [ + 0 => [ + 0 => '2001', + 1 => '03', + 2 => '0', + 3 => '09', + 4 => '12', + 5 => '57', + ], + 1 => '2001-03-00 09:12:57', + 2 => false, + ], + 4 => [ + 0 => [ + 0 => '2001', + 1 => '02', + 2 => '29', + 3 => '14', + 4 => '12', + 5 => '33', + ], + 1 => '2001-02-29 14:12:33', + 2 => true, + ], + 5 => [ + 0 => [ + 0 => '2001', + 1 => '02', + 2 => '29', + 3 => '14', + 4 => '12', + 5 => '33', + ], + 1 => '2001-02-29 14:12:33', + 2 => false, + ], + 6 => [ + 0 => [ + 0 => '0000', + 1 => '1', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '0000-00-00', + 2 => true, + ], + 7 => [ + 0 => [ + 0 => '0000', + 1 => '00', + 2 => '0', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '0000-00-00', + 2 => false, + ], + 8 => [ + 0 => [ + 0 => '0001', + 1 => '01', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '0001-01-01', + 2 => true, + ], + 9 => [ + 0 => [ + 0 => '0001', + 1 => '01', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '0001-01-01', + 2 => false, + ], + 10 => [ + 0 => [ + 0 => '1970', + 1 => '01', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '1970-01-01', + 2 => true, + ], + 11 => [ + 0 => [ + 0 => '1970', + 1 => '01', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '1970-01-01', + 2 => false, + ], + 12 => [ + 0 => [ + 0 => '2001', + 1 => '07', + 2 => '5', + 3 => '18', + 4 => '25', + 5 => '24', + ], + 1 => '2001-07-05 18:25:24', + 2 => true, + ], + 13 => [ + 0 => [ + 0 => '2001', + 1 => '07', + 2 => '5', + 3 => '18', + 4 => '25', + 5 => '24', + ], + 1 => '2001-07-05 18:25:24', + 2 => false, + ], + 14 => [ + 0 => [ + 0 => '2001', + 1 => '01', + 2 => '1', + 3 => '00', + 4 => '00', + 5 => '00', + ], + 1 => '2001-01-01 00:00:00', + 2 => true, + ], + 15 => [ + 0 => [ + 0 => '2001', + 1 => '01', + 2 => '1', + 3 => '00', + 4 => '00', + 5 => '00', + ], + 1 => '2001-01-01 00:00:00', + 2 => false, + ], + 16 => [ + 0 => [ + 0 => '2001', + 1 => '12', + 2 => '31', + 3 => '23', + 4 => '59', + 5 => '59', + ], + 1 => '2001-12-31 23:59:59', + 2 => true, + ], + 17 => [ + 0 => [ + 0 => '2001', + 1 => '12', + 2 => '31', + 3 => '23', + 4 => '59', + 5 => '59', + ], + 1 => '2001-12-31 23:59:59', + 2 => false, + ], + 18 => [ + 0 => [ + 0 => '2001', + 1 => '03', + 2 => '1', + 3 => '14', + 4 => '12', + 5 => '33', + ], + 1 => '2001-03-01 14:12:33', + 2 => true, + ], + 19 => [ + 0 => [ + 0 => '2001', + 1 => '03', + 2 => '1', + 3 => '14', + 4 => '12', + 5 => '33', + ], + 1 => '2001-03-01 14:12:33', + 2 => false, + ], + 20 => [ + 0 => [ + 0 => '2004', + 1 => '02', + 2 => '29', + 3 => '14', + 4 => '12', + 5 => '33', + ], + 1 => '2004-02-29 14:12:33', + 2 => true, + ], + 21 => [ + 0 => [ + 0 => '2004', + 1 => '02', + 2 => '29', + 3 => '14', + 4 => '12', + 5 => '33', + ], + 1 => '2004-02-29 14:12:33', + 2 => false, + ], + 22 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '20', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-03-20 12:00:00', + 2 => true, + ], + 23 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '20', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-03-20 12:00:00', + 2 => false, + ], + 24 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '21', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-03-21 12:00:00', + 2 => true, + ], + 25 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '21', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-03-21 12:00:00', + 2 => false, + ], + 26 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '22', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-03-22 12:00:00', + 2 => true, + ], + 27 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '22', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-03-22 12:00:00', + 2 => false, + ], + 28 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '20', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-06-20 12:00:00', + 2 => true, + ], + 29 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '20', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-06-20 12:00:00', + 2 => false, + ], + 30 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '21', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-06-21 12:00:00', + 2 => true, + ], + 31 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '21', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-06-21 12:00:00', + 2 => false, + ], + 32 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '22', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-06-22 12:00:00', + 2 => true, + ], + 33 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '22', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-06-22 12:00:00', + 2 => false, + ], + 34 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '20', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-09-20 12:00:00', + 2 => true, + ], + 35 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '20', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-09-20 12:00:00', + 2 => false, + ], + 36 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '21', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-09-21 12:00:00', + 2 => true, + ], + 37 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '21', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-09-21 12:00:00', + 2 => false, + ], + 38 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '22', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-09-22 12:00:00', + 2 => true, + ], + 39 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '22', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-09-22 12:00:00', + 2 => false, + ], + 40 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '20', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-12-20 12:00:00', + 2 => true, + ], + 41 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '20', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-12-20 12:00:00', + 2 => false, + ], + 42 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '21', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-12-21 12:00:00', + 2 => true, + ], + 43 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '21', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-12-21 12:00:00', + 2 => false, + ], + 44 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '22', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-12-22 12:00:00', + 2 => true, + ], + 45 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '22', + 3 => '12', + 4 => '00', + 5 => '00', + ], + 1 => '2012-12-22 12:00:00', + 2 => false, + ], + 46 => [ + 0 => [ + 0 => '2001', + 1 => '07', + 2 => '5', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001-07-05', + 2 => true, + ], + 47 => [ + 0 => [ + 0 => '2001', + 1 => '07', + 2 => '5', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001-07-05', + 2 => false, + ], + 48 => [ + 0 => [ + 0 => '2001', + 1 => '01', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001-01-01', + 2 => true, + ], + 49 => [ + 0 => [ + 0 => '2001', + 1 => '01', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001-01-01', + 2 => false, + ], + 50 => [ + 0 => [ + 0 => '2001', + 1 => '12', + 2 => '31', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001-12-31', + 2 => true, + ], + 51 => [ + 0 => [ + 0 => '2001', + 1 => '12', + 2 => '31', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001-12-31', + 2 => false, + ], + 52 => [ + 0 => [ + 0 => '2001', + 1 => '03', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001-03-01', + 2 => true, + ], + 53 => [ + 0 => [ + 0 => '2001', + 1 => '03', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001-03-01', + 2 => false, + ], + 54 => [ + 0 => [ + 0 => '2004', + 1 => '02', + 2 => '29', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2004-02-29', + 2 => true, + ], + 55 => [ + 0 => [ + 0 => '2004', + 1 => '02', + 2 => '29', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2004-02-29', + 2 => false, + ], + 56 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-03-20', + 2 => true, + ], + 57 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-03-20', + 2 => false, + ], + 58 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-03-21', + 2 => true, + ], + 59 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-03-21', + 2 => false, + ], + 60 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-03-22', + 2 => true, + ], + 61 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-03-22', + 2 => false, + ], + 62 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-06-20', + 2 => true, + ], + 63 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-06-20', + 2 => false, + ], + 64 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-06-21', + 2 => true, + ], + 65 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-06-21', + 2 => false, + ], + 66 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-06-22', + 2 => true, + ], + 67 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-06-22', + 2 => false, + ], + 68 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-09-20', + 2 => true, + ], + 69 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-09-20', + 2 => false, + ], + 70 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-09-21', + 2 => true, + ], + 71 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-09-21', + 2 => false, + ], + 72 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-09-22', + 2 => true, + ], + 73 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-09-22', + 2 => false, + ], + 74 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-12-20', + 2 => true, + ], + 75 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-12-20', + 2 => false, + ], + 76 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-12-21', + 2 => true, + ], + 77 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-12-21', + 2 => false, + ], + 78 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-12-22', + 2 => true, + ], + 79 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012-12-22', + 2 => false, + ], + 80 => [ + 0 => [ + 0 => 2005, + 1 => '07', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001/07/05', + 2 => true, + ], + 81 => [ + 0 => [ + 0 => 2005, + 1 => '07', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001/07/05', + 2 => false, + ], + 82 => [ + 0 => [ + 0 => 2001, + 1 => '01', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001/01/01', + 2 => true, + ], + 83 => [ + 0 => [ + 0 => 2001, + 1 => '01', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001/01/01', + 2 => false, + ], + 84 => [ + 0 => [ + 0 => 2031, + 1 => '12', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001/12/31', + 2 => true, + ], + 85 => [ + 0 => [ + 0 => 2031, + 1 => '12', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001/12/31', + 2 => false, + ], + 86 => [ + 0 => [ + 0 => 2001, + 1 => '03', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001/03/01', + 2 => true, + ], + 87 => [ + 0 => [ + 0 => 2001, + 1 => '03', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2001/03/01', + 2 => false, + ], + 88 => [ + 0 => [ + 0 => 2029, + 1 => '02', + 2 => '4', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2004/02/29', + 2 => true, + ], + 89 => [ + 0 => [ + 0 => 2029, + 1 => '02', + 2 => '4', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2004/02/29', + 2 => false, + ], + 90 => [ + 0 => [ + 0 => 2020, + 1 => '03', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/03/20', + 2 => true, + ], + 91 => [ + 0 => [ + 0 => 2020, + 1 => '03', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/03/20', + 2 => false, + ], + 92 => [ + 0 => [ + 0 => 2021, + 1 => '03', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/03/21', + 2 => true, + ], + 93 => [ + 0 => [ + 0 => 2021, + 1 => '03', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/03/21', + 2 => false, + ], + 94 => [ + 0 => [ + 0 => 2022, + 1 => '03', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/03/22', + 2 => true, + ], + 95 => [ + 0 => [ + 0 => 2022, + 1 => '03', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/03/22', + 2 => false, + ], + 96 => [ + 0 => [ + 0 => 2020, + 1 => '06', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/06/20', + 2 => true, + ], + 97 => [ + 0 => [ + 0 => 2020, + 1 => '06', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/06/20', + 2 => false, + ], + 98 => [ + 0 => [ + 0 => 2021, + 1 => '06', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/06/21', + 2 => true, + ], + 99 => [ + 0 => [ + 0 => 2021, + 1 => '06', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/06/21', + 2 => false, + ], + 100 => [ + 0 => [ + 0 => 2022, + 1 => '06', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/06/22', + 2 => true, + ], + 101 => [ + 0 => [ + 0 => 2022, + 1 => '06', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/06/22', + 2 => false, + ], + 102 => [ + 0 => [ + 0 => 2020, + 1 => '09', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/09/20', + 2 => true, + ], + 103 => [ + 0 => [ + 0 => 2020, + 1 => '09', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/09/20', + 2 => false, + ], + 104 => [ + 0 => [ + 0 => 2021, + 1 => '09', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/09/21', + 2 => true, + ], + 105 => [ + 0 => [ + 0 => 2021, + 1 => '09', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/09/21', + 2 => false, + ], + 106 => [ + 0 => [ + 0 => 2022, + 1 => '09', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/09/22', + 2 => true, + ], + 107 => [ + 0 => [ + 0 => 2022, + 1 => '09', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/09/22', + 2 => false, + ], + 108 => [ + 0 => [ + 0 => 2020, + 1 => '12', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/12/20', + 2 => true, + ], + 109 => [ + 0 => [ + 0 => 2020, + 1 => '12', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/12/20', + 2 => false, + ], + 110 => [ + 0 => [ + 0 => 2021, + 1 => '12', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/12/21', + 2 => true, + ], + 111 => [ + 0 => [ + 0 => 2021, + 1 => '12', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/12/21', + 2 => false, + ], + 112 => [ + 0 => [ + 0 => 2022, + 1 => '12', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/12/22', + 2 => true, + ], + 113 => [ + 0 => [ + 0 => 2022, + 1 => '12', + 2 => '12', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '2012/12/22', + 2 => false, + ], + 114 => [ + 0 => [ + 0 => '2001', + 1 => '07', + 2 => '5', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '05/07/2001', + 2 => true, + ], + 115 => [ + 0 => [ + 0 => '2001', + 1 => '07', + 2 => '5', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '05/07/2001', + 2 => false, + ], + 116 => [ + 0 => [ + 0 => '2001', + 1 => '01', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '01/01/2001', + 2 => true, + ], + 117 => [ + 0 => [ + 0 => '2001', + 1 => '01', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '01/01/2001', + 2 => false, + ], + 118 => [ + 0 => [ + 0 => '2001', + 1 => '12', + 2 => '31', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '31/12/2001', + 2 => true, + ], + 119 => [ + 0 => [ + 0 => '2001', + 1 => '12', + 2 => '31', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '31/12/2001', + 2 => false, + ], + 120 => [ + 0 => [ + 0 => '2001', + 1 => '03', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '01/03/2001', + 2 => true, + ], + 121 => [ + 0 => [ + 0 => '2001', + 1 => '03', + 2 => '1', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '01/03/2001', + 2 => false, + ], + 122 => [ + 0 => [ + 0 => '2004', + 1 => '02', + 2 => '29', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '29/02/2004', + 2 => true, + ], + 123 => [ + 0 => [ + 0 => '2004', + 1 => '02', + 2 => '29', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '29/02/2004', + 2 => false, + ], + 124 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '20/03/2012', + 2 => true, + ], + 125 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '20/03/2012', + 2 => false, + ], + 126 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '21/03/2012', + 2 => true, + ], + 127 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '21/03/2012', + 2 => false, + ], + 128 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '22/03/2012', + 2 => true, + ], + 129 => [ + 0 => [ + 0 => '2012', + 1 => '03', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '22/03/2012', + 2 => false, + ], + 130 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '20/06/2012', + 2 => true, + ], + 131 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '20/06/2012', + 2 => false, + ], + 132 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '21/06/2012', + 2 => true, + ], + 133 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '21/06/2012', + 2 => false, + ], + 134 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '22/06/2012', + 2 => true, + ], + 135 => [ + 0 => [ + 0 => '2012', + 1 => '06', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '22/06/2012', + 2 => false, + ], + 136 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '20/09/2012', + 2 => true, + ], + 137 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '20/09/2012', + 2 => false, + ], + 138 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '21/09/2012', + 2 => true, + ], + 139 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '21/09/2012', + 2 => false, + ], + 140 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '22/09/2012', + 2 => true, + ], + 141 => [ + 0 => [ + 0 => '2012', + 1 => '09', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '22/09/2012', + 2 => false, + ], + 142 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '20/12/2012', + 2 => true, + ], + 143 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '20', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '20/12/2012', + 2 => false, + ], + 144 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '21/12/2012', + 2 => true, + ], + 145 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '21', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '21/12/2012', + 2 => false, + ], + 146 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '22/12/2012', + 2 => true, + ], + 147 => [ + 0 => [ + 0 => '2012', + 1 => '12', + 2 => '22', + 3 => 0, + 4 => 0, + 5 => 0, + ], + 1 => '22/12/2012', + 2 => false, + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/RecupHeureTest.php b/tests/tests/Filtre/Date/RecupHeureTest.php new file mode 100644 index 0000000000..be6642661d --- /dev/null +++ b/tests/tests/Filtre/Date/RecupHeureTest.php @@ -0,0 +1,179 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction recup_heure du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class RecupHeureTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresRecupHeure + */ + public function testFiltresRecupHeure($expected, ...$args): void + { + $actual = recup_heure(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresRecupHeure(): array + { + return [ + // pas d’heure + 'yyyy-mm-dd #1' => [ + 0 => [ + 0 => 0, + 1 => 0, + 2 => 0, + ], + 1 => '0000-00-00', + ], + 'yyyy-mm-dd #2' => [ + 0 => [ + 0 => 0, + 1 => 0, + 2 => 0, + ], + 1 => '0001-01-01', + ], + 'yyyy-mm-dd #3' => [ + 0 => [ + 0 => 0, + 1 => 0, + 2 => 0, + ], + 1 => '1970-01-01', + ], + 'yyyy-mm-dd #4' => [ + 0 => [ + 0 => 0, + 1 => 0, + 2 => 0, + ], + 1 => '2001-07-05', + ], + 'yyyy/mm/dd #1' => [ + 0 => [ + 0 => 0, + 1 => 0, + 2 => 0, + ], + 1 => '2001/07/05', + ], + + // date(-) + heures avec secondes + 'yyyy-mm-dd hh:mm:ss #1' => [ + 0 => [ + 0 => '00', + 1 => '00', + 2 => '00', + ], + 1 => '2001-01-01 00:00:00', + ], + 'yyyy-mm-dd hh:mm:ss #2' => [ + 0 => [ + 0 => '23', + 1 => '59', + 2 => '59', + ], + 1 => '2001-12-31 23:59:59', + ], + 'yyyy-mm-dd hh:mm:ss #3' => [ + 0 => [ + 0 => '12', + 1 => '33', + 2 => '44', + ], + 1 => '2001-00-00 12:33:44', + ], + 'yyyy-mm-dd hh:mm:ss #4' => [ + 0 => [ + 0 => '09', + 1 => '12', + 2 => '57', + ], + 1 => '2001-03-00 09:12:57', + ], + + // date(/) + heures avec secondes + 'yyyy/mm/dd hh:mm:ss #1' => [ + 0 => [ + 0 => '00', + 1 => '00', + 2 => '00', + ], + 1 => '2001/01/01 00:00:00', + ], + 'yyyy/mm/dd hh:mm:ss #2' => [ + 0 => [ + 0 => '23', + 1 => '59', + 2 => '59', + ], + 1 => '2001/12/31 23:59:59', + ], + 'yyyy/mm/dd hh:mm:ss #3' => [ + 0 => [ + 0 => '12', + 1 => '33', + 2 => '44', + ], + 1 => '2001/00/00 12:33:44', + ], + 'yyyy/mm/dd hh:mm:ss #4' => [ + 0 => [ + 0 => '09', + 1 => '12', + 2 => '57', + ], + 1 => '2001/03/00 09:12:57', + ], + + // date + heure sans seconde + 'yyyy-mm-dd hh:mm' => [ + 0 => [ + 0 => '09', + 1 => '12', + 2 => 0, + ], + 1 => '2001-03-01 09:12', + ], + 'yyyy/mm/dd hh:mm' => [ + 0 => [ + 0 => '09', + 1 => '59', + 2 => 0, + ], + 1 => '2001/03/01 09:59', + ], + + // seulement heures + 'hh:mm:ss' => [ + 0 => [ + 0 => '09', + 1 => '12', + 2 => '38', + ], + 1 => '09:12:38', + ], + 'hh:mm' => [ + 0 => [ + 0 => '09', + 1 => '59', + 2 => 0, + ], + 1 => '09:59', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/SaisonTest.php b/tests/tests/Filtre/Date/SaisonTest.php new file mode 100644 index 0000000000..1806e65906 --- /dev/null +++ b/tests/tests/Filtre/Date/SaisonTest.php @@ -0,0 +1,336 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction saison du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class SaisonTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + changer_langue('fr'); + // ce test est en fr + } + + /** + * @dataProvider providerFiltresSaison + */ + public function testFiltresSaison($expected, ...$args): void + { + $actual = saison(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresSaison(): array + { + return [ + 0 => [ + 0 => '', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => 'hiver', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => 'hiver', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '', + 1 => '0000-00-00', + ], + 4 => [ + 0 => 'hiver', + 1 => '0001-01-01', + ], + 5 => [ + 0 => 'hiver', + 1 => '1970-01-01', + ], + 6 => [ + 0 => 'été', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => 'hiver', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => 'hiver', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => 'hiver', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => 'hiver', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => 'hiver', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => 'printemps', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => 'printemps', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => 'printemps', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => 'été', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => 'été', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => 'été', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => 'automne', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => 'automne', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => 'automne', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => 'hiver', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => 'hiver', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => 'été', + 1 => '2001-07-05', + ], + 24 => [ + 0 => 'hiver', + 1 => '2001-01-01', + ], + 25 => [ + 0 => 'hiver', + 1 => '2001-12-31', + ], + 26 => [ + 0 => 'hiver', + 1 => '2001-03-01', + ], + 27 => [ + 0 => 'hiver', + 1 => '2004-02-29', + ], + 28 => [ + 0 => 'hiver', + 1 => '2012-03-20', + ], + 29 => [ + 0 => 'printemps', + 1 => '2012-03-21', + ], + 30 => [ + 0 => 'printemps', + 1 => '2012-03-22', + ], + 31 => [ + 0 => 'printemps', + 1 => '2012-06-20', + ], + 32 => [ + 0 => 'été', + 1 => '2012-06-21', + ], + 33 => [ + 0 => 'été', + 1 => '2012-06-22', + ], + 34 => [ + 0 => 'été', + 1 => '2012-09-20', + ], + 35 => [ + 0 => 'automne', + 1 => '2012-09-21', + ], + 36 => [ + 0 => 'automne', + 1 => '2012-09-22', + ], + 37 => [ + 0 => 'automne', + 1 => '2012-12-20', + ], + 38 => [ + 0 => 'hiver', + 1 => '2012-12-21', + ], + 39 => [ + 0 => 'hiver', + 1 => '2012-12-22', + ], + 40 => [ + 0 => 'été', + 1 => '2001/07/05', + ], + 41 => [ + 0 => 'hiver', + 1 => '2001/01/01', + ], + 42 => [ + 0 => 'automne', + 1 => '2001/12/31', + ], + 43 => [ + 0 => 'hiver', + 1 => '2001/03/01', + ], + 44 => [ + 0 => 'hiver', + 1 => '2004/02/29', + ], + 45 => [ + 0 => 'hiver', + 1 => '2012/03/20', + ], + 46 => [ + 0 => 'hiver', + 1 => '2012/03/21', + ], + 47 => [ + 0 => 'hiver', + 1 => '2012/03/22', + ], + 48 => [ + 0 => 'printemps', + 1 => '2012/06/20', + ], + 49 => [ + 0 => 'printemps', + 1 => '2012/06/21', + ], + 50 => [ + 0 => 'printemps', + 1 => '2012/06/22', + ], + 51 => [ + 0 => 'été', + 1 => '2012/09/20', + ], + 52 => [ + 0 => 'été', + 1 => '2012/09/21', + ], + 53 => [ + 0 => 'été', + 1 => '2012/09/22', + ], + 54 => [ + 0 => 'automne', + 1 => '2012/12/20', + ], + 55 => [ + 0 => 'automne', + 1 => '2012/12/21', + ], + 56 => [ + 0 => 'automne', + 1 => '2012/12/22', + ], + 57 => [ + 0 => 'été', + 1 => '05/07/2001', + ], + 58 => [ + 0 => 'hiver', + 1 => '01/01/2001', + ], + 59 => [ + 0 => 'hiver', + 1 => '31/12/2001', + ], + 60 => [ + 0 => 'hiver', + 1 => '01/03/2001', + ], + 61 => [ + 0 => 'hiver', + 1 => '29/02/2004', + ], + 62 => [ + 0 => 'hiver', + 1 => '20/03/2012', + ], + 63 => [ + 0 => 'printemps', + 1 => '21/03/2012', + ], + 64 => [ + 0 => 'printemps', + 1 => '22/03/2012', + ], + 65 => [ + 0 => 'printemps', + 1 => '20/06/2012', + ], + 66 => [ + 0 => 'été', + 1 => '21/06/2012', + ], + 67 => [ + 0 => 'été', + 1 => '22/06/2012', + ], + 68 => [ + 0 => 'été', + 1 => '20/09/2012', + ], + 69 => [ + 0 => 'automne', + 1 => '21/09/2012', + ], + 70 => [ + 0 => 'automne', + 1 => '22/09/2012', + ], + 71 => [ + 0 => 'automne', + 1 => '20/12/2012', + ], + 72 => [ + 0 => 'hiver', + 1 => '21/12/2012', + ], + 73 => [ + 0 => 'hiver', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Date/ViderDateTest.php b/tests/tests/Filtre/Date/ViderDateTest.php new file mode 100644 index 0000000000..2de0d6c943 --- /dev/null +++ b/tests/tests/Filtre/Date/ViderDateTest.php @@ -0,0 +1,330 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction vider_date du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Date; + +use PHPUnit\Framework\TestCase; + +class ViderDateTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresViderDate + */ + public function testFiltresViderDate($expected, ...$args): void + { + $actual = vider_date(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresViderDate(): array + { + return [ + 0 => [ + 0 => '2001-00-00 12:33:44', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => '2001-03-00 09:12:57', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => '2001-02-29 14:12:33', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '', + 1 => '0000-00-00', + ], + 4 => [ + 0 => '', + 1 => '0001-01-01', + ], + 5 => [ + 0 => '', + 1 => '1970-01-01', + ], + 6 => [ + 0 => '2001-07-05 18:25:24', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => '2001-01-01 00:00:00', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => '2001-12-31 23:59:59', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => '2001-03-01 14:12:33', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => '2004-02-29 14:12:33', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => '2012-03-20 12:00:00', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => '2012-03-21 12:00:00', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => '2012-03-22 12:00:00', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => '2012-06-20 12:00:00', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => '2012-06-21 12:00:00', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => '2012-06-22 12:00:00', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => '2012-09-20 12:00:00', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => '2012-09-21 12:00:00', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => '2012-09-22 12:00:00', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => '2012-12-20 12:00:00', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => '2012-12-21 12:00:00', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => '2012-12-22 12:00:00', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => '2001-07-05', + 1 => '2001-07-05', + ], + 24 => [ + 0 => '2001-01-01', + 1 => '2001-01-01', + ], + 25 => [ + 0 => '2001-12-31', + 1 => '2001-12-31', + ], + 26 => [ + 0 => '2001-03-01', + 1 => '2001-03-01', + ], + 27 => [ + 0 => '2004-02-29', + 1 => '2004-02-29', + ], + 28 => [ + 0 => '2012-03-20', + 1 => '2012-03-20', + ], + 29 => [ + 0 => '2012-03-21', + 1 => '2012-03-21', + ], + 30 => [ + 0 => '2012-03-22', + 1 => '2012-03-22', + ], + 31 => [ + 0 => '2012-06-20', + 1 => '2012-06-20', + ], + 32 => [ + 0 => '2012-06-21', + 1 => '2012-06-21', + ], + 33 => [ + 0 => '2012-06-22', + 1 => '2012-06-22', + ], + 34 => [ + 0 => '2012-09-20', + 1 => '2012-09-20', + ], + 35 => [ + 0 => '2012-09-21', + 1 => '2012-09-21', + ], + 36 => [ + 0 => '2012-09-22', + 1 => '2012-09-22', + ], + 37 => [ + 0 => '2012-12-20', + 1 => '2012-12-20', + ], + 38 => [ + 0 => '2012-12-21', + 1 => '2012-12-21', + ], + 39 => [ + 0 => '2012-12-22', + 1 => '2012-12-22', + ], + 40 => [ + 0 => '2001/07/05', + 1 => '2001/07/05', + ], + 41 => [ + 0 => '2001/01/01', + 1 => '2001/01/01', + ], + 42 => [ + 0 => '2001/12/31', + 1 => '2001/12/31', + ], + 43 => [ + 0 => '2001/03/01', + 1 => '2001/03/01', + ], + 44 => [ + 0 => '2004/02/29', + 1 => '2004/02/29', + ], + 45 => [ + 0 => '2012/03/20', + 1 => '2012/03/20', + ], + 46 => [ + 0 => '2012/03/21', + 1 => '2012/03/21', + ], + 47 => [ + 0 => '2012/03/22', + 1 => '2012/03/22', + ], + 48 => [ + 0 => '2012/06/20', + 1 => '2012/06/20', + ], + 49 => [ + 0 => '2012/06/21', + 1 => '2012/06/21', + ], + 50 => [ + 0 => '2012/06/22', + 1 => '2012/06/22', + ], + 51 => [ + 0 => '2012/09/20', + 1 => '2012/09/20', + ], + 52 => [ + 0 => '2012/09/21', + 1 => '2012/09/21', + ], + 53 => [ + 0 => '2012/09/22', + 1 => '2012/09/22', + ], + 54 => [ + 0 => '2012/12/20', + 1 => '2012/12/20', + ], + 55 => [ + 0 => '2012/12/21', + 1 => '2012/12/21', + ], + 56 => [ + 0 => '2012/12/22', + 1 => '2012/12/22', + ], + 57 => [ + 0 => '05/07/2001', + 1 => '05/07/2001', + ], + 58 => [ + 0 => '01/01/2001', + 1 => '01/01/2001', + ], + 59 => [ + 0 => '31/12/2001', + 1 => '31/12/2001', + ], + 60 => [ + 0 => '01/03/2001', + 1 => '01/03/2001', + ], + 61 => [ + 0 => '29/02/2004', + 1 => '29/02/2004', + ], + 62 => [ + 0 => '20/03/2012', + 1 => '20/03/2012', + ], + 63 => [ + 0 => '21/03/2012', + 1 => '21/03/2012', + ], + 64 => [ + 0 => '22/03/2012', + 1 => '22/03/2012', + ], + 65 => [ + 0 => '20/06/2012', + 1 => '20/06/2012', + ], + 66 => [ + 0 => '21/06/2012', + 1 => '21/06/2012', + ], + 67 => [ + 0 => '22/06/2012', + 1 => '22/06/2012', + ], + 68 => [ + 0 => '20/09/2012', + 1 => '20/09/2012', + ], + 69 => [ + 0 => '21/09/2012', + 1 => '21/09/2012', + ], + 70 => [ + 0 => '22/09/2012', + 1 => '22/09/2012', + ], + 71 => [ + 0 => '20/12/2012', + 1 => '20/12/2012', + ], + 72 => [ + 0 => '21/12/2012', + 1 => '21/12/2012', + ], + 73 => [ + 0 => '22/12/2012', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/DivTest.php b/tests/tests/Filtre/DivTest.php new file mode 100644 index 0000000000..a7c35754c2 --- /dev/null +++ b/tests/tests/Filtre/DivTest.php @@ -0,0 +1,1315 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction div du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class DivTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresDiv + */ + public function testFiltresDiv($expected, ...$args): void + { + $actual = div(...$args); + //$this->assertSame($expected, $actual); + $this->assertEquals($expected, $actual); + } + + public static function providerFiltresDiv(): array + { + return [ + 0 => [ + 0 => 0, + 1 => 0, + 2 => 0, + ], + 1 => [ + 0 => 0, + 1 => 0, + 2 => -1, + ], + 2 => [ + 0 => 0, + 1 => 0, + 2 => 1, + ], + 3 => [ + 0 => 0, + 1 => 0, + 2 => 2, + ], + 4 => [ + 0 => 0, + 1 => 0, + 2 => 3, + ], + 5 => [ + 0 => 0, + 1 => 0, + 2 => 4, + ], + 6 => [ + 0 => 0, + 1 => 0, + 2 => 5, + ], + 7 => [ + 0 => 0, + 1 => 0, + 2 => 6, + ], + 8 => [ + 0 => 0, + 1 => 0, + 2 => 7, + ], + 9 => [ + 0 => 0, + 1 => 0, + 2 => 10, + ], + 10 => [ + 0 => 0, + 1 => 0, + 2 => 20, + ], + 11 => [ + 0 => 0, + 1 => 0, + 2 => 30, + ], + 12 => [ + 0 => 0, + 1 => 0, + 2 => 50, + ], + 13 => [ + 0 => 0, + 1 => 0, + 2 => 100, + ], + 14 => [ + 0 => 0, + 1 => 0, + 2 => 1000, + ], + 15 => [ + 0 => 0, + 1 => 0, + 2 => 10000, + ], + 16 => [ + 0 => 0, + 1 => -1, + 2 => 0, + ], + 17 => [ + 0 => 1, + 1 => -1, + 2 => -1, + ], + 18 => [ + 0 => -1, + 1 => -1, + 2 => 1, + ], + 19 => [ + 0 => -0.5, + 1 => -1, + 2 => 2, + ], + 20 => [ + 0 => -1 / 3, + 1 => -1, + 2 => 3, + ], + 21 => [ + 0 => -0.25, + 1 => -1, + 2 => 4, + ], + 22 => [ + 0 => -0.2, + 1 => -1, + 2 => 5, + ], + 23 => [ + 0 => -1 / 6, + 1 => -1, + 2 => 6, + ], + 24 => [ + 0 => -1 / 7, + 1 => -1, + 2 => 7, + ], + 25 => [ + 0 => -0.1, + 1 => -1, + 2 => 10, + ], + 26 => [ + 0 => -0.05, + 1 => -1, + 2 => 20, + ], + 27 => [ + 0 => -1 / 30, + 1 => -1, + 2 => 30, + ], + 28 => [ + 0 => -0.02, + 1 => -1, + 2 => 50, + ], + 29 => [ + 0 => -0.01, + 1 => -1, + 2 => 100, + ], + 30 => [ + 0 => -0.001, + 1 => -1, + 2 => 1000, + ], + 31 => [ + 0 => -0.0001, + 1 => -1, + 2 => 10000, + ], + 32 => [ + 0 => 0, + 1 => 1, + 2 => 0, + ], + 33 => [ + 0 => -1, + 1 => 1, + 2 => -1, + ], + 34 => [ + 0 => 1, + 1 => 1, + 2 => 1, + ], + 35 => [ + 0 => 0.5, + 1 => 1, + 2 => 2, + ], + 36 => [ + 0 => 1 / 3, + 1 => 1, + 2 => 3, + ], + 37 => [ + 0 => 0.25, + 1 => 1, + 2 => 4, + ], + 38 => [ + 0 => 0.2, + 1 => 1, + 2 => 5, + ], + 39 => [ + 0 => 1 / 6, + 1 => 1, + 2 => 6, + ], + 40 => [ + 0 => 1 / 7, + 1 => 1, + 2 => 7, + ], + 41 => [ + 0 => 0.1, + 1 => 1, + 2 => 10, + ], + 42 => [ + 0 => 0.05, + 1 => 1, + 2 => 20, + ], + 43 => [ + 0 => 1 / 30, + 1 => 1, + 2 => 30, + ], + 44 => [ + 0 => 0.02, + 1 => 1, + 2 => 50, + ], + 45 => [ + 0 => 0.01, + 1 => 1, + 2 => 100, + ], + 46 => [ + 0 => 0.001, + 1 => 1, + 2 => 1000, + ], + 47 => [ + 0 => 0.0001, + 1 => 1, + 2 => 10000, + ], + 48 => [ + 0 => 0, + 1 => 2, + 2 => 0, + ], + 49 => [ + 0 => -2, + 1 => 2, + 2 => -1, + ], + 50 => [ + 0 => 2, + 1 => 2, + 2 => 1, + ], + 51 => [ + 0 => 1, + 1 => 2, + 2 => 2, + ], + 52 => [ + 0 => 2 / 3, + 1 => 2, + 2 => 3, + ], + 53 => [ + 0 => 0.5, + 1 => 2, + 2 => 4, + ], + 54 => [ + 0 => 0.4, + 1 => 2, + 2 => 5, + ], + 55 => [ + 0 => 2 / 6, + 1 => 2, + 2 => 6, + ], + 56 => [ + 0 => 2 / 7, + 1 => 2, + 2 => 7, + ], + 57 => [ + 0 => 0.2, + 1 => 2, + 2 => 10, + ], + 58 => [ + 0 => 0.1, + 1 => 2, + 2 => 20, + ], + 59 => [ + 0 => 2 / 30, + 1 => 2, + 2 => 30, + ], + 60 => [ + 0 => 0.04, + 1 => 2, + 2 => 50, + ], + 61 => [ + 0 => 0.02, + 1 => 2, + 2 => 100, + ], + 62 => [ + 0 => 0.002, + 1 => 2, + 2 => 1000, + ], + 63 => [ + 0 => 0.0002, + 1 => 2, + 2 => 10000, + ], + 64 => [ + 0 => 0, + 1 => 3, + 2 => 0, + ], + 65 => [ + 0 => -3, + 1 => 3, + 2 => -1, + ], + 66 => [ + 0 => 3, + 1 => 3, + 2 => 1, + ], + 67 => [ + 0 => 1.5, + 1 => 3, + 2 => 2, + ], + 68 => [ + 0 => 1, + 1 => 3, + 2 => 3, + ], + 69 => [ + 0 => 0.75, + 1 => 3, + 2 => 4, + ], + 70 => [ + 0 => 0.6, + 1 => 3, + 2 => 5, + ], + 71 => [ + 0 => 0.5, + 1 => 3, + 2 => 6, + ], + 72 => [ + 0 => 3 / 7, + 1 => 3, + 2 => 7, + ], + 73 => [ + 0 => 0.3, + 1 => 3, + 2 => 10, + ], + 74 => [ + 0 => 0.15, + 1 => 3, + 2 => 20, + ], + 75 => [ + 0 => 0.1, + 1 => 3, + 2 => 30, + ], + 76 => [ + 0 => 0.06, + 1 => 3, + 2 => 50, + ], + 77 => [ + 0 => 0.03, + 1 => 3, + 2 => 100, + ], + 78 => [ + 0 => 0.003, + 1 => 3, + 2 => 1000, + ], + 79 => [ + 0 => 0.0003, + 1 => 3, + 2 => 10000, + ], + 80 => [ + 0 => 0, + 1 => 4, + 2 => 0, + ], + 81 => [ + 0 => -4, + 1 => 4, + 2 => -1, + ], + 82 => [ + 0 => 4, + 1 => 4, + 2 => 1, + ], + 83 => [ + 0 => 2, + 1 => 4, + 2 => 2, + ], + 84 => [ + 0 => 4 / 3, + 1 => 4, + 2 => 3, + ], + 85 => [ + 0 => 1, + 1 => 4, + 2 => 4, + ], + 86 => [ + 0 => 0.8, + 1 => 4, + 2 => 5, + ], + 87 => [ + 0 => 4 / 6, + 1 => 4, + 2 => 6, + ], + 88 => [ + 0 => 4 / 7, + 1 => 4, + 2 => 7, + ], + 89 => [ + 0 => 0.4, + 1 => 4, + 2 => 10, + ], + 90 => [ + 0 => 0.2, + 1 => 4, + 2 => 20, + ], + 91 => [ + 0 => 4 / 30, + 1 => 4, + 2 => 30, + ], + 92 => [ + 0 => 0.08, + 1 => 4, + 2 => 50, + ], + 93 => [ + 0 => 0.04, + 1 => 4, + 2 => 100, + ], + 94 => [ + 0 => 0.004, + 1 => 4, + 2 => 1000, + ], + 95 => [ + 0 => 0.0004, + 1 => 4, + 2 => 10000, + ], + 96 => [ + 0 => 0, + 1 => 5, + 2 => 0, + ], + 97 => [ + 0 => -5, + 1 => 5, + 2 => -1, + ], + 98 => [ + 0 => 5, + 1 => 5, + 2 => 1, + ], + 99 => [ + 0 => 2.5, + 1 => 5, + 2 => 2, + ], + 100 => [ + 0 => 5 / 3, + 1 => 5, + 2 => 3, + ], + 101 => [ + 0 => 1.25, + 1 => 5, + 2 => 4, + ], + 102 => [ + 0 => 1, + 1 => 5, + 2 => 5, + ], + 103 => [ + 0 => 5 / 6, + 1 => 5, + 2 => 6, + ], + 104 => [ + 0 => 5 / 7, + 1 => 5, + 2 => 7, + ], + 105 => [ + 0 => 0.5, + 1 => 5, + 2 => 10, + ], + 106 => [ + 0 => 0.25, + 1 => 5, + 2 => 20, + ], + 107 => [ + 0 => 5 / 30, + 1 => 5, + 2 => 30, + ], + 108 => [ + 0 => 0.1, + 1 => 5, + 2 => 50, + ], + 109 => [ + 0 => 0.05, + 1 => 5, + 2 => 100, + ], + 110 => [ + 0 => 0.005, + 1 => 5, + 2 => 1000, + ], + 111 => [ + 0 => 0.0005, + 1 => 5, + 2 => 10000, + ], + 112 => [ + 0 => 0, + 1 => 6, + 2 => 0, + ], + 113 => [ + 0 => -6, + 1 => 6, + 2 => -1, + ], + 114 => [ + 0 => 6, + 1 => 6, + 2 => 1, + ], + 115 => [ + 0 => 3, + 1 => 6, + 2 => 2, + ], + 116 => [ + 0 => 2, + 1 => 6, + 2 => 3, + ], + 117 => [ + 0 => 1.5, + 1 => 6, + 2 => 4, + ], + 118 => [ + 0 => 1.2, + 1 => 6, + 2 => 5, + ], + 119 => [ + 0 => 1, + 1 => 6, + 2 => 6, + ], + 120 => [ + 0 => 6 / 7, + 1 => 6, + 2 => 7, + ], + 121 => [ + 0 => 0.6, + 1 => 6, + 2 => 10, + ], + 122 => [ + 0 => 0.3, + 1 => 6, + 2 => 20, + ], + 123 => [ + 0 => 0.2, + 1 => 6, + 2 => 30, + ], + 124 => [ + 0 => 0.12, + 1 => 6, + 2 => 50, + ], + 125 => [ + 0 => 0.06, + 1 => 6, + 2 => 100, + ], + 126 => [ + 0 => 0.006, + 1 => 6, + 2 => 1000, + ], + 127 => [ + 0 => 6 / 10000, + 1 => 6, + 2 => 10000, + ], + 128 => [ + 0 => 0, + 1 => 7, + 2 => 0, + ], + 129 => [ + 0 => -7, + 1 => 7, + 2 => -1, + ], + 130 => [ + 0 => 7, + 1 => 7, + 2 => 1, + ], + 131 => [ + 0 => 3.5, + 1 => 7, + 2 => 2, + ], + 132 => [ + 0 => 7 / 3, + 1 => 7, + 2 => 3, + ], + 133 => [ + 0 => 1.75, + 1 => 7, + 2 => 4, + ], + 134 => [ + 0 => 1.4, + 1 => 7, + 2 => 5, + ], + 135 => [ + 0 => 7 / 6, + 1 => 7, + 2 => 6, + ], + 136 => [ + 0 => 1, + 1 => 7, + 2 => 7, + ], + 137 => [ + 0 => 0.7, + 1 => 7, + 2 => 10, + ], + 138 => [ + 0 => 0.35, + 1 => 7, + 2 => 20, + ], + 139 => [ + 0 => 7 / 30, + 1 => 7, + 2 => 30, + ], + 140 => [ + 0 => 0.14, + 1 => 7, + 2 => 50, + ], + 141 => [ + 0 => 7 / 100, + 1 => 7, + 2 => 100, + ], + 142 => [ + 0 => 0.007, + 1 => 7, + 2 => 1000, + ], + 143 => [ + 0 => 0.0007, + 1 => 7, + 2 => 10000, + ], + 144 => [ + 0 => 0, + 1 => 10, + 2 => 0, + ], + 145 => [ + 0 => -10, + 1 => 10, + 2 => -1, + ], + 146 => [ + 0 => 10, + 1 => 10, + 2 => 1, + ], + 147 => [ + 0 => 5, + 1 => 10, + 2 => 2, + ], + 148 => [ + 0 => 10 / 3, + 1 => 10, + 2 => 3, + ], + 149 => [ + 0 => 2.5, + 1 => 10, + 2 => 4, + ], + 150 => [ + 0 => 2, + 1 => 10, + 2 => 5, + ], + 151 => [ + 0 => 10 / 6, + 1 => 10, + 2 => 6, + ], + 152 => [ + 0 => 10 / 7, + 1 => 10, + 2 => 7, + ], + 153 => [ + 0 => 1, + 1 => 10, + 2 => 10, + ], + 154 => [ + 0 => 0.5, + 1 => 10, + 2 => 20, + ], + 155 => [ + 0 => 10 / 30, + 1 => 10, + 2 => 30, + ], + 156 => [ + 0 => 0.2, + 1 => 10, + 2 => 50, + ], + 157 => [ + 0 => 0.1, + 1 => 10, + 2 => 100, + ], + 158 => [ + 0 => 0.01, + 1 => 10, + 2 => 1000, + ], + 159 => [ + 0 => 0.001, + 1 => 10, + 2 => 10000, + ], + 160 => [ + 0 => 0, + 1 => 20, + 2 => 0, + ], + 161 => [ + 0 => -20, + 1 => 20, + 2 => -1, + ], + 162 => [ + 0 => 20, + 1 => 20, + 2 => 1, + ], + 163 => [ + 0 => 10, + 1 => 20, + 2 => 2, + ], + 164 => [ + 0 => 20 / 3, + 1 => 20, + 2 => 3, + ], + 165 => [ + 0 => 5, + 1 => 20, + 2 => 4, + ], + 166 => [ + 0 => 4, + 1 => 20, + 2 => 5, + ], + 167 => [ + 0 => 20 / 6, + 1 => 20, + 2 => 6, + ], + 168 => [ + 0 => 20 / 7, + 1 => 20, + 2 => 7, + ], + 169 => [ + 0 => 2, + 1 => 20, + 2 => 10, + ], + 170 => [ + 0 => 1, + 1 => 20, + 2 => 20, + ], + 171 => [ + 0 => 20 / 30, + 1 => 20, + 2 => 30, + ], + 172 => [ + 0 => 0.4, + 1 => 20, + 2 => 50, + ], + 173 => [ + 0 => 0.2, + 1 => 20, + 2 => 100, + ], + 174 => [ + 0 => 0.02, + 1 => 20, + 2 => 1000, + ], + 175 => [ + 0 => 0.002, + 1 => 20, + 2 => 10000, + ], + 176 => [ + 0 => 0, + 1 => 30, + 2 => 0, + ], + 177 => [ + 0 => -30, + 1 => 30, + 2 => -1, + ], + 178 => [ + 0 => 30, + 1 => 30, + 2 => 1, + ], + 179 => [ + 0 => 15, + 1 => 30, + 2 => 2, + ], + 180 => [ + 0 => 10, + 1 => 30, + 2 => 3, + ], + 181 => [ + 0 => 7.5, + 1 => 30, + 2 => 4, + ], + 182 => [ + 0 => 6, + 1 => 30, + 2 => 5, + ], + 183 => [ + 0 => 5, + 1 => 30, + 2 => 6, + ], + 184 => [ + 0 => 30 / 7, + 1 => 30, + 2 => 7, + ], + 185 => [ + 0 => 3, + 1 => 30, + 2 => 10, + ], + 186 => [ + 0 => 1.5, + 1 => 30, + 2 => 20, + ], + 187 => [ + 0 => 1, + 1 => 30, + 2 => 30, + ], + 188 => [ + 0 => 0.6, + 1 => 30, + 2 => 50, + ], + 189 => [ + 0 => 0.3, + 1 => 30, + 2 => 100, + ], + 190 => [ + 0 => 0.03, + 1 => 30, + 2 => 1000, + ], + 191 => [ + 0 => 0.003, + 1 => 30, + 2 => 10000, + ], + 192 => [ + 0 => 0, + 1 => 50, + 2 => 0, + ], + 193 => [ + 0 => -50, + 1 => 50, + 2 => -1, + ], + 194 => [ + 0 => 50, + 1 => 50, + 2 => 1, + ], + 195 => [ + 0 => 25, + 1 => 50, + 2 => 2, + ], + 196 => [ + 0 => 50 / 3, + 1 => 50, + 2 => 3, + ], + 197 => [ + 0 => 12.5, + 1 => 50, + 2 => 4, + ], + 198 => [ + 0 => 10, + 1 => 50, + 2 => 5, + ], + 199 => [ + 0 => 50 / 6, + 1 => 50, + 2 => 6, + ], + 200 => [ + 0 => 50 / 7, + 1 => 50, + 2 => 7, + ], + 201 => [ + 0 => 5, + 1 => 50, + 2 => 10, + ], + 202 => [ + 0 => 2.5, + 1 => 50, + 2 => 20, + ], + 203 => [ + 0 => 50 / 30, + 1 => 50, + 2 => 30, + ], + 204 => [ + 0 => 1, + 1 => 50, + 2 => 50, + ], + 205 => [ + 0 => 0.5, + 1 => 50, + 2 => 100, + ], + 206 => [ + 0 => 0.05, + 1 => 50, + 2 => 1000, + ], + 207 => [ + 0 => 0.005, + 1 => 50, + 2 => 10000, + ], + 208 => [ + 0 => 0, + 1 => 100, + 2 => 0, + ], + 209 => [ + 0 => -100, + 1 => 100, + 2 => -1, + ], + 210 => [ + 0 => 100, + 1 => 100, + 2 => 1, + ], + 211 => [ + 0 => 50, + 1 => 100, + 2 => 2, + ], + 212 => [ + 0 => 100 / 3, + 1 => 100, + 2 => 3, + ], + 213 => [ + 0 => 25, + 1 => 100, + 2 => 4, + ], + 214 => [ + 0 => 20, + 1 => 100, + 2 => 5, + ], + 215 => [ + 0 => 100 / 6, + 1 => 100, + 2 => 6, + ], + 216 => [ + 0 => 100 / 7, + 1 => 100, + 2 => 7, + ], + 217 => [ + 0 => 10, + 1 => 100, + 2 => 10, + ], + 218 => [ + 0 => 5, + 1 => 100, + 2 => 20, + ], + 219 => [ + 0 => 100 / 30, + 1 => 100, + 2 => 30, + ], + 220 => [ + 0 => 2, + 1 => 100, + 2 => 50, + ], + 221 => [ + 0 => 1, + 1 => 100, + 2 => 100, + ], + 222 => [ + 0 => 0.1, + 1 => 100, + 2 => 1000, + ], + 223 => [ + 0 => 0.01, + 1 => 100, + 2 => 10000, + ], + 224 => [ + 0 => 0, + 1 => 1000, + 2 => 0, + ], + 225 => [ + 0 => -1000, + 1 => 1000, + 2 => -1, + ], + 226 => [ + 0 => 1000, + 1 => 1000, + 2 => 1, + ], + 227 => [ + 0 => 500, + 1 => 1000, + 2 => 2, + ], + 228 => [ + 0 => 1000 / 3, + 1 => 1000, + 2 => 3, + ], + 229 => [ + 0 => 250, + 1 => 1000, + 2 => 4, + ], + 230 => [ + 0 => 200, + 1 => 1000, + 2 => 5, + ], + 231 => [ + 0 => 1000 / 6, + 1 => 1000, + 2 => 6, + ], + 232 => [ + 0 => 1000 / 7, + 1 => 1000, + 2 => 7, + ], + 233 => [ + 0 => 100, + 1 => 1000, + 2 => 10, + ], + 234 => [ + 0 => 50, + 1 => 1000, + 2 => 20, + ], + 235 => [ + 0 => 1000 / 30, + 1 => 1000, + 2 => 30, + ], + 236 => [ + 0 => 20, + 1 => 1000, + 2 => 50, + ], + 237 => [ + 0 => 10, + 1 => 1000, + 2 => 100, + ], + 238 => [ + 0 => 1, + 1 => 1000, + 2 => 1000, + ], + 239 => [ + 0 => 0.1, + 1 => 1000, + 2 => 10000, + ], + 240 => [ + 0 => 0, + 1 => 10000, + 2 => 0, + ], + 241 => [ + 0 => -10000, + 1 => 10000, + 2 => -1, + ], + 242 => [ + 0 => 10000, + 1 => 10000, + 2 => 1, + ], + 243 => [ + 0 => 5000, + 1 => 10000, + 2 => 2, + ], + 244 => [ + 0 => 10000 / 3, + 1 => 10000, + 2 => 3, + ], + 245 => [ + 0 => 2500, + 1 => 10000, + 2 => 4, + ], + 246 => [ + 0 => 2000, + 1 => 10000, + 2 => 5, + ], + 247 => [ + 0 => 10000 / 6, + 1 => 10000, + 2 => 6, + ], + 248 => [ + 0 => 10000 / 7, + 1 => 10000, + 2 => 7, + ], + 249 => [ + 0 => 1000, + 1 => 10000, + 2 => 10, + ], + 250 => [ + 0 => 500, + 1 => 10000, + 2 => 20, + ], + 251 => [ + 0 => 10000 / 30, + 1 => 10000, + 2 => 30, + ], + 252 => [ + 0 => 200, + 1 => 10000, + 2 => 50, + ], + 253 => [ + 0 => 100, + 1 => 10000, + 2 => 100, + ], + 254 => [ + 0 => 10, + 1 => 10000, + 2 => 1000, + ], + 255 => [ + 0 => 1, + 1 => 10000, + 2 => 10000, + ], + ]; + } +} diff --git a/tests/tests/Filtre/EchapperTagsTest.php b/tests/tests/Filtre/EchapperTagsTest.php new file mode 100644 index 0000000000..8fbe2e5cad --- /dev/null +++ b/tests/tests/Filtre/EchapperTagsTest.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction echapper_tags du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class EchapperTagsTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresEchapperTags + */ + public function testFiltresEchapperTags($expected, ...$args): void + { + $actual = echapper_tags(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresEchapperTags(): array + { + return [ + 0 => [ + 0 => '', + 1 => '', + ], + 1 => [ + 0 => '0', + 1 => '0', + ], + 2 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 3 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + ], + 4 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + ], + 5 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 6 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + ]; + } +} diff --git a/tests/tests/Filtre/ExtraireBalisesTest.php b/tests/tests/Filtre/ExtraireBalisesTest.php new file mode 100644 index 0000000000..49fb344efd --- /dev/null +++ b/tests/tests/Filtre/ExtraireBalisesTest.php @@ -0,0 +1,260 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction extraire_multi du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class ExtraireBalisesTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + find_in_path('./inc/lang.php', '', true); + } + + /** + * @dataProvider providerFiltresExtraireBalises + */ + public function testFiltresExtraireBalises($expected, ...$args): void + { + $actual = extraire_balises(...$args); + $this->assertSame($expected, $actual); + } + + /** + * @dataProvider providerFiltresExtraireBalises + */ + public function testFiltresExtraireBalise($expected, ...$args): void + { + // extraire_balise doit renvoyer le premier résultat de extraire_balises + // sauf si on fournit un tableau de chaine en entree, ce doit être alors le premier résultat de chaque sous-tableau + if (count($args) === 3) { + $options = array_pop($args); + $profondeur = ($options['profondeur'] ?? 1); + $args[] = $profondeur; + } + $first_result = reset($expected); + if (is_array($first_result)) { + $first_result = []; + foreach ($expected as $e) { + $first_result[] = (empty($e) ? '' : reset($e)); + } + $expected = $first_result; + } else { + $expected = (empty($expected) ? '' : $first_result); + } + $actual = extraire_balise(...$args); + $this->assertSame($expected, $actual); + } + + public function testFiltresExtraireBalisesMediaRss(): void + { + + $rss = file_get_contents(dirname(__DIR__) . '/Fixtures/data/dailymotion.rss'); + if (empty($rss)) { + $this->markTestSkipped(); + } + + $balises_media = extraire_balises($rss, 'media:content'); + $this->assertIsArray($balises_media); + $this->assertEquals(count($balises_media), 40); + } + + public static function providerFiltresExtraireBalises(): array + { + + return [ + [ + ['<a href="truc">chose</a>'], + 'allo <a href="truc">chose</a>' + ], + [ + ['<a href="truc" />'], + 'allo <a href="truc" />' + ], + [ + ["<a\nhref='truc' />"], + 'allo' . "\n" . " <a\nhref='truc' />" + ], + [ + [['<a href="1">'], ['<a href="2">']], + ['allo <a href="1">', 'allo <a href="2">'] + ], + [ + ['<a href="truc">chose</a>'], + 'bonjour <a href="truc">chose</a> machin' + ], + [ + ['<a href="truc">chose</a>', '<A href="truc">machin</a>'], + 'bonjour <a href="truc">chose</a> machin <A href="truc">machin</a>', + ], + [ + ['<a href="truc">'], + 'bonjour <a href="truc">chose' + ], + [ + ['<a href="truc"/>'], + '<a href="truc"/>chose</a>' + ], + [ + ['<a>chose</a>'], + '<a>chose</a>' + ], + [ + ['<a href="truc">chose</a>'], + 'allo <a href="truc">chose</a>', + 'a' + ], + [ + ['<a href="truc" />'], + 'allo <a href="truc" />', + 'a' + ], + [ + ["<a\nhref='truc' />"], + 'allo' . "\n" . " <a\nhref='truc' />", + 'a' + ], + [ + [['<a href="1">'], ['<a href="2">']], + ['allo <a href="1">', 'allo <a href="2">'], + 'a' + ], + [ + ['<a href="truc">chose</a>'], + 'bonjour <a href="truc">chose</a> machin', + 'a' + ], + [ + ['<a href="truc">chose</a>', '<A href="truc">machin</a>'], + 'bonjour <a href="truc">chose</a> machin <A href="truc">machin</a>', + 'a' + ], + [ + ['<a href="truc">'], + 'bonjour <a href="truc">chose', + 'a' + ], + [ + ['<a href="truc"/>'], + '<a href="truc"/>chose</a>', + 'a' + ], + [ + ['<a>chose</a>'], + '<a>chose</a>', + 'a' + ], + [ + [], + 'allo <a href="truc">chose</a>', + 'b' + ], + [ + [], + 'allo <a href="truc" />', + 'b' + ], + [ + [], + 'allo' . "\n" . " <a\nhref='truc' />", + 'b' + ], + [ + [[], []], + ['allo <a href="1">', 'allo <a href="2">'], + 'b' + ], + [ + [], + 'bonjour <a href="truc">chose</a> machin', + 'b' + ], + [ + [], + 'bonjour <a href="truc">chose</a> machin <A href="truc">machin</a>', + 'b' + ], + [ + [], + 'bonjour <a href="truc">chose', + 'b' + ], + [ + [], + '<a href="truc"/>chose</a>', + 'b' + ], + [ + [], + '<a>chose</a>', + 'b' + ], + 'div_2' => [ + ['<div class="message">Hello <div class="inside">World!</div></div>'], + '<div class="message">Hello <div class="inside">World!</div></div>', + 'div' + ], + 'div_3' => [ + ['<div class="message">Hello <div class="inside">World<div>!</div></div></div>'], + '<div class="message">Hello <div class="inside">World<div>!</div></div></div>', + 'div' + ], + 'div_3_et_autofermante_1' =>[ + ['<div class="message">Hello <div class="inside">World<div>! <div/> </div></div></div>'], + '<div class="message">Hello <div class="inside">World<div>! <div/> </div></div></div>', + 'div' + ], + 'div_3_et_autofermante_2' =>[ + ['<div class="message">Hello <div class="inside">World<div>!<div/></div><div/></div></div>'], + '<div class="message">Hello <div class="inside">World<div>!<div/></div><div/></div></div>', + 'div' + ], + 'div_3_et_autofermante_3' =>[ + ['<div class="message">Hello <div class="inside">World<div>!<div/></div><div/></div><div/></div>'], + '<div class="message">Hello <div class="inside">World<div>!<div/></div><div/></div><div/></div>', + 'div' + ], + 'div_3_et_autofermante_4' =>[ + ['<div class="message">Hello <div class="inside">World<div>!<div/></div><div/></div><div/></div>', '<div/>'], + '<div class="message">Hello <div class="inside">World<div>!<div/></div><div/></div><div/></div><div/>', + 'div' + ], + 'div_3_et_autofermante_5' =>[ + ['<div/>', '<div class="message">Hello <div class="inside">World<div>!<div/></div><div/></div><div/></div>', '<div/>'], + '<div/><div class="message">Hello <div class="inside">World<div>!<div/></div><div/></div><div/></div><div/>', + 'div' + ], + 'div_3_et_autofermante_5_nbmax' =>[ + ['<div/>'], + '<div/><div class="message">Hello <div class="inside">World<div>!<div/></div><div/></div><div/></div><div/>', + 'div', + ['nb_max' => 1] + ], + 'div_3_et_autofermante_5_profondeur_2' =>[ + ['<div class="hello">Hello</div>', '<div class="world">World</div>', '<div>!</div>', '<div/>'], + '<div class="message"><div class="hello">Hello</div> <div class="world">World</div><div>!</div> <div/></div>', + 'div', + ['profondeur' => '2'], + ], + 'div_3_et_autofermante_5_profondeur_3' =>[ + [], + '<div class="message"><div class="hello">Hello</div> <div class="world">World</div><div>!</div> <div/></div>', + 'div', + ['profondeur' => '3'], + ], + 'div_3_et_autofermante_5_profondeur_3_2' =>[ + ['<div>lo</div>'], + '<div class="message"><div class="hello">Hel<div>lo</div></div> <div class="world">World</div><div>!</div> <div/></div>', + 'div', + ['profondeur' => '3'], + ], + ]; + } +} diff --git a/tests/tests/Filtre/ExtraireMultiTest.php b/tests/tests/Filtre/ExtraireMultiTest.php new file mode 100644 index 0000000000..7bbac2ff1b --- /dev/null +++ b/tests/tests/Filtre/ExtraireMultiTest.php @@ -0,0 +1,90 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction extraire_multi du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class ExtraireMultiTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + find_in_path('./inc/lang.php', '', true); + } + + /** + * @dataProvider providerFiltresExtraireMulti + */ + public function testFiltresExtraireMulti($expected, ...$args): void + { + $actual = extraire_multi(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresExtraireMulti(): array + { + return [ + 0 => [ + 0 => 'english', + 1 => '<multi>[fr]francais[en]english[de]deutsch</multi>', + 2 => 'en', + ], + 1 => [ + 0 => 'deutsch', + 1 => '<multi>[fr]francais[en]english[de]deutsch</multi>', + 2 => 'de', + ], + 2 => [ + 0 => 'francais', + 1 => '<multi>[fr]francais[en]english[de]deutsch</multi>', + 2 => 'fr', + ], + 3 => [ + 0 => "<span lang='fr'>francais</span>", + 1 => '<multi>[fr]francais[en]english[de]deutsch</multi>', + 2 => 'it', + ], + 4 => [ + 0 => "<span lang='fr' dir='ltr'>francais</span>", + 1 => '<multi>[fr]francais[en]english[de]deutsch</multi>', + 2 => 'ar', + ], + 5 => [ + 0 => 'english', + 1 => '<multi>[fr]francais[en]english[de]deutsch</multi>', + 2 => 'en', + 3 => true, + ], + 6 => [ + 0 => 'deutsch', + 1 => '<multi>[fr]francais[en]english[de]deutsch</multi>', + 2 => 'de', + 3 => true, + ], + 7 => [ + 0 => 'francais', + 1 => '<multi>[fr]francais[en]english[de]deutsch</multi>', + 2 => 'fr', + 3 => true, + ], + 8 => [ + 0 => '<span class="base64multi" title="ZnJhbmNhaXM=" lang="fr"></span>', + 1 => '<multi>[fr]francais[en]english[de]deutsch</multi>', + 2 => 'it', + 3 => true, + ], + 9 => [ + 0 => '<span class="base64multi" title="ZnJhbmNhaXM=" lang="fr" dir="ltr"></span>', + 1 => '<multi>[fr]francais[en]english[de]deutsch</multi>', + 2 => 'ar', + 3 => true, + ], + ]; + } +} diff --git a/tests/tests/Filtre/FiltreBaliseImgDistTest.php b/tests/tests/Filtre/FiltreBaliseImgDistTest.php new file mode 100644 index 0000000000..33586b9db4 --- /dev/null +++ b/tests/tests/Filtre/FiltreBaliseImgDistTest.php @@ -0,0 +1,238 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction filtre_balise_img_dist du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class FiltreBaliseImgDistTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresFiltreBaliseImgDist + */ + public function testFiltresFiltreBaliseImgDist($expected, ...$args): void + { + static $f = null; + // chercher la fonction si elle n'existe pas + if ($f === null && ! function_exists($f = 'filtre_balise_img_dist')) { + find_in_path('inc/filtres.php', '', true); + $f = chercher_filtre($f); + } + $res = $f(...$args); + $actual = preg_replace('#\\?\\d+#', '', $res); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresFiltreBaliseImgDist(): array + { + return [[ + + + 0 => "<img src='https://www.spip.net/IMG/logo/siteon0.png' alt='' width='300' height='223' />", + 1 => 'https://www.spip.net/IMG/logo/siteon0.png', + ], + [ + 0 => "<img src='prive/images/logo-spip.png' alt='' width='231' height='172' />", + 1 => 'prive/images/logo-spip.png', + ], + [ + 0 => '', + 1 => 'prive/aide_body.css', + ], + [ + 0 => "<img src='prive/images/searching.gif' alt='' width='16' height='16' />", + 1 => 'prive/images/searching.gif', + ], + [ + 0 => "<img src='prive/images/searching.gif' alt='attendez' class='loading' width='16' height='16' />", + 1 => 'prive/images/searching.gif', + 2 => 'attendez', + 3 => 'loading', + ], + [ + 0 => "<img src='spip.png' alt='' width='60' height='40' />", + 1 => 'spip.png', + ], + 1 => [ + 0 => "<img src='spip.png' alt='This is SPIP' width='60' height='40' />", + 1 => 'spip.png', + 2 => 'This is SPIP', + ], + 2 => [ + 0 => "<img src='spip.png' alt='This is SPIP' class='spip_logo' width='60' height='40' />", + 1 => 'spip.png', + 2 => 'This is SPIP', + 3 => 'spip_logo', + ], + [ + 0 => "<img src='spip.png' alt='This is SPIP' class='spip_logo' width='30' height='20' />", + 1 => 'spip.png', + 2 => 'This is SPIP', + 3 => 'spip_logo', + 4 => '@2x', + ], + [ + 0 => "<img src='spip.png' alt='This is SPIP' class='spip_logo' width='20' height='20' />", + 1 => 'spip.png', + 2 => 'This is SPIP', + 3 => 'spip_logo', + 4 => '20', + ], + [ + 0 => "<img src='spip.png' alt='This is SPIP' class='spip_logo' width='90' height='60' />", + 1 => 'spip.png', + 2 => 'This is SPIP', + 3 => 'spip_logo', + 4 => '90x*', + ], + [ + 0 => "<img src='spip.png' alt='This is SPIP' class='spip_logo' width='50' height='30' />", + 1 => 'spip.png', + 2 => 'This is SPIP', + 3 => 'spip_logo', + 4 => '50x30', + ], + [ + 0 => "<img src='spip.png' alt='This is SPIP' width='30' height='20' />", + 1 => 'spip.png', + 2 => 'This is SPIP', + 3 => '@2x', + ], + [ + 0 => "<img src='spip.png' alt='This is SPIP' width='20' height='20' />", + 1 => 'spip.png', + 2 => 'This is SPIP', + 3 => '20', + ], + [ + 0 => "<img src='spip.png' alt='This is SPIP' width='90' height='60' />", + 1 => 'spip.png', + 2 => 'This is SPIP', + 3 => '90x*', + ], + [ + 0 => "<img src='spip.png' alt='This is SPIP' width='50' height='30' />", + 1 => 'spip.png', + 2 => 'This is SPIP', + 3 => '50x30', + ], + [ + 0 => "<img src='spip.png' width='30' height='20' />", + 1 => 'spip.png', + 2 => '@2x', + ], + [ + 0 => "<img src='spip.png' width='20' height='20' />", + 1 => 'spip.png', + 2 => '20', + ], + [ + 0 => "<img src='spip.png' width='90' height='60' />", + 1 => 'spip.png', + 2 => '90x*', + ], + [ + 0 => "<img src='spip.png' width='50' height='30' />", + 1 => 'spip.png', + 2 => '50x30', + ], + [ + 0 => "<img src='spip.svg' alt='' width='60' height='40' />", + 1 => 'spip.svg', + ], + [ + 0 => "<img src='spip.svg' alt='This is SPIP' width='60' height='40' />", + 1 => 'spip.svg', + 2 => 'This is SPIP', + ], + [ + 0 => "<img src='spip.svg' alt='This is SPIP' class='spip_logo' width='60' height='40' />", + 1 => 'spip.svg', + 2 => 'This is SPIP', + 3 => 'spip_logo', + ], + [ + 0 => "<img src='spip.svg' alt='This is SPIP' class='spip_logo' width='30' height='20' />", + 1 => 'spip.svg', + 2 => 'This is SPIP', + 3 => 'spip_logo', + 4 => '@2x', + ], + [ + 0 => "<img src='spip.svg' alt='This is SPIP' class='spip_logo' width='20' height='20' />", + 1 => 'spip.svg', + 2 => 'This is SPIP', + 3 => 'spip_logo', + 4 => '20', + ], + 25 => [ + 0 => "<img src='spip.svg' alt='This is SPIP' class='spip_logo' width='90' height='60' />", + 1 => 'spip.svg', + 2 => 'This is SPIP', + 3 => 'spip_logo', + 4 => '90x*', + ], + 26 => [ + 0 => "<img src='spip.svg' alt='This is SPIP' class='spip_logo' width='50' height='30' />", + 1 => 'spip.svg', + 2 => 'This is SPIP', + 3 => 'spip_logo', + 4 => '50x30', + ], + [ + 0 => "<img src='spip.svg' alt='This is SPIP' width='30' height='20' />", + 1 => 'spip.svg', + 2 => 'This is SPIP', + 3 => '@2x', + ], + [ + 0 => "<img src='spip.svg' alt='This is SPIP' width='20' height='20' />", + 1 => 'spip.svg', + 2 => 'This is SPIP', + 3 => '20', + ], + [ + 0 => "<img src='spip.svg' alt='This is SPIP' width='90' height='60' />", + 1 => 'spip.svg', + 2 => 'This is SPIP', + 3 => '90x*', + ], + [ + 0 => "<img src='spip.svg' alt='This is SPIP' width='50' height='30' />", + 1 => 'spip.svg', + 2 => 'This is SPIP', + 3 => '50x30', + ], + [ + 0 => "<img src='spip.svg' width='30' height='20' />", + 1 => 'spip.svg', + 2 => '@2x', + ], + [ + 0 => "<img src='spip.svg' width='20' height='20' />", + 1 => 'spip.svg', + 2 => '20', + ], + [ + 0 => "<img src='spip.svg' width='90' height='60' />", + 1 => 'spip.svg', + 2 => '90x*', + ], + [ + 0 => "<img src='spip.svg' width='50' height='30' />", + 1 => 'spip.svg', + 2 => '50x30', + ], + ]; + } +} diff --git a/tests/tests/Filtre/FiltrerEntitesTest.php b/tests/tests/Filtre/FiltrerEntitesTest.php new file mode 100644 index 0000000000..37edab198d --- /dev/null +++ b/tests/tests/Filtre/FiltrerEntitesTest.php @@ -0,0 +1,66 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction filtrer_entites du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class FiltrerEntitesTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresFiltrerEntites + */ + public function testFiltresFiltrerEntites($expected, ...$args): void + { + $actual = filtrer_entites(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresFiltrerEntites(): array + { + return [ + 0 => [ + 0 => '', + 1 => '', + ], + 1 => [ + 0 => '0', + 1 => '0', + ], + 2 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 3 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + ], + 4 => [ + 0 => 'Un texte avec des entités numériques &<>"\'', + 1 => 'Un texte avec des entités numériques &<>"'', + ], + 5 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + ], + 6 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 7 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Form/FormHiddenArboTest.php b/tests/tests/Filtre/Form/FormHiddenArboTest.php new file mode 100644 index 0000000000..03568b804b --- /dev/null +++ b/tests/tests/Filtre/Form/FormHiddenArboTest.php @@ -0,0 +1,18 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction affdate_court du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Form; + +use PHPUnit\Framework\TestCase; + +class FormHiddenArboTest extends FormHiddenCase +{ + public const TYPE = 'arbo'; + + +} diff --git a/tests/tests/Filtre/Form/FormHiddenCase.php b/tests/tests/Filtre/Form/FormHiddenCase.php new file mode 100644 index 0000000000..076113ba6a --- /dev/null +++ b/tests/tests/Filtre/Form/FormHiddenCase.php @@ -0,0 +1,128 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction affdate_court du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Form; + +use PHPUnit\Framework\TestCase; + +class FormHiddenCase extends TestCase +{ + public const TYPE = ''; + + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + self::backupUrls(); + if (!static::TYPE) { + throw new \RuntimeException("Subclass needs to define TYPE"); + } + $GLOBALS['type_urls'] = static::TYPE; + $GLOBALS['profondeur_url'] = 0; + } + + public static function setTearDownAfterClass(): void + { + self::backupUrls(true); + } + + public static function backupUrls(bool $restore = false): void + { + static $type = null; + static $profondeur_url = 0; + if ($restore) { + $GLOBALS['type_urls'] = $type; + $GLOBALS['profondeur_url'] = $profondeur_url; + } else { + $type = $GLOBALS['type_urls'] ?? null; + $profondeur_url = $GLOBALS['profondeur_url'] ?? 0; + } + } + + protected static function getIdRubrique(): ?int { + include_spip('base/abstract_sql'); + $id_rubrique = sql_getfetsel( + 'id_rubrique', + 'spip_rubriques', + ['statut = ' . sql_quote('publie')] + ); + return $id_rubrique ? (int) $id_rubrique : null; + } + + public function testHasRubrique(): void + { + $id = $this->getIdRubrique(); + if (!$id) { + $this->markTestSkipped("Needs a published rubrique"); + } + $this->assertNotNull($this->getIdRubrique()); + } + + /** + * @depends testHasRubrique + * @dataProvider providerFormHiddenRubrique + */ + public function testFormHiddenRubrique($expected, ...$args): void + { + $actual = form_hidden(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFormHiddenRubrique(): array + { + $id = self::getIdRubrique(); + return [ + 0 => + [ + 0 => '<input name="id_rubrique" value="' . $id . '" type="hidden" +/><input name="page" value="rubrique" type="hidden" +/>', + 1 => './?rubrique' . $id, + ], + 1 => + [ + 0 => '<input name="calendrier" value="1" type="hidden" +/><input name="id_rubrique" value="' . $id . '" type="hidden" +/><input name="page" value="rubrique" type="hidden" +/>', + 1 => './?rubrique' . $id . '&calendrier=1', + ], + 2 => + [ + 0 => '<input name="id_rubrique" value="' . $id . '" type="hidden" +/><input name="page" value="rubrique" type="hidden" +/>', + 1 => './rubrique' . $id . '.html', + ], + 3 => + [ + 0 => '<input name="calendrier" value="1" type="hidden" +/><input name="id_rubrique" value="' . $id . '" type="hidden" +/><input name="page" value="rubrique" type="hidden" +/>', + 1 => './rubrique' . $id . '.html?calendrier=1', + ], + 4 => + [ + 0 => '<input name="calendrier" value="1" type="hidden" +/><input name="id_rubrique" value="' . $id . '" type="hidden" +/><input name="page" value="rubrique" type="hidden" +/>', + 1 => './?rubrique' . $id . '&calendrier=1', + ], + 5 => + [ + 0 => '<input name="calendrier" value="1" type="hidden" +/><input name="toto" value="2" type="hidden" +/><input name="id_rubrique" value="' . $id . '" type="hidden" +/><input name="page" value="rubrique" type="hidden" +/>', + 1 => './rubrique' . $id . '.html?calendrier=1&toto=2', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Form/FormHiddenHtmlTest.php b/tests/tests/Filtre/Form/FormHiddenHtmlTest.php new file mode 100644 index 0000000000..9bc8c79240 --- /dev/null +++ b/tests/tests/Filtre/Form/FormHiddenHtmlTest.php @@ -0,0 +1,16 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction affdate_court du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Form; + +use PHPUnit\Framework\TestCase; + +class FormHiddenHtmlTest extends FormHiddenCase +{ + public const TYPE = 'html'; +} diff --git a/tests/tests/Filtre/Form/FormHiddenLibresTest.php b/tests/tests/Filtre/Form/FormHiddenLibresTest.php new file mode 100644 index 0000000000..842bde6030 --- /dev/null +++ b/tests/tests/Filtre/Form/FormHiddenLibresTest.php @@ -0,0 +1,16 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction affdate_court du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Form; + +use PHPUnit\Framework\TestCase; + +class FormHiddenLibresTest extends FormHiddenCase +{ + public const TYPE = 'libres'; +} diff --git a/tests/tests/Filtre/Form/FormHiddenPageTest.php b/tests/tests/Filtre/Form/FormHiddenPageTest.php new file mode 100644 index 0000000000..1f3cf00494 --- /dev/null +++ b/tests/tests/Filtre/Form/FormHiddenPageTest.php @@ -0,0 +1,16 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction affdate_court du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Form; + +use PHPUnit\Framework\TestCase; + +class FormHiddenPageTest extends FormHiddenCase +{ + public const TYPE = 'page'; +} diff --git a/tests/tests/Filtre/Form/FormHiddenPropresQsTest.php b/tests/tests/Filtre/Form/FormHiddenPropresQsTest.php new file mode 100644 index 0000000000..556e9ecdbc --- /dev/null +++ b/tests/tests/Filtre/Form/FormHiddenPropresQsTest.php @@ -0,0 +1,16 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction affdate_court du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Form; + +use PHPUnit\Framework\TestCase; + +class FormHiddenPropresQsTest extends FormHiddenCase +{ + public const TYPE = 'propres_qs'; +} diff --git a/tests/tests/Filtre/Form/FormHiddenPropresTest.php b/tests/tests/Filtre/Form/FormHiddenPropresTest.php new file mode 100644 index 0000000000..d724dc662a --- /dev/null +++ b/tests/tests/Filtre/Form/FormHiddenPropresTest.php @@ -0,0 +1,16 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction affdate_court du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Form; + +use PHPUnit\Framework\TestCase; + +class FormHiddenPropresTest extends FormHiddenCase +{ + public const TYPE = 'propres'; +} diff --git a/tests/tests/Filtre/Form/FormHiddenStandardTest.php b/tests/tests/Filtre/Form/FormHiddenStandardTest.php new file mode 100644 index 0000000000..10391e9b08 --- /dev/null +++ b/tests/tests/Filtre/Form/FormHiddenStandardTest.php @@ -0,0 +1,16 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction affdate_court du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre\Form; + +use PHPUnit\Framework\TestCase; + +class FormHiddenStandardTest extends FormHiddenCase +{ + public const TYPE = 'standard'; +} diff --git a/tests/tests/Filtre/HauteurTest.php b/tests/tests/Filtre/HauteurTest.php new file mode 100644 index 0000000000..fe21fb0f56 --- /dev/null +++ b/tests/tests/Filtre/HauteurTest.php @@ -0,0 +1,50 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction hauteur du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class HauteurTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresHauteur + */ + public function testFiltresHauteur($expected, ...$args): void + { + $actual = hauteur(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresHauteur(): array + { + return [ + 0 => [ + 0 => 223, + 1 => 'https://www.spip.net/IMG/logo/siteon0.png', + ], + 2 => [ + 0 => 172, + 1 => 'prive/images/logo-spip.png', + ], + 3 => [ + 0 => 0, + 1 => 'prive/aide_body.css', + ], + 4 => [ + 0 => 16, + 1 => 'prive/images/searching.gif', + ], + ]; + } +} diff --git a/tests/tests/Filtre/IdentifiantSlugTest.php b/tests/tests/Filtre/IdentifiantSlugTest.php new file mode 100644 index 0000000000..6c639ff347 --- /dev/null +++ b/tests/tests/Filtre/IdentifiantSlugTest.php @@ -0,0 +1,699 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction identifiant_slug du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class IdentifiantSlugTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresIdentifiantSlug + */ + public function testFiltresIdentifiantSlug($expected, ...$args): void + { + $actual = identifiant_slug(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresIdentifiantSlug(): array + { + return [ + 0 => [ + 0 => '1', + 1 => true, + ], + 1 => [ + 0 => '', + 1 => false, + ], + 2 => [ + 0 => '0', + 1 => 0, + ], + 3 => [ + 0 => '1', + 1 => -1, + ], + 4 => [ + 0 => '1', + 1 => 1, + ], + 5 => [ + 0 => '2', + 1 => 2, + ], + 6 => [ + 0 => '3', + 1 => 3, + ], + 7 => [ + 0 => '4', + 1 => 4, + ], + 8 => [ + 0 => '5', + 1 => 5, + ], + 9 => [ + 0 => '6', + 1 => 6, + ], + 10 => [ + 0 => '7', + 1 => 7, + ], + 11 => [ + 0 => '10', + 1 => 10, + ], + 12 => [ + 0 => '20', + 1 => 20, + ], + 13 => [ + 0 => '30', + 1 => 30, + ], + 14 => [ + 0 => '50', + 1 => 50, + ], + 15 => [ + 0 => '100', + 1 => 100, + ], + 16 => [ + 0 => '1000', + 1 => 1000, + ], + 17 => [ + 0 => '10000', + 1 => 10000, + ], + 18 => [ + 0 => '0', + 1 => 0.0, + ], + 19 => [ + 0 => '0_25', + 1 => 0.25, + ], + 20 => [ + 0 => '0_5', + 1 => 0.5, + ], + 21 => [ + 0 => '0_75', + 1 => 0.75, + ], + 22 => [ + 0 => '1', + 1 => 1.0, + ], + 23 => [ + 0 => '', + 1 => '', + ], + 24 => [ + 0 => '0', + 1 => '0', + ], + 25 => [ + 0 => 'un_texte_avec_des_liens_article_1_art1_spip_https_www_spip_n', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + ], + 26 => [ + 0 => 'un_texte_avec_des_entites', + 1 => 'Un texte avec des entités &<>"', + ], + 27 => [ + 0 => 'un_texte_avec_des_entit_eacute_s_echap_eacute_amp', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + ], + 28 => [ + 0 => 'un_texte_avec_des_entites_numeriques_38_60_62', + 1 => 'Un texte avec des entités numériques &<>"', + ], + 29 => [ + 0 => 'un_texte_avec_des_entites_numeriques_echapees_38_60_62', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + ], + 30 => [ + 0 => 'un_texte_sans_entites', + 1 => 'Un texte sans entites &<>"\'', + ], + 31 => [ + 0 => 'des_raccourcis_italique_gras_du_code', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 32 => [ + 0 => 'un_modele_https_www_spip_net', + 1 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + ], + 33 => [ + 0 => 'un_texte_avec_des_retour_a_la_ligne_et_meme_des_paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + 34 => [ + 0 => 'un_texte_avec_des_liens_avec_des_accents_iso_a_e_i_o_u_artic', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->https://www.spip.net] https://www.spip.net", + ], + 35 => [ + 0 => 'un_texte_avec_des_entites_et_avec_des_accents_iso_a_e_i_o_u', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 36 => [ + 0 => 'un_texte_avec_des_entit_eacute_s_echap_eacute_amp_et_avec_de', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 37 => [ + 0 => 'un_texte_avec_des_entites_numeriques_38_60_62_et_avec_des_ac', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 38 => [ + 0 => 'un_texte_avec_des_entites_numeriques_echapees_38_60_62_et_av', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 39 => [ + 0 => 'un_texte_sans_entites_et_avec_des_accents_iso_a_e_i_o_u', + 1 => "Un texte sans entites &<>\"' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 40 => [ + 0 => 'des_raccourcis_avec_des_accents_iso_a_e_i_o_u_italique_avec_', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + ], + 41 => [ + 0 => 'un_modele_avec_des_accents_iso_a_e_i_o_u_https_www_spip_net', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->https://www.spip.net]>", + ], + 42 => [ + 0 => 'un_texte_avec_des_retour_a_la_ligne_et_meme_des_paragraphes_', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC', + ], + 43 => [ + 0 => 'un_texte_avec_des_liens_avec_des_accents_utf_8_aaaa_eeeee_ii', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->https://www.spip.net] https://www.spip.net', + ], + 44 => [ + 0 => 'un_texte_avec_des_entites_et_avec_des_accents_utf_8_aaaa_eee', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 45 => [ + 0 => 'un_texte_avec_des_entit_eacute_s_echap_eacute_amp_et_avec_de', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 46 => [ + 0 => 'un_texte_avec_des_entites_numeriques_38_60_62_et_avec_des_ac', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 47 => [ + 0 => 'un_texte_avec_des_entites_numeriques_echapees_38_60_62_et_av', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 48 => [ + 0 => 'un_texte_sans_entites_et_avec_des_accents_utf_8_aaaa_eeeee_i', + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 49 => [ + 0 => 'des_raccourcis_avec_des_accents_utf_8_aaaa_eeeee_iii_oo_uuu_', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + ], + 50 => [ + 0 => 'un_modele_avec_des_accents_utf_8_aaaa_eeeee_iii_oo_uuu_https', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->https://www.spip.net]>', + ], + 51 => [ + 0 => 'un_texte_avec_des_retour_a_la_ligne_et_meme_des_paragraphes_', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 52 => [ + 0 => 'c0', + 1 => 0, + 2 => 'class', + ], + 53 => [ + 0 => 'c1', + 1 => -1, + 2 => 'class', + ], + 54 => [ + 0 => 'c1', + 1 => 1, + 2 => 'class', + ], + 55 => [ + 0 => 'c2', + 1 => 2, + 2 => 'class', + ], + 56 => [ + 0 => 'c3', + 1 => 3, + 2 => 'class', + ], + 57 => [ + 0 => 'c4', + 1 => 4, + 2 => 'class', + ], + 58 => [ + 0 => 'c5', + 1 => 5, + 2 => 'class', + ], + 59 => [ + 0 => 'c6', + 1 => 6, + 2 => 'class', + ], + 60 => [ + 0 => 'c7', + 1 => 7, + 2 => 'class', + ], + 61 => [ + 0 => 'c10', + 1 => 10, + 2 => 'class', + ], + 62 => [ + 0 => 'c20', + 1 => 20, + 2 => 'class', + ], + 63 => [ + 0 => 'c30', + 1 => 30, + 2 => 'class', + ], + 64 => [ + 0 => 'c50', + 1 => 50, + 2 => 'class', + ], + 65 => [ + 0 => 'c100', + 1 => 100, + 2 => 'class', + ], + 66 => [ + 0 => 'c1000', + 1 => 1000, + 2 => 'class', + ], + 67 => [ + 0 => 'c10000', + 1 => 10000, + 2 => 'class', + ], + 68 => [ + 0 => 'i0', + 1 => 0, + 2 => 'id', + ], + 69 => [ + 0 => 'i1', + 1 => -1, + 2 => 'id', + ], + 70 => [ + 0 => 'i1', + 1 => 1, + 2 => 'id', + ], + 71 => [ + 0 => 'i2', + 1 => 2, + 2 => 'id', + ], + 72 => [ + 0 => 'i3', + 1 => 3, + 2 => 'id', + ], + 73 => [ + 0 => 'i4', + 1 => 4, + 2 => 'id', + ], + 74 => [ + 0 => 'i5', + 1 => 5, + 2 => 'id', + ], + 75 => [ + 0 => 'i6', + 1 => 6, + 2 => 'id', + ], + 76 => [ + 0 => 'i7', + 1 => 7, + 2 => 'id', + ], + 77 => [ + 0 => 'i10', + 1 => 10, + 2 => 'id', + ], + 78 => [ + 0 => 'i20', + 1 => 20, + 2 => 'id', + ], + 79 => [ + 0 => 'i30', + 1 => 30, + 2 => 'id', + ], + 80 => [ + 0 => 'i50', + 1 => 50, + 2 => 'id', + ], + 81 => [ + 0 => 'i100', + 1 => 100, + 2 => 'id', + ], + 82 => [ + 0 => 'i1000', + 1 => 1000, + 2 => 'id', + ], + 83 => [ + 0 => 'i10000', + 1 => 10000, + 2 => 'id', + ], + 84 => [ + 0 => 'a0', + 1 => 0, + 2 => 'anchor', + ], + 85 => [ + 0 => 'a1', + 1 => -1, + 2 => 'anchor', + ], + 86 => [ + 0 => 'a1', + 1 => 1, + 2 => 'anchor', + ], + 87 => [ + 0 => 'a2', + 1 => 2, + 2 => 'anchor', + ], + 88 => [ + 0 => 'a3', + 1 => 3, + 2 => 'anchor', + ], + 89 => [ + 0 => 'a4', + 1 => 4, + 2 => 'anchor', + ], + 90 => [ + 0 => 'a5', + 1 => 5, + 2 => 'anchor', + ], + 91 => [ + 0 => 'a6', + 1 => 6, + 2 => 'anchor', + ], + 92 => [ + 0 => 'a7', + 1 => 7, + 2 => 'anchor', + ], + 93 => [ + 0 => 'a10', + 1 => 10, + 2 => 'anchor', + ], + 94 => [ + 0 => 'a20', + 1 => 20, + 2 => 'anchor', + ], + 95 => [ + 0 => 'a30', + 1 => 30, + 2 => 'anchor', + ], + 96 => [ + 0 => 'a50', + 1 => 50, + 2 => 'anchor', + ], + 97 => [ + 0 => 'a100', + 1 => 100, + 2 => 'anchor', + ], + 98 => [ + 0 => 'a1000', + 1 => 1000, + 2 => 'anchor', + ], + 99 => [ + 0 => 'a10000', + 1 => 10000, + 2 => 'anchor', + ], + 100 => [ + 0 => '0', + 1 => 0, + 2 => 'name', + ], + 101 => [ + 0 => '1', + 1 => -1, + 2 => 'name', + ], + 102 => [ + 0 => '1', + 1 => 1, + 2 => 'name', + ], + 103 => [ + 0 => '2', + 1 => 2, + 2 => 'name', + ], + 104 => [ + 0 => '3', + 1 => 3, + 2 => 'name', + ], + 105 => [ + 0 => '4', + 1 => 4, + 2 => 'name', + ], + 106 => [ + 0 => '5', + 1 => 5, + 2 => 'name', + ], + 107 => [ + 0 => '6', + 1 => 6, + 2 => 'name', + ], + 108 => [ + 0 => '7', + 1 => 7, + 2 => 'name', + ], + 109 => [ + 0 => '10', + 1 => 10, + 2 => 'name', + ], + 110 => [ + 0 => '20', + 1 => 20, + 2 => 'name', + ], + 111 => [ + 0 => '30', + 1 => 30, + 2 => 'name', + ], + 112 => [ + 0 => '50', + 1 => 50, + 2 => 'name', + ], + 113 => [ + 0 => '100', + 1 => 100, + 2 => 'name', + ], + 114 => [ + 0 => '1000', + 1 => 1000, + 2 => 'name', + ], + 115 => [ + 0 => '10000', + 1 => 10000, + 2 => 'name', + ], + 116 => [ + 0 => 's0_cfcd208', + 1 => 0, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 117 => [ + 0 => 's1_6bb61e3', + 1 => -1, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 118 => [ + 0 => 's1_c4ca423', + 1 => 1, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 119 => [ + 0 => 's2_c81e728', + 1 => 2, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 120 => [ + 0 => 's3_eccbc87', + 1 => 3, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 121 => [ + 0 => 's4_a87ff67', + 1 => 4, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 122 => [ + 0 => 's5_e4da3b7', + 1 => 5, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 123 => [ + 0 => 's6_1679091', + 1 => 6, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 124 => [ + 0 => 's7_8f14e45', + 1 => 7, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 125 => [ + 0 => 's10_d3d944', + 1 => 10, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 126 => [ + 0 => 's20_98f137', + 1 => 20, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 127 => [ + 0 => 's30_34173c', + 1 => 30, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 128 => [ + 0 => 's50_c0c7c7', + 1 => 50, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 129 => [ + 0 => 's100_f8991', + 1 => 100, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 130 => [ + 0 => 's1000_a9b7', + 1 => 1000, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + 131 => [ + 0 => 's10000_b7a', + 1 => 10000, + 2 => '', + 3 => [ + 'longueur_mini' => 10, + ], + ], + ]; + } +} diff --git a/tests/tests/Filtre/InsererAttributTest.php b/tests/tests/Filtre/InsererAttributTest.php new file mode 100644 index 0000000000..9c24da6176 --- /dev/null +++ b/tests/tests/Filtre/InsererAttributTest.php @@ -0,0 +1,1144 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction inserer_attribut du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class InsererAttributTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresInsererAttribut + */ + public function testFiltresInsererAttribut($expected, ...$args): void + { + $actual = inserer_attribut(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresInsererAttribut(): array + { + return [ + 0 => [ + 0 => "<a href='https://www.spip.net'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => '', + 4 => true, + 5 => true, + ], + 1 => [ + 0 => "<a href='https://www.spip.net' title=''>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => '', + 4 => true, + 5 => false, + ], + 2 => [ + 0 => "<a href='https://www.spip.net'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => '', + 4 => false, + 5 => true, + ], + 3 => [ + 0 => "<a href='https://www.spip.net' title=''>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => '', + 4 => false, + 5 => false, + ], + 4 => [ + 0 => "<a href='https://www.spip.net' title='0'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => '0', + 4 => true, + 5 => true, + ], + 5 => [ + 0 => "<a href='https://www.spip.net' title='0'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => '0', + 4 => true, + 5 => false, + ], + 6 => [ + 0 => "<a href='https://www.spip.net' title='0'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => '0', + 4 => false, + 5 => true, + ], + 7 => [ + 0 => "<a href='https://www.spip.net' title='0'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => '0', + 4 => false, + 5 => false, + ], + 8 => [ + 0 => "<a href='https://www.spip.net' title='Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => true, + 5 => true, + ], + 9 => [ + 0 => "<a href='https://www.spip.net' title='Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => true, + 5 => false, + ], + 10 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net\'>SPIP</a>', + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => false, + 5 => true, + ], + 11 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net\'>SPIP</a>', + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => false, + 5 => false, + ], + 12 => [ + 0 => "<a href='https://www.spip.net' title='Un texte avec des entités &<>"'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des entités &<>"', + 4 => true, + 5 => true, + ], + 13 => [ + 0 => "<a href='https://www.spip.net' title='Un texte avec des entités &<>"'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des entités &<>"', + 4 => true, + 5 => false, + ], + 14 => [ + 0 => "<a href='https://www.spip.net' title='Un texte avec des entités &<>"'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des entités &<>"', + 4 => false, + 5 => true, + ], + 15 => [ + 0 => "<a href='https://www.spip.net' title='Un texte avec des entités &<>"'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des entités &<>"', + 4 => false, + 5 => false, + ], + 16 => [ + 0 => "<a href='https://www.spip.net' title='Un texte sans entites &<>"''>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte sans entites &<>"\'', + 4 => true, + 5 => true, + ], + 17 => [ + 0 => "<a href='https://www.spip.net' title='Un texte sans entites &<>"''>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte sans entites &<>"\'', + 4 => true, + 5 => false, + ], + 18 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte sans entites &<>"'\'>SPIP</a>', + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte sans entites &<>"\'', + 4 => false, + 5 => true, + ], + 19 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte sans entites &<>"'\'>SPIP</a>', + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte sans entites &<>"\'', + 4 => false, + 5 => false, + ], + 20 => [ + 0 => "<a href='https://www.spip.net' title='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => true, + 5 => true, + ], + 21 => [ + 0 => "<a href='https://www.spip.net' title='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => true, + 5 => false, + ], + 22 => [ + 0 => "<a href='https://www.spip.net' title='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => false, + 5 => true, + ], + 23 => [ + 0 => "<a href='https://www.spip.net' title='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => false, + 5 => false, + ], + 24 => [ + 0 => "<a href='https://www.spip.net' title='Un modele <modeleinexistant|lien=[->https://www.spip.net]>'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => true, + 5 => true, + ], + 25 => [ + 0 => "<a href='https://www.spip.net' title='Un modele <modeleinexistant|lien=[->https://www.spip.net]>'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => true, + 5 => false, + ], + 26 => [ + 0 => "<a href='https://www.spip.net' title='Un modele <modeleinexistant|lien=[->https://www.spip.net]>'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => false, + 5 => true, + ], + 27 => [ + 0 => "<a href='https://www.spip.net' title='Un modele <modeleinexistant|lien=[->https://www.spip.net]>'>SPIP</a>", + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => false, + 5 => false, + ], + 28 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte avec des retour +a la ligne et meme des paragraphes\'>SPIP</a>', + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => true, + 5 => true, + ], + 29 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte avec des retour +a la ligne et meme des paragraphes\'>SPIP</a>', + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => true, + 5 => false, + ], + 30 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte avec des retour +a la ligne et meme des + +paragraphes\'>SPIP</a>', + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => false, + 5 => true, + ], + 31 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte avec des retour +a la ligne et meme des + +paragraphes\'>SPIP</a>', + 1 => "<a href='https://www.spip.net'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => false, + 5 => false, + ], + 32 => [ + 0 => "<a href='https://www.spip.net'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => '', + 4 => true, + 5 => true, + ], + 33 => [ + 0 => "<a href='https://www.spip.net' title=''>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => '', + 4 => true, + 5 => false, + ], + 34 => [ + 0 => "<a href='https://www.spip.net'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => '', + 4 => false, + 5 => true, + ], + 35 => [ + 0 => "<a href='https://www.spip.net' title=''>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => '', + 4 => false, + 5 => false, + ], + 36 => [ + 0 => "<a href='https://www.spip.net' title='0'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => '0', + 4 => true, + 5 => true, + ], + 37 => [ + 0 => "<a href='https://www.spip.net' title='0'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => '0', + 4 => true, + 5 => false, + ], + 38 => [ + 0 => "<a href='https://www.spip.net' title='0'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => '0', + 4 => false, + 5 => true, + ], + 39 => [ + 0 => "<a href='https://www.spip.net' title='0'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => '0', + 4 => false, + 5 => false, + ], + 40 => [ + 0 => "<a href='https://www.spip.net' title='Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => true, + 5 => true, + ], + 41 => [ + 0 => "<a href='https://www.spip.net' title='Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => true, + 5 => false, + ], + 42 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net\'>SPIP</a>', + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => false, + 5 => true, + ], + 43 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net\'>SPIP</a>', + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => false, + 5 => false, + ], + 44 => [ + 0 => "<a href='https://www.spip.net' title='Un texte avec des entités &<>"'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des entités &<>"', + 4 => true, + 5 => true, + ], + 45 => [ + 0 => "<a href='https://www.spip.net' title='Un texte avec des entités &<>"'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des entités &<>"', + 4 => true, + 5 => false, + ], + 46 => [ + 0 => "<a href='https://www.spip.net' title='Un texte avec des entités &<>"'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des entités &<>"', + 4 => false, + 5 => true, + ], + 47 => [ + 0 => "<a href='https://www.spip.net' title='Un texte avec des entités &<>"'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des entités &<>"', + 4 => false, + 5 => false, + ], + 48 => [ + 0 => "<a href='https://www.spip.net' title='Un texte sans entites &<>"''>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte sans entites &<>"\'', + 4 => true, + 5 => true, + ], + 49 => [ + 0 => "<a href='https://www.spip.net' title='Un texte sans entites &<>"''>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte sans entites &<>"\'', + 4 => true, + 5 => false, + ], + 50 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte sans entites &<>"'\'>SPIP</a>', + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte sans entites &<>"\'', + 4 => false, + 5 => true, + ], + 51 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte sans entites &<>"'\'>SPIP</a>', + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte sans entites &<>"\'', + 4 => false, + 5 => false, + ], + 52 => [ + 0 => "<a href='https://www.spip.net' title='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => true, + 5 => true, + ], + 53 => [ + 0 => "<a href='https://www.spip.net' title='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => true, + 5 => false, + ], + 54 => [ + 0 => "<a href='https://www.spip.net' title='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => false, + 5 => true, + ], + 55 => [ + 0 => "<a href='https://www.spip.net' title='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => false, + 5 => false, + ], + 56 => [ + 0 => "<a href='https://www.spip.net' title='Un modele <modeleinexistant|lien=[->https://www.spip.net]>'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => true, + 5 => true, + ], + 57 => [ + 0 => "<a href='https://www.spip.net' title='Un modele <modeleinexistant|lien=[->https://www.spip.net]>'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => true, + 5 => false, + ], + 58 => [ + 0 => "<a href='https://www.spip.net' title='Un modele <modeleinexistant|lien=[->https://www.spip.net]>'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => false, + 5 => true, + ], + 59 => [ + 0 => "<a href='https://www.spip.net' title='Un modele <modeleinexistant|lien=[->https://www.spip.net]>'>SPIP</a>", + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => false, + 5 => false, + ], + 60 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte avec des retour +a la ligne et meme des paragraphes\'>SPIP</a>', + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => true, + 5 => true, + ], + 61 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte avec des retour +a la ligne et meme des paragraphes\'>SPIP</a>', + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => true, + 5 => false, + ], + 62 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte avec des retour +a la ligne et meme des + +paragraphes\'>SPIP</a>', + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => false, + 5 => true, + ], + 63 => [ + 0 => '<a href=\'https://www.spip.net\' title=\'Un texte avec des retour +a la ligne et meme des + +paragraphes\'>SPIP</a>', + 1 => "<a href='https://www.spip.net' title='Simplement'>SPIP</a>", + 2 => 'title', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => false, + 5 => false, + ], + 64 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => '', + 4 => true, + 5 => true, + ], + 65 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => '', + 4 => true, + 5 => false, + ], + 66 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => '', + 4 => false, + 5 => true, + ], + 67 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => '', + 4 => false, + 5 => false, + ], + 68 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='0' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => '0', + 4 => true, + 5 => true, + ], + 69 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='0' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => '0', + 4 => true, + 5 => false, + ], + 70 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='0' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => '0', + 4 => false, + 5 => true, + ], + 71 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='0' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => '0', + 4 => false, + 5 => false, + ], + 72 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => true, + 5 => true, + ], + 73 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => true, + 5 => false, + ], + 74 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => false, + 5 => true, + ], + 75 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => false, + 5 => false, + ], + 76 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte avec des entités &<>"' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des entités &<>"', + 4 => true, + 5 => true, + ], + 77 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte avec des entités &<>"' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des entités &<>"', + 4 => true, + 5 => false, + ], + 78 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte avec des entités &<>"' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des entités &<>"', + 4 => false, + 5 => true, + ], + 79 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte avec des entités &<>"' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des entités &<>"', + 4 => false, + 5 => false, + ], + 80 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte sans entites &<>"'' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte sans entites &<>"\'', + 4 => true, + 5 => true, + ], + 81 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte sans entites &<>"'' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte sans entites &<>"\'', + 4 => true, + 5 => false, + ], + 82 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte sans entites &<>"'\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte sans entites &<>"\'', + 4 => false, + 5 => true, + ], + 83 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte sans entites &<>"'\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte sans entites &<>"\'', + 4 => false, + 5 => false, + ], + 84 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => true, + 5 => true, + ], + 85 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => true, + 5 => false, + ], + 86 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => false, + 5 => true, + ], + 87 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => false, + 5 => false, + ], + 88 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un modele <modeleinexistant|lien=[->https://www.spip.net]>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => true, + 5 => true, + ], + 89 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un modele <modeleinexistant|lien=[->https://www.spip.net]>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => true, + 5 => false, + ], + 90 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un modele <modeleinexistant|lien=[->https://www.spip.net]>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => false, + 5 => true, + ], + 91 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un modele <modeleinexistant|lien=[->https://www.spip.net]>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => false, + 5 => false, + ], + 92 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte avec des retour +a la ligne et meme des paragraphes\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => true, + 5 => true, + ], + 93 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte avec des retour +a la ligne et meme des paragraphes\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => true, + 5 => false, + ], + 94 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte avec des retour +a la ligne et meme des + +paragraphes\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => false, + 5 => true, + ], + 95 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte avec des retour +a la ligne et meme des + +paragraphes\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => false, + 5 => false, + ], + 96 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => '', + 4 => true, + 5 => true, + ], + 97 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => '', + 4 => true, + 5 => false, + ], + 98 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => '', + 4 => false, + 5 => true, + ], + 99 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => '', + 4 => false, + 5 => false, + ], + 100 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='0' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => '0', + 4 => true, + 5 => true, + ], + 101 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='0' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => '0', + 4 => true, + 5 => false, + ], + 102 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='0' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => '0', + 4 => false, + 5 => true, + ], + 103 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='0' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => '0', + 4 => false, + 5 => false, + ], + 104 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => true, + 5 => true, + ], + 105 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => true, + 5 => false, + ], + 106 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => false, + 5 => true, + ], + 107 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 4 => false, + 5 => false, + ], + 108 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte avec des entités &<>"' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des entités &<>"', + 4 => true, + 5 => true, + ], + 109 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte avec des entités &<>"' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des entités &<>"', + 4 => true, + 5 => false, + ], + 110 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte avec des entités &<>"' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des entités &<>"', + 4 => false, + 5 => true, + ], + 111 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte avec des entités &<>"' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des entités &<>"', + 4 => false, + 5 => false, + ], + 112 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte sans entites &<>"'' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte sans entites &<>"\'', + 4 => true, + 5 => true, + ], + 113 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un texte sans entites &<>"'' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte sans entites &<>"\'', + 4 => true, + 5 => false, + ], + 114 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte sans entites &<>"'\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte sans entites &<>"\'', + 4 => false, + 5 => true, + ], + 115 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte sans entites &<>"'\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte sans entites &<>"\'', + 4 => false, + 5 => false, + ], + 116 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => true, + 5 => true, + ], + 117 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => true, + 5 => false, + ], + 118 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => false, + 5 => true, + ], + 119 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 4 => false, + 5 => false, + ], + 120 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un modele <modeleinexistant|lien=[->https://www.spip.net]>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => true, + 5 => true, + ], + 121 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un modele <modeleinexistant|lien=[->https://www.spip.net]>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => true, + 5 => false, + ], + 122 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un modele <modeleinexistant|lien=[->https://www.spip.net]>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => false, + 5 => true, + ], + 123 => [ + 0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='Un modele <modeleinexistant|lien=[->https://www.spip.net]>' /></a>", + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 4 => false, + 5 => false, + ], + 124 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte avec des retour +a la ligne et meme des paragraphes\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => true, + 5 => true, + ], + 125 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte avec des retour +a la ligne et meme des paragraphes\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => true, + 5 => false, + ], + 126 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte avec des retour +a la ligne et meme des + +paragraphes\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => false, + 5 => true, + ], + 127 => [ + 0 => '<a href=\'https://www.spip.net\'><img src=\'https://www.spip.net/IMG/logo/siteon0.png\' alt=\'Un texte avec des retour +a la ligne et meme des + +paragraphes\' /></a>', + 1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' alt='SPIP' /></a>", + 2 => 'alt', + 3 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 4 => false, + 5 => false, + ], + 128 => [ + 0 => "<input value='<span style="color:red;">ho</span>' />", + 1 => '<input />', + 2 => 'value', + 3 => '<span style="color:red;">ho</span>', + ], + ]; + } +} diff --git a/tests/tests/Filtre/LabelTest.php b/tests/tests/Filtre/LabelTest.php new file mode 100644 index 0000000000..4a3de31631 --- /dev/null +++ b/tests/tests/Filtre/LabelTest.php @@ -0,0 +1,127 @@ +<?php + +declare(strict_types=1); + +/***************************************************************************\ + * SPIP, Système de publication pour l'internet * + * * + * Copyright © avec tendresse depuis 2001 * + * Arnaud Martin, Antoine Pitrou, Philippe Rivière, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribué sous licence GNU/GPL. * + * Pour plus de détails voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class LabelTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + include_spip('inc/filtres'); + changer_langue('fr'); + } + + public static function providerlabelNettoyer(): array + { + $list = [ + 'bonjour' => 'bonjour', + 'bonjour ' => 'bonjour', + 'bonjour : ' => 'bonjour', + "bonjour\t:\t" => 'bonjour', + "bonjour\n:\n" => 'bonjour', + "boujour\v:\v" => 'boujour', + "bonjour\u{a0}:\u{a0}" => 'bonjour', + 'bonjour : ' => 'bonjour', + 'Ah là là' => 'Ah là là', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + public static function providerlabelNettoyerInitialeMajuscule(): array + { + $list = [ + 'bonjour' => 'Bonjour', + 'à l’arrivée : ' => 'À l’arrivée', + 'Êtes-vous prêt·es ? ' => 'Êtes-vous prêt·es ?', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + public static function providerlabelPonctuer(): array + { + $list = [ + 'bonjour' => 'bonjour :', + 'bonjour :' => 'bonjour :', + 'bonjour : ' => 'bonjour :', + 'à la bonne heure : ' => 'à la bonne heure :', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + public static function providerlabelPonctuerInitialeMajuscule(): array + { + $list = [ + 'bonjour' => 'Bonjour :', + 'à la bonne heure : ' => 'À la bonne heure :', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + /** + * @dataProvider providerLabelNettoyer + */ + public function testLabelNettoyer($source, $expected): void + { + $this->assertEquals($expected, label_nettoyer($source, false)); + } + + /** + * @depends testLabelNettoyer + * @dataProvider providerLabelNettoyerInitialeMajuscule + */ + public function testLabelNettoyerInitialeMajuscule($source, $expected): void + { + $this->assertEquals($expected, label_nettoyer($source, true)); + } + + /** + * @depends testLabelNettoyer + * @dataProvider providerLabelNettoyerInitialeMajuscule + */ + public function testLabelNettoyerInitialeMajusculeParDefaut($source, $expected): void + { + $this->assertEquals($expected, label_nettoyer($source)); + } + + /** + * @depends testLabelNettoyer + * @dataProvider providerLabelPonctuer + */ + public function testLabelPonctuer($source, $expected): void + { + // TODO + $this->markTestSkipped('NIY'); + $this->assertEquals($expected, label_ponctuer($source, false)); + } + + /** + * @depends testLabelPonctuer + * @dataProvider providerLabelPonctuerInitialeMajuscule + */ + public function testLabelPonctuerInitialeMajuscule($source, $expected): void + { + $this->assertEquals($expected, label_ponctuer($source, true)); + } + + /** + * @depends testLabelPonctuer + * @dataProvider providerLabelPonctuerInitialeMajuscule + */ + public function testLabelPonctuerInitialeMajusculeParDefaut($source, $expected): void + { + $this->assertEquals($expected, label_ponctuer($source)); + } +} diff --git a/tests/tests/Filtre/LargeurTest.php b/tests/tests/Filtre/LargeurTest.php new file mode 100644 index 0000000000..d30ef2fb2f --- /dev/null +++ b/tests/tests/Filtre/LargeurTest.php @@ -0,0 +1,50 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction largeur du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class LargeurTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresLargeur + */ + public function testFiltresLargeur($expected, ...$args): void + { + $actual = largeur(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresLargeur(): array + { + return [ + 0 => [ + 0 => 300, + 1 => 'https://www.spip.net/IMG/logo/siteon0.png', + ], + 2 => [ + 0 => 231, + 1 => 'prive/images/logo-spip.png', + ], + 3 => [ + 0 => 0, + 1 => 'prive/aide_body.css', + ], + 4 => [ + 0 => 16, + 1 => 'prive/images/searching.gif', + ], + ]; + } +} diff --git a/tests/tests/Filtre/LienOuExposeTest.php b/tests/tests/Filtre/LienOuExposeTest.php new file mode 100644 index 0000000000..0128771b65 --- /dev/null +++ b/tests/tests/Filtre/LienOuExposeTest.php @@ -0,0 +1,216 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction lien_ou_expose du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class LienOuExposeTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresLienOuExpose + */ + public function testFiltresLienOuExpose($expected, ...$args): void + { + $actual = lien_ou_expose(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresLienOuExpose(): array + { + return [ + 0 => [ + 0 => '<strong class="on">libelle</strong>', + 1 => 'http://www.spip.net/', + 2 => 'libelle', + 3 => true, + ], + 1 => [ + 0 => "<a href='http://www.spip.net/'>libelle</a>", + 1 => 'http://www.spip.net/', + 2 => 'libelle', + 3 => false, + ], + 2 => [ + 0 => '<strong class="on">0</strong>', + 1 => 'http://www.spip.net/', + 2 => 0, + 3 => true, + ], + 3 => [ + 0 => '<strong class="on">-1</strong>', + 1 => 'http://www.spip.net/', + 2 => -1, + 3 => true, + ], + 4 => [ + 0 => '<strong class="on">1</strong>', + 1 => 'http://www.spip.net/', + 2 => 1, + 3 => true, + ], + 5 => [ + 0 => '<strong class="on">2</strong>', + 1 => 'http://www.spip.net/', + 2 => 2, + 3 => true, + ], + 6 => [ + 0 => '<strong class="on">3</strong>', + 1 => 'http://www.spip.net/', + 2 => 3, + 3 => true, + ], + 7 => [ + 0 => '<strong class="on">4</strong>', + 1 => 'http://www.spip.net/', + 2 => 4, + 3 => true, + ], + 8 => [ + 0 => '<strong class="on">5</strong>', + 1 => 'http://www.spip.net/', + 2 => 5, + 3 => true, + ], + 9 => [ + 0 => '<strong class="on">6</strong>', + 1 => 'http://www.spip.net/', + 2 => 6, + 3 => true, + ], + 10 => [ + 0 => '<strong class="on">7</strong>', + 1 => 'http://www.spip.net/', + 2 => 7, + 3 => true, + ], + 11 => [ + 0 => '<strong class="on">10</strong>', + 1 => 'http://www.spip.net/', + 2 => 10, + 3 => true, + ], + 12 => [ + 0 => '<strong class="on">20</strong>', + 1 => 'http://www.spip.net/', + 2 => 20, + 3 => true, + ], + 13 => [ + 0 => '<strong class="on">30</strong>', + 1 => 'http://www.spip.net/', + 2 => 30, + 3 => true, + ], + 14 => [ + 0 => '<strong class="on">50</strong>', + 1 => 'http://www.spip.net/', + 2 => 50, + 3 => true, + ], + 15 => [ + 0 => '<strong class="on">100</strong>', + 1 => 'http://www.spip.net/', + 2 => 100, + 3 => true, + ], + 16 => [ + 0 => '<strong class="on">1000</strong>', + 1 => 'http://www.spip.net/', + 2 => 1000, + 3 => true, + ], + 17 => [ + 0 => '<strong class="on">10000</strong>', + 1 => 'http://www.spip.net/', + 2 => 10000, + 3 => true, + ], + 18 => [ + 0 => '<strong class="on">0</strong>', + 1 => 'http://www.spip.net/', + 2 => '0', + 3 => true, + ], + 19 => [ + 0 => '<strong class="on">SPIP</strong>', + 1 => 'http://www.spip.net/', + 2 => 'SPIP', + 3 => true, + 4 => 'lien', + ], + 20 => [ + 0 => "<a href='http://www.spip.net/' class='lien'>SPIP</a>", + 1 => 'http://www.spip.net/', + 2 => 'SPIP', + 3 => false, + 4 => 'lien', + ], + 21 => [ + 0 => '<strong class="on">SPIP</strong>', + 1 => 'http://www.spip.net/', + 2 => 'SPIP', + 3 => true, + 4 => '', + 5 => 'titre', + ], + 22 => [ + 0 => "<a href='http://www.spip.net/' title='titre'>SPIP</a>", + 1 => 'http://www.spip.net/', + 2 => 'SPIP', + 3 => false, + 4 => '', + 5 => 'titre', + ], + 23 => [ + 0 => '<strong class="on">SPIP</strong>', + 1 => 'http://www.spip.net/', + 2 => 'SPIP', + 3 => true, + 4 => '', + 5 => '', + 6 => 'prev', + ], + 24 => [ + 0 => "<a href='http://www.spip.net/' rel='prev'>SPIP</a>", + 1 => 'http://www.spip.net/', + 2 => 'SPIP', + 3 => false, + 4 => '', + 5 => '', + 6 => 'prev', + ], + 25 => [ + 0 => '<strong class="on">SPIP</strong>', + 1 => 'http://www.spip.net/', + 2 => 'SPIP', + 3 => true, + 4 => '', + 5 => '', + 6 => '', + 7 => ' onclick="alert(\'toto\');"', + ], + 26 => [ + 0 => '<a href=\'http://www.spip.net/\' onclick="alert(\'toto\');">SPIP</a>', + 1 => 'http://www.spip.net/', + 2 => 'SPIP', + 3 => false, + 4 => '', + 5 => '', + 6 => '', + 7 => ' onclick="alert(\'toto\');"', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Mime/FiltreTextCsvDistTest.php b/tests/tests/Filtre/Mime/FiltreTextCsvDistTest.php new file mode 100644 index 0000000000..88e1e8a0b7 --- /dev/null +++ b/tests/tests/Filtre/Mime/FiltreTextCsvDistTest.php @@ -0,0 +1,136 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction filtre_text_csv_dist du fichier inc/filtres_mime.php + */ + +namespace Spip\Core\Tests\Filtre\Mime; + +use PHPUnit\Framework\TestCase; + +class FiltreTextCsvDistTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres_mime.php', '', true); + } + + protected function setUp(): void + { + changer_langue('fr'); + // ce test est en fr + } + + /** + * @dataProvider providerFiltresMimeFiltreTextCsvDist + */ + public function testFiltresMimeFiltreTextCsvDist($expected, ...$args): void + { + $actual = filtre_text_csv_dist(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresMimeFiltreTextCsvDist(): array + { + return [ + 0 => [ + 0 => '<table class="table spip"> +<thead><tr class=\'row_first\'><th id=\'id9b86_c0\'>A</th><th id=\'id9b86_c1\'>B</th><th id=\'id9b86_c2\'>C</th><th id=\'id9b86_c3\'>D</th><th id=\'id9b86_c4\'>E</th><th id=\'id9b86_c5\'>F</th></tr></thead> +<tbody> +<tr class=\'row_odd odd\'> +<td headers=\'id9b86_c0\'>un</td> +<td headers=\'id9b86_c1\'>tableau</td> +<td headers=\'id9b86_c2\'>csv</td> +<td headers=\'id9b86_c3\'>avec</td> +<td headers=\'id9b86_c4\'>des</td> +<td headers=\'id9b86_c5\'>valeurs</td></tr> +<tr class=\'row_even even\'> +<td headers=\'id9b86_c0\'>dans chaque</td> +<td headers=\'id9b86_c1\'>case</td> +<td headers=\'id9b86_c2\'>et aussi une</td> +<td headers=\'id9b86_c3\'>case</td> +<td headers=\'id9b86_c4\'>avec</td> +<td headers=\'id9b86_c5\'>des</td></tr> +<tr class=\'row_odd odd\'> +<td headers=\'id9b86_c0\'>"guillemets"</td> +<td headers=\'id9b86_c1\'>est-ce</td> +<td headers=\'id9b86_c2\'>que</td> +<td headers=\'id9b86_c3\'>ça</td> +<td headers=\'id9b86_c4\'>marche ?</td> +<td headers=\'id9b86_c5\'></td></tr> +</tbody> +</table>', + 1 => 'A;B;C;D;E;F +un;tableau;csv;avec;des;valeurs +dans chaque;case;et aussi une;case;avec;des +"""guillemets""";est-ce;que;ça;marche ?;', + ], + 1 => [ + 0 => '<table class="table spip"> +<thead><tr class=\'row_first\'><th id=\'id5b64_c0\'>A</th><th id=\'id5b64_c1\'>B</th><th id=\'id5b64_c2\'>C</th><th id=\'id5b64_c3\'>D</th><th id=\'id5b64_c4\'>E</th><th id=\'id5b64_c5\'>F</th></tr></thead> +<tbody> +<tr class=\'row_odd odd\'> +<td headers=\'id5b64_c0\'>un</td> +<td headers=\'id5b64_c1\'>tableau</td> +<td headers=\'id5b64_c2\'>csv</td> +<td headers=\'id5b64_c3\'>avec</td> +<td headers=\'id5b64_c4\'>des</td> +<td headers=\'id5b64_c5\'>valeurs</td></tr> +<tr class=\'row_even even\'> +<td headers=\'id5b64_c0\'>dans chaque</td> +<td headers=\'id5b64_c1\'>case</td> +<td headers=\'id5b64_c2\'>et aussi une</td> +<td headers=\'id5b64_c3\'>case</td> +<td headers=\'id5b64_c4\'>avec</td> +<td headers=\'id5b64_c5\'>des</td></tr> +<tr class=\'row_odd odd\'> +<td headers=\'id5b64_c0\'>guillemets</td> +<td headers=\'id5b64_c1\'>est-ce</td> +<td headers=\'id5b64_c2\'>que</td> +<td headers=\'id5b64_c3\'>ça</td> +<td headers=\'id5b64_c4\'>marche ?</td> +<td headers=\'id5b64_c5\'></td></tr> +</tbody> +</table>', + 1 => 'A;B;C;D;E;F +un;tableau;csv;avec;des;valeurs +dans chaque;case;et aussi une;case;avec;des +guillemets;est-ce;que;ça;marche ?;', + ], + 2 => [ + 0 => '<table class="table spip"> +<thead><tr class=\'row_first\'><th id=\'idee6c_c0\'>A</th><th id=\'idee6c_c1\'>B</th><th id=\'idee6c_c2\'>C</th><th id=\'idee6c_c3\'>D</th><th id=\'idee6c_c4\'>E</th><th id=\'idee6c_c5\'>F</th></tr></thead> +<tbody> +<tr class=\'row_odd odd\'> +<td headers=\'idee6c_c0\'>un</td> +<td headers=\'idee6c_c1\'>tableau</td> +<td headers=\'idee6c_c2\'>csv</td> +<td headers=\'idee6c_c3\'>avec</td> +<td headers=\'idee6c_c4\'>des</td> +<td headers=\'idee6c_c5\'>valeurs</td></tr> +<tr class=\'row_even even\'> +<td headers=\'idee6c_c0\'>dans chaque</td> +<td headers=\'idee6c_c1\'>case</td> +<td headers=\'idee6c_c2\'>et aussi une</td> +<td headers=\'idee6c_c3\'>case</td> +<td headers=\'idee6c_c4\'>avec</td> +<td headers=\'idee6c_c5\'>des</td></tr> +<tr class=\'row_odd odd\'> +<td headers=\'idee6c_c0\'>"guillemets"</td> +<td headers=\'idee6c_c1\'>est-ce</td> +<td headers=\'idee6c_c2\'>que</td> +<td headers=\'idee6c_c3\'>√ßa</td> +<td headers=\'idee6c_c4\'>marche ?</td> +<td headers=\'idee6c_c5\'></td></tr> +</tbody> +</table>', + 1 => '"A","B","C","D","E","F" +"un","tableau","csv","avec","des","valeurs" +"dans chaque","case","et aussi une","case","avec","des" +"""guillemets""","est-ce","que","√ßa","marche ?",', + ], + ]; + } +} diff --git a/tests/tests/Filtre/Mime/FiltreTextDistTest.php b/tests/tests/Filtre/Mime/FiltreTextDistTest.php new file mode 100644 index 0000000000..e63e5774c9 --- /dev/null +++ b/tests/tests/Filtre/Mime/FiltreTextDistTest.php @@ -0,0 +1,134 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction filtre_text_dist du fichier inc/filtres_mime.php + */ + +namespace Spip\Core\Tests\Filtre\Mime; + +use PHPUnit\Framework\TestCase; + +class FiltreTextDistTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres_mime.php', '', true); + } + + /** + * @dataProvider providerFiltresMimeFiltreTextDist + */ + public function testFiltresMimeFiltreTextDist($expected, ...$args): void + { + $actual = filtre_text_dist(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresMimeFiltreTextDist(): array + { + return [ + 0 => [ + 0 => '<pre></pre>', + 1 => '', + ], + 2 => [ + 0 => '<pre>0</pre>', + 1 => '0', + ], + 3 => [ + 0 => '<pre>Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net</pre>', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 4 => [ + 0 => '<pre>Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;</pre>', + 1 => 'Un texte avec des entités &<>"', + ], + 5 => [ + 0 => '<pre>Un texte sans entites &<>"\'</pre>', + 1 => 'Un texte sans entites &<>"\'', + ], + 6 => [ + 0 => '<pre>{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code></pre>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 7 => [ + 0 => '<pre>Un modele <modeleinexistant|lien=[->http://www.spip.net]></pre>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 8 => [ + 0 => '<pre>bla bla</pre>', + 1 => 'bla bla', + ], + 9 => [ + 0 => '<pre>0</pre>', + 1 => 0, + ], + 10 => [ + 0 => '<pre>-1</pre>', + 1 => -1, + ], + 11 => [ + 0 => '<pre>1</pre>', + 1 => 1, + ], + 12 => [ + 0 => '<pre>2</pre>', + 1 => 2, + ], + 13 => [ + 0 => '<pre>3</pre>', + 1 => 3, + ], + 14 => [ + 0 => '<pre>4</pre>', + 1 => 4, + ], + 15 => [ + 0 => '<pre>5</pre>', + 1 => 5, + ], + 16 => [ + 0 => '<pre>6</pre>', + 1 => 6, + ], + 17 => [ + 0 => '<pre>7</pre>', + 1 => 7, + ], + 18 => [ + 0 => '<pre>10</pre>', + 1 => 10, + ], + 19 => [ + 0 => '<pre>20</pre>', + 1 => 20, + ], + 20 => [ + 0 => '<pre>30</pre>', + 1 => 30, + ], + 21 => [ + 0 => '<pre>50</pre>', + 1 => 50, + ], + 22 => [ + 0 => '<pre>100</pre>', + 1 => 100, + ], + 23 => [ + 0 => '<pre>1000</pre>', + 1 => 1000, + ], + 24 => [ + 0 => '<pre>10000</pre>', + 1 => 10000, + ], + 29 => [ + 0 => '<pre></pre>', + 1 => null, + ], + ]; + } +} diff --git a/tests/tests/Filtre/Mini/ProtocoleVerifierTest.php b/tests/tests/Filtre/Mini/ProtocoleVerifierTest.php new file mode 100644 index 0000000000..2dd9255eab --- /dev/null +++ b/tests/tests/Filtre/Mini/ProtocoleVerifierTest.php @@ -0,0 +1,75 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction protocole_verifier du fichier ./inc/filtres_mini.php + */ + +namespace Spip\Core\Tests\Filtre\Mini; + +use PHPUnit\Framework\TestCase; + +class ProtocoleVerifierTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres_mini.php', '', true); + } + + /** + * @dataProvider providerFiltresMiniProtocoleVerifier + */ + public function testFiltresMiniProtocoleVerifier($expected, ...$args): void + { + $actual = protocole_verifier(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresMiniProtocoleVerifier(): array + { + return [ + 0 => [ + 0 => true, + 1 => 'http://www.spip.net', + ], + 1 => [ + 0 => true, + 1 => 'https://www.spip.net', + ], + 2 => [ + 0 => false, + 1 => 'ftp://www.spip.net', + ], + 3 => [ + 0 => true, + 1 => 'ftp://www.spip.net', + 2 => [ + 0 => 'http', + 1 => 'https', + 2 => 'ftp', + ], + ], + 4 => [ + 0 => false, + 1 => '/etc/password', + ], + 5 => [ + 0 => false, + 1 => 'squelettes/img/recherche.png', + ], + 6 => [ + 0 => true, + 1 => 'HTTP://WWW.SPIP.NET', + ], + 7 => [ + 0 => true, + 1 => 'http://www.spip.net', + 2 => [ + 0 => 'HTTP', + 1 => 'HTTPS', + ], + ], + ]; + } +} diff --git a/tests/tests/Filtre/ModuloTest.php b/tests/tests/Filtre/ModuloTest.php new file mode 100644 index 0000000000..b3917b415f --- /dev/null +++ b/tests/tests/Filtre/ModuloTest.php @@ -0,0 +1,1314 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction modulo du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class ModuloTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresModulo + */ + public function testFiltresModulo($expected, ...$args): void + { + $actual = modulo(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresModulo(): array + { + return [ + 0 => [ + 0 => 0, + 1 => 0, + 2 => 0, + ], + 1 => [ + 0 => 0, + 1 => 0, + 2 => -1, + ], + 2 => [ + 0 => 0, + 1 => 0, + 2 => 1, + ], + 3 => [ + 0 => 0, + 1 => 0, + 2 => 2, + ], + 4 => [ + 0 => 0, + 1 => 0, + 2 => 3, + ], + 5 => [ + 0 => 0, + 1 => 0, + 2 => 4, + ], + 6 => [ + 0 => 0, + 1 => 0, + 2 => 5, + ], + 7 => [ + 0 => 0, + 1 => 0, + 2 => 6, + ], + 8 => [ + 0 => 0, + 1 => 0, + 2 => 7, + ], + 9 => [ + 0 => 0, + 1 => 0, + 2 => 10, + ], + 10 => [ + 0 => 0, + 1 => 0, + 2 => 20, + ], + 11 => [ + 0 => 0, + 1 => 0, + 2 => 30, + ], + 12 => [ + 0 => 0, + 1 => 0, + 2 => 50, + ], + 13 => [ + 0 => 0, + 1 => 0, + 2 => 100, + ], + 14 => [ + 0 => 0, + 1 => 0, + 2 => 1000, + ], + 15 => [ + 0 => 0, + 1 => 0, + 2 => 10000, + ], + 16 => [ + 0 => 0, + 1 => -1, + 2 => 0, + ], + 17 => [ + 0 => 0, + 1 => -1, + 2 => -1, + ], + 18 => [ + 0 => 0, + 1 => -1, + 2 => 1, + ], + 19 => [ + 0 => -1, + 1 => -1, + 2 => 2, + ], + 20 => [ + 0 => -1, + 1 => -1, + 2 => 3, + ], + 21 => [ + 0 => -1, + 1 => -1, + 2 => 4, + ], + 22 => [ + 0 => -1, + 1 => -1, + 2 => 5, + ], + 23 => [ + 0 => -1, + 1 => -1, + 2 => 6, + ], + 24 => [ + 0 => -1, + 1 => -1, + 2 => 7, + ], + 25 => [ + 0 => -1, + 1 => -1, + 2 => 10, + ], + 26 => [ + 0 => -1, + 1 => -1, + 2 => 20, + ], + 27 => [ + 0 => -1, + 1 => -1, + 2 => 30, + ], + 28 => [ + 0 => -1, + 1 => -1, + 2 => 50, + ], + 29 => [ + 0 => -1, + 1 => -1, + 2 => 100, + ], + 30 => [ + 0 => -1, + 1 => -1, + 2 => 1000, + ], + 31 => [ + 0 => -1, + 1 => -1, + 2 => 10000, + ], + 32 => [ + 0 => 0, + 1 => 1, + 2 => 0, + ], + 33 => [ + 0 => 0, + 1 => 1, + 2 => -1, + ], + 34 => [ + 0 => 0, + 1 => 1, + 2 => 1, + ], + 35 => [ + 0 => 1, + 1 => 1, + 2 => 2, + ], + 36 => [ + 0 => 1, + 1 => 1, + 2 => 3, + ], + 37 => [ + 0 => 1, + 1 => 1, + 2 => 4, + ], + 38 => [ + 0 => 1, + 1 => 1, + 2 => 5, + ], + 39 => [ + 0 => 1, + 1 => 1, + 2 => 6, + ], + 40 => [ + 0 => 1, + 1 => 1, + 2 => 7, + ], + 41 => [ + 0 => 1, + 1 => 1, + 2 => 10, + ], + 42 => [ + 0 => 1, + 1 => 1, + 2 => 20, + ], + 43 => [ + 0 => 1, + 1 => 1, + 2 => 30, + ], + 44 => [ + 0 => 1, + 1 => 1, + 2 => 50, + ], + 45 => [ + 0 => 1, + 1 => 1, + 2 => 100, + ], + 46 => [ + 0 => 1, + 1 => 1, + 2 => 1000, + ], + 47 => [ + 0 => 1, + 1 => 1, + 2 => 10000, + ], + 48 => [ + 0 => 0, + 1 => 2, + 2 => 0, + ], + 49 => [ + 0 => 0, + 1 => 2, + 2 => -1, + ], + 50 => [ + 0 => 0, + 1 => 2, + 2 => 1, + ], + 51 => [ + 0 => 0, + 1 => 2, + 2 => 2, + ], + 52 => [ + 0 => 2, + 1 => 2, + 2 => 3, + ], + 53 => [ + 0 => 2, + 1 => 2, + 2 => 4, + ], + 54 => [ + 0 => 2, + 1 => 2, + 2 => 5, + ], + 55 => [ + 0 => 2, + 1 => 2, + 2 => 6, + ], + 56 => [ + 0 => 2, + 1 => 2, + 2 => 7, + ], + 57 => [ + 0 => 2, + 1 => 2, + 2 => 10, + ], + 58 => [ + 0 => 2, + 1 => 2, + 2 => 20, + ], + 59 => [ + 0 => 2, + 1 => 2, + 2 => 30, + ], + 60 => [ + 0 => 2, + 1 => 2, + 2 => 50, + ], + 61 => [ + 0 => 2, + 1 => 2, + 2 => 100, + ], + 62 => [ + 0 => 2, + 1 => 2, + 2 => 1000, + ], + 63 => [ + 0 => 2, + 1 => 2, + 2 => 10000, + ], + 64 => [ + 0 => 0, + 1 => 3, + 2 => 0, + ], + 65 => [ + 0 => 0, + 1 => 3, + 2 => -1, + ], + 66 => [ + 0 => 0, + 1 => 3, + 2 => 1, + ], + 67 => [ + 0 => 1, + 1 => 3, + 2 => 2, + ], + 68 => [ + 0 => 0, + 1 => 3, + 2 => 3, + ], + 69 => [ + 0 => 3, + 1 => 3, + 2 => 4, + ], + 70 => [ + 0 => 3, + 1 => 3, + 2 => 5, + ], + 71 => [ + 0 => 3, + 1 => 3, + 2 => 6, + ], + 72 => [ + 0 => 3, + 1 => 3, + 2 => 7, + ], + 73 => [ + 0 => 3, + 1 => 3, + 2 => 10, + ], + 74 => [ + 0 => 3, + 1 => 3, + 2 => 20, + ], + 75 => [ + 0 => 3, + 1 => 3, + 2 => 30, + ], + 76 => [ + 0 => 3, + 1 => 3, + 2 => 50, + ], + 77 => [ + 0 => 3, + 1 => 3, + 2 => 100, + ], + 78 => [ + 0 => 3, + 1 => 3, + 2 => 1000, + ], + 79 => [ + 0 => 3, + 1 => 3, + 2 => 10000, + ], + 80 => [ + 0 => 0, + 1 => 4, + 2 => 0, + ], + 81 => [ + 0 => 0, + 1 => 4, + 2 => -1, + ], + 82 => [ + 0 => 0, + 1 => 4, + 2 => 1, + ], + 83 => [ + 0 => 0, + 1 => 4, + 2 => 2, + ], + 84 => [ + 0 => 1, + 1 => 4, + 2 => 3, + ], + 85 => [ + 0 => 0, + 1 => 4, + 2 => 4, + ], + 86 => [ + 0 => 4, + 1 => 4, + 2 => 5, + ], + 87 => [ + 0 => 4, + 1 => 4, + 2 => 6, + ], + 88 => [ + 0 => 4, + 1 => 4, + 2 => 7, + ], + 89 => [ + 0 => 4, + 1 => 4, + 2 => 10, + ], + 90 => [ + 0 => 4, + 1 => 4, + 2 => 20, + ], + 91 => [ + 0 => 4, + 1 => 4, + 2 => 30, + ], + 92 => [ + 0 => 4, + 1 => 4, + 2 => 50, + ], + 93 => [ + 0 => 4, + 1 => 4, + 2 => 100, + ], + 94 => [ + 0 => 4, + 1 => 4, + 2 => 1000, + ], + 95 => [ + 0 => 4, + 1 => 4, + 2 => 10000, + ], + 96 => [ + 0 => 0, + 1 => 5, + 2 => 0, + ], + 97 => [ + 0 => 0, + 1 => 5, + 2 => -1, + ], + 98 => [ + 0 => 0, + 1 => 5, + 2 => 1, + ], + 99 => [ + 0 => 1, + 1 => 5, + 2 => 2, + ], + 100 => [ + 0 => 2, + 1 => 5, + 2 => 3, + ], + 101 => [ + 0 => 1, + 1 => 5, + 2 => 4, + ], + 102 => [ + 0 => 0, + 1 => 5, + 2 => 5, + ], + 103 => [ + 0 => 5, + 1 => 5, + 2 => 6, + ], + 104 => [ + 0 => 5, + 1 => 5, + 2 => 7, + ], + 105 => [ + 0 => 5, + 1 => 5, + 2 => 10, + ], + 106 => [ + 0 => 5, + 1 => 5, + 2 => 20, + ], + 107 => [ + 0 => 5, + 1 => 5, + 2 => 30, + ], + 108 => [ + 0 => 5, + 1 => 5, + 2 => 50, + ], + 109 => [ + 0 => 5, + 1 => 5, + 2 => 100, + ], + 110 => [ + 0 => 5, + 1 => 5, + 2 => 1000, + ], + 111 => [ + 0 => 5, + 1 => 5, + 2 => 10000, + ], + 112 => [ + 0 => 0, + 1 => 6, + 2 => 0, + ], + 113 => [ + 0 => 0, + 1 => 6, + 2 => -1, + ], + 114 => [ + 0 => 0, + 1 => 6, + 2 => 1, + ], + 115 => [ + 0 => 0, + 1 => 6, + 2 => 2, + ], + 116 => [ + 0 => 0, + 1 => 6, + 2 => 3, + ], + 117 => [ + 0 => 2, + 1 => 6, + 2 => 4, + ], + 118 => [ + 0 => 1, + 1 => 6, + 2 => 5, + ], + 119 => [ + 0 => 0, + 1 => 6, + 2 => 6, + ], + 120 => [ + 0 => 6, + 1 => 6, + 2 => 7, + ], + 121 => [ + 0 => 6, + 1 => 6, + 2 => 10, + ], + 122 => [ + 0 => 6, + 1 => 6, + 2 => 20, + ], + 123 => [ + 0 => 6, + 1 => 6, + 2 => 30, + ], + 124 => [ + 0 => 6, + 1 => 6, + 2 => 50, + ], + 125 => [ + 0 => 6, + 1 => 6, + 2 => 100, + ], + 126 => [ + 0 => 6, + 1 => 6, + 2 => 1000, + ], + 127 => [ + 0 => 6, + 1 => 6, + 2 => 10000, + ], + 128 => [ + 0 => 0, + 1 => 7, + 2 => 0, + ], + 129 => [ + 0 => 0, + 1 => 7, + 2 => -1, + ], + 130 => [ + 0 => 0, + 1 => 7, + 2 => 1, + ], + 131 => [ + 0 => 1, + 1 => 7, + 2 => 2, + ], + 132 => [ + 0 => 1, + 1 => 7, + 2 => 3, + ], + 133 => [ + 0 => 3, + 1 => 7, + 2 => 4, + ], + 134 => [ + 0 => 2, + 1 => 7, + 2 => 5, + ], + 135 => [ + 0 => 1, + 1 => 7, + 2 => 6, + ], + 136 => [ + 0 => 0, + 1 => 7, + 2 => 7, + ], + 137 => [ + 0 => 7, + 1 => 7, + 2 => 10, + ], + 138 => [ + 0 => 7, + 1 => 7, + 2 => 20, + ], + 139 => [ + 0 => 7, + 1 => 7, + 2 => 30, + ], + 140 => [ + 0 => 7, + 1 => 7, + 2 => 50, + ], + 141 => [ + 0 => 7, + 1 => 7, + 2 => 100, + ], + 142 => [ + 0 => 7, + 1 => 7, + 2 => 1000, + ], + 143 => [ + 0 => 7, + 1 => 7, + 2 => 10000, + ], + 144 => [ + 0 => 0, + 1 => 10, + 2 => 0, + ], + 145 => [ + 0 => 0, + 1 => 10, + 2 => -1, + ], + 146 => [ + 0 => 0, + 1 => 10, + 2 => 1, + ], + 147 => [ + 0 => 0, + 1 => 10, + 2 => 2, + ], + 148 => [ + 0 => 1, + 1 => 10, + 2 => 3, + ], + 149 => [ + 0 => 2, + 1 => 10, + 2 => 4, + ], + 150 => [ + 0 => 0, + 1 => 10, + 2 => 5, + ], + 151 => [ + 0 => 4, + 1 => 10, + 2 => 6, + ], + 152 => [ + 0 => 3, + 1 => 10, + 2 => 7, + ], + 153 => [ + 0 => 0, + 1 => 10, + 2 => 10, + ], + 154 => [ + 0 => 10, + 1 => 10, + 2 => 20, + ], + 155 => [ + 0 => 10, + 1 => 10, + 2 => 30, + ], + 156 => [ + 0 => 10, + 1 => 10, + 2 => 50, + ], + 157 => [ + 0 => 10, + 1 => 10, + 2 => 100, + ], + 158 => [ + 0 => 10, + 1 => 10, + 2 => 1000, + ], + 159 => [ + 0 => 10, + 1 => 10, + 2 => 10000, + ], + 160 => [ + 0 => 0, + 1 => 20, + 2 => 0, + ], + 161 => [ + 0 => 0, + 1 => 20, + 2 => -1, + ], + 162 => [ + 0 => 0, + 1 => 20, + 2 => 1, + ], + 163 => [ + 0 => 0, + 1 => 20, + 2 => 2, + ], + 164 => [ + 0 => 2, + 1 => 20, + 2 => 3, + ], + 165 => [ + 0 => 0, + 1 => 20, + 2 => 4, + ], + 166 => [ + 0 => 0, + 1 => 20, + 2 => 5, + ], + 167 => [ + 0 => 2, + 1 => 20, + 2 => 6, + ], + 168 => [ + 0 => 6, + 1 => 20, + 2 => 7, + ], + 169 => [ + 0 => 0, + 1 => 20, + 2 => 10, + ], + 170 => [ + 0 => 0, + 1 => 20, + 2 => 20, + ], + 171 => [ + 0 => 20, + 1 => 20, + 2 => 30, + ], + 172 => [ + 0 => 20, + 1 => 20, + 2 => 50, + ], + 173 => [ + 0 => 20, + 1 => 20, + 2 => 100, + ], + 174 => [ + 0 => 20, + 1 => 20, + 2 => 1000, + ], + 175 => [ + 0 => 20, + 1 => 20, + 2 => 10000, + ], + 176 => [ + 0 => 0, + 1 => 30, + 2 => 0, + ], + 177 => [ + 0 => 0, + 1 => 30, + 2 => -1, + ], + 178 => [ + 0 => 0, + 1 => 30, + 2 => 1, + ], + 179 => [ + 0 => 0, + 1 => 30, + 2 => 2, + ], + 180 => [ + 0 => 0, + 1 => 30, + 2 => 3, + ], + 181 => [ + 0 => 2, + 1 => 30, + 2 => 4, + ], + 182 => [ + 0 => 0, + 1 => 30, + 2 => 5, + ], + 183 => [ + 0 => 0, + 1 => 30, + 2 => 6, + ], + 184 => [ + 0 => 2, + 1 => 30, + 2 => 7, + ], + 185 => [ + 0 => 0, + 1 => 30, + 2 => 10, + ], + 186 => [ + 0 => 10, + 1 => 30, + 2 => 20, + ], + 187 => [ + 0 => 0, + 1 => 30, + 2 => 30, + ], + 188 => [ + 0 => 30, + 1 => 30, + 2 => 50, + ], + 189 => [ + 0 => 30, + 1 => 30, + 2 => 100, + ], + 190 => [ + 0 => 30, + 1 => 30, + 2 => 1000, + ], + 191 => [ + 0 => 30, + 1 => 30, + 2 => 10000, + ], + 192 => [ + 0 => 0, + 1 => 50, + 2 => 0, + ], + 193 => [ + 0 => 0, + 1 => 50, + 2 => -1, + ], + 194 => [ + 0 => 0, + 1 => 50, + 2 => 1, + ], + 195 => [ + 0 => 0, + 1 => 50, + 2 => 2, + ], + 196 => [ + 0 => 2, + 1 => 50, + 2 => 3, + ], + 197 => [ + 0 => 2, + 1 => 50, + 2 => 4, + ], + 198 => [ + 0 => 0, + 1 => 50, + 2 => 5, + ], + 199 => [ + 0 => 2, + 1 => 50, + 2 => 6, + ], + 200 => [ + 0 => 1, + 1 => 50, + 2 => 7, + ], + 201 => [ + 0 => 0, + 1 => 50, + 2 => 10, + ], + 202 => [ + 0 => 10, + 1 => 50, + 2 => 20, + ], + 203 => [ + 0 => 20, + 1 => 50, + 2 => 30, + ], + 204 => [ + 0 => 0, + 1 => 50, + 2 => 50, + ], + 205 => [ + 0 => 50, + 1 => 50, + 2 => 100, + ], + 206 => [ + 0 => 50, + 1 => 50, + 2 => 1000, + ], + 207 => [ + 0 => 50, + 1 => 50, + 2 => 10000, + ], + 208 => [ + 0 => 0, + 1 => 100, + 2 => 0, + ], + 209 => [ + 0 => 0, + 1 => 100, + 2 => -1, + ], + 210 => [ + 0 => 0, + 1 => 100, + 2 => 1, + ], + 211 => [ + 0 => 0, + 1 => 100, + 2 => 2, + ], + 212 => [ + 0 => 1, + 1 => 100, + 2 => 3, + ], + 213 => [ + 0 => 0, + 1 => 100, + 2 => 4, + ], + 214 => [ + 0 => 0, + 1 => 100, + 2 => 5, + ], + 215 => [ + 0 => 4, + 1 => 100, + 2 => 6, + ], + 216 => [ + 0 => 2, + 1 => 100, + 2 => 7, + ], + 217 => [ + 0 => 0, + 1 => 100, + 2 => 10, + ], + 218 => [ + 0 => 0, + 1 => 100, + 2 => 20, + ], + 219 => [ + 0 => 10, + 1 => 100, + 2 => 30, + ], + 220 => [ + 0 => 0, + 1 => 100, + 2 => 50, + ], + 221 => [ + 0 => 0, + 1 => 100, + 2 => 100, + ], + 222 => [ + 0 => 100, + 1 => 100, + 2 => 1000, + ], + 223 => [ + 0 => 100, + 1 => 100, + 2 => 10000, + ], + 224 => [ + 0 => 0, + 1 => 1000, + 2 => 0, + ], + 225 => [ + 0 => 0, + 1 => 1000, + 2 => -1, + ], + 226 => [ + 0 => 0, + 1 => 1000, + 2 => 1, + ], + 227 => [ + 0 => 0, + 1 => 1000, + 2 => 2, + ], + 228 => [ + 0 => 1, + 1 => 1000, + 2 => 3, + ], + 229 => [ + 0 => 0, + 1 => 1000, + 2 => 4, + ], + 230 => [ + 0 => 0, + 1 => 1000, + 2 => 5, + ], + 231 => [ + 0 => 4, + 1 => 1000, + 2 => 6, + ], + 232 => [ + 0 => 6, + 1 => 1000, + 2 => 7, + ], + 233 => [ + 0 => 0, + 1 => 1000, + 2 => 10, + ], + 234 => [ + 0 => 0, + 1 => 1000, + 2 => 20, + ], + 235 => [ + 0 => 10, + 1 => 1000, + 2 => 30, + ], + 236 => [ + 0 => 0, + 1 => 1000, + 2 => 50, + ], + 237 => [ + 0 => 0, + 1 => 1000, + 2 => 100, + ], + 238 => [ + 0 => 0, + 1 => 1000, + 2 => 1000, + ], + 239 => [ + 0 => 1000, + 1 => 1000, + 2 => 10000, + ], + 240 => [ + 0 => 0, + 1 => 10000, + 2 => 0, + ], + 241 => [ + 0 => 0, + 1 => 10000, + 2 => -1, + ], + 242 => [ + 0 => 0, + 1 => 10000, + 2 => 1, + ], + 243 => [ + 0 => 0, + 1 => 10000, + 2 => 2, + ], + 244 => [ + 0 => 1, + 1 => 10000, + 2 => 3, + ], + 245 => [ + 0 => 0, + 1 => 10000, + 2 => 4, + ], + 246 => [ + 0 => 0, + 1 => 10000, + 2 => 5, + ], + 247 => [ + 0 => 4, + 1 => 10000, + 2 => 6, + ], + 248 => [ + 0 => 4, + 1 => 10000, + 2 => 7, + ], + 249 => [ + 0 => 0, + 1 => 10000, + 2 => 10, + ], + 250 => [ + 0 => 0, + 1 => 10000, + 2 => 20, + ], + 251 => [ + 0 => 10, + 1 => 10000, + 2 => 30, + ], + 252 => [ + 0 => 0, + 1 => 10000, + 2 => 50, + ], + 253 => [ + 0 => 0, + 1 => 10000, + 2 => 100, + ], + 254 => [ + 0 => 0, + 1 => 10000, + 2 => 1000, + ], + 255 => [ + 0 => 0, + 1 => 10000, + 2 => 10000, + ], + ]; + } +} diff --git a/tests/tests/Filtre/MoinsTest.php b/tests/tests/Filtre/MoinsTest.php new file mode 100644 index 0000000000..8cd72d079e --- /dev/null +++ b/tests/tests/Filtre/MoinsTest.php @@ -0,0 +1,1314 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction moins du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class MoinsTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresMoins + */ + public function testFiltresMoins($expected, ...$args): void + { + $actual = moins(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresMoins(): array + { + return [ + 0 => [ + 0 => 0, + 1 => 0, + 2 => 0, + ], + 1 => [ + 0 => 1, + 1 => 0, + 2 => -1, + ], + 2 => [ + 0 => -1, + 1 => 0, + 2 => 1, + ], + 3 => [ + 0 => -2, + 1 => 0, + 2 => 2, + ], + 4 => [ + 0 => -3, + 1 => 0, + 2 => 3, + ], + 5 => [ + 0 => -4, + 1 => 0, + 2 => 4, + ], + 6 => [ + 0 => -5, + 1 => 0, + 2 => 5, + ], + 7 => [ + 0 => -6, + 1 => 0, + 2 => 6, + ], + 8 => [ + 0 => -7, + 1 => 0, + 2 => 7, + ], + 9 => [ + 0 => -10, + 1 => 0, + 2 => 10, + ], + 10 => [ + 0 => -20, + 1 => 0, + 2 => 20, + ], + 11 => [ + 0 => -30, + 1 => 0, + 2 => 30, + ], + 12 => [ + 0 => -50, + 1 => 0, + 2 => 50, + ], + 13 => [ + 0 => -100, + 1 => 0, + 2 => 100, + ], + 14 => [ + 0 => -1000, + 1 => 0, + 2 => 1000, + ], + 15 => [ + 0 => -10000, + 1 => 0, + 2 => 10000, + ], + 16 => [ + 0 => -1, + 1 => -1, + 2 => 0, + ], + 17 => [ + 0 => 0, + 1 => -1, + 2 => -1, + ], + 18 => [ + 0 => -2, + 1 => -1, + 2 => 1, + ], + 19 => [ + 0 => -3, + 1 => -1, + 2 => 2, + ], + 20 => [ + 0 => -4, + 1 => -1, + 2 => 3, + ], + 21 => [ + 0 => -5, + 1 => -1, + 2 => 4, + ], + 22 => [ + 0 => -6, + 1 => -1, + 2 => 5, + ], + 23 => [ + 0 => -7, + 1 => -1, + 2 => 6, + ], + 24 => [ + 0 => -8, + 1 => -1, + 2 => 7, + ], + 25 => [ + 0 => -11, + 1 => -1, + 2 => 10, + ], + 26 => [ + 0 => -21, + 1 => -1, + 2 => 20, + ], + 27 => [ + 0 => -31, + 1 => -1, + 2 => 30, + ], + 28 => [ + 0 => -51, + 1 => -1, + 2 => 50, + ], + 29 => [ + 0 => -101, + 1 => -1, + 2 => 100, + ], + 30 => [ + 0 => -1001, + 1 => -1, + 2 => 1000, + ], + 31 => [ + 0 => -10001, + 1 => -1, + 2 => 10000, + ], + 32 => [ + 0 => 1, + 1 => 1, + 2 => 0, + ], + 33 => [ + 0 => 2, + 1 => 1, + 2 => -1, + ], + 34 => [ + 0 => 0, + 1 => 1, + 2 => 1, + ], + 35 => [ + 0 => -1, + 1 => 1, + 2 => 2, + ], + 36 => [ + 0 => -2, + 1 => 1, + 2 => 3, + ], + 37 => [ + 0 => -3, + 1 => 1, + 2 => 4, + ], + 38 => [ + 0 => -4, + 1 => 1, + 2 => 5, + ], + 39 => [ + 0 => -5, + 1 => 1, + 2 => 6, + ], + 40 => [ + 0 => -6, + 1 => 1, + 2 => 7, + ], + 41 => [ + 0 => -9, + 1 => 1, + 2 => 10, + ], + 42 => [ + 0 => -19, + 1 => 1, + 2 => 20, + ], + 43 => [ + 0 => -29, + 1 => 1, + 2 => 30, + ], + 44 => [ + 0 => -49, + 1 => 1, + 2 => 50, + ], + 45 => [ + 0 => -99, + 1 => 1, + 2 => 100, + ], + 46 => [ + 0 => -999, + 1 => 1, + 2 => 1000, + ], + 47 => [ + 0 => -9999, + 1 => 1, + 2 => 10000, + ], + 48 => [ + 0 => 2, + 1 => 2, + 2 => 0, + ], + 49 => [ + 0 => 3, + 1 => 2, + 2 => -1, + ], + 50 => [ + 0 => 1, + 1 => 2, + 2 => 1, + ], + 51 => [ + 0 => 0, + 1 => 2, + 2 => 2, + ], + 52 => [ + 0 => -1, + 1 => 2, + 2 => 3, + ], + 53 => [ + 0 => -2, + 1 => 2, + 2 => 4, + ], + 54 => [ + 0 => -3, + 1 => 2, + 2 => 5, + ], + 55 => [ + 0 => -4, + 1 => 2, + 2 => 6, + ], + 56 => [ + 0 => -5, + 1 => 2, + 2 => 7, + ], + 57 => [ + 0 => -8, + 1 => 2, + 2 => 10, + ], + 58 => [ + 0 => -18, + 1 => 2, + 2 => 20, + ], + 59 => [ + 0 => -28, + 1 => 2, + 2 => 30, + ], + 60 => [ + 0 => -48, + 1 => 2, + 2 => 50, + ], + 61 => [ + 0 => -98, + 1 => 2, + 2 => 100, + ], + 62 => [ + 0 => -998, + 1 => 2, + 2 => 1000, + ], + 63 => [ + 0 => -9998, + 1 => 2, + 2 => 10000, + ], + 64 => [ + 0 => 3, + 1 => 3, + 2 => 0, + ], + 65 => [ + 0 => 4, + 1 => 3, + 2 => -1, + ], + 66 => [ + 0 => 2, + 1 => 3, + 2 => 1, + ], + 67 => [ + 0 => 1, + 1 => 3, + 2 => 2, + ], + 68 => [ + 0 => 0, + 1 => 3, + 2 => 3, + ], + 69 => [ + 0 => -1, + 1 => 3, + 2 => 4, + ], + 70 => [ + 0 => -2, + 1 => 3, + 2 => 5, + ], + 71 => [ + 0 => -3, + 1 => 3, + 2 => 6, + ], + 72 => [ + 0 => -4, + 1 => 3, + 2 => 7, + ], + 73 => [ + 0 => -7, + 1 => 3, + 2 => 10, + ], + 74 => [ + 0 => -17, + 1 => 3, + 2 => 20, + ], + 75 => [ + 0 => -27, + 1 => 3, + 2 => 30, + ], + 76 => [ + 0 => -47, + 1 => 3, + 2 => 50, + ], + 77 => [ + 0 => -97, + 1 => 3, + 2 => 100, + ], + 78 => [ + 0 => -997, + 1 => 3, + 2 => 1000, + ], + 79 => [ + 0 => -9997, + 1 => 3, + 2 => 10000, + ], + 80 => [ + 0 => 4, + 1 => 4, + 2 => 0, + ], + 81 => [ + 0 => 5, + 1 => 4, + 2 => -1, + ], + 82 => [ + 0 => 3, + 1 => 4, + 2 => 1, + ], + 83 => [ + 0 => 2, + 1 => 4, + 2 => 2, + ], + 84 => [ + 0 => 1, + 1 => 4, + 2 => 3, + ], + 85 => [ + 0 => 0, + 1 => 4, + 2 => 4, + ], + 86 => [ + 0 => -1, + 1 => 4, + 2 => 5, + ], + 87 => [ + 0 => -2, + 1 => 4, + 2 => 6, + ], + 88 => [ + 0 => -3, + 1 => 4, + 2 => 7, + ], + 89 => [ + 0 => -6, + 1 => 4, + 2 => 10, + ], + 90 => [ + 0 => -16, + 1 => 4, + 2 => 20, + ], + 91 => [ + 0 => -26, + 1 => 4, + 2 => 30, + ], + 92 => [ + 0 => -46, + 1 => 4, + 2 => 50, + ], + 93 => [ + 0 => -96, + 1 => 4, + 2 => 100, + ], + 94 => [ + 0 => -996, + 1 => 4, + 2 => 1000, + ], + 95 => [ + 0 => -9996, + 1 => 4, + 2 => 10000, + ], + 96 => [ + 0 => 5, + 1 => 5, + 2 => 0, + ], + 97 => [ + 0 => 6, + 1 => 5, + 2 => -1, + ], + 98 => [ + 0 => 4, + 1 => 5, + 2 => 1, + ], + 99 => [ + 0 => 3, + 1 => 5, + 2 => 2, + ], + 100 => [ + 0 => 2, + 1 => 5, + 2 => 3, + ], + 101 => [ + 0 => 1, + 1 => 5, + 2 => 4, + ], + 102 => [ + 0 => 0, + 1 => 5, + 2 => 5, + ], + 103 => [ + 0 => -1, + 1 => 5, + 2 => 6, + ], + 104 => [ + 0 => -2, + 1 => 5, + 2 => 7, + ], + 105 => [ + 0 => -5, + 1 => 5, + 2 => 10, + ], + 106 => [ + 0 => -15, + 1 => 5, + 2 => 20, + ], + 107 => [ + 0 => -25, + 1 => 5, + 2 => 30, + ], + 108 => [ + 0 => -45, + 1 => 5, + 2 => 50, + ], + 109 => [ + 0 => -95, + 1 => 5, + 2 => 100, + ], + 110 => [ + 0 => -995, + 1 => 5, + 2 => 1000, + ], + 111 => [ + 0 => -9995, + 1 => 5, + 2 => 10000, + ], + 112 => [ + 0 => 6, + 1 => 6, + 2 => 0, + ], + 113 => [ + 0 => 7, + 1 => 6, + 2 => -1, + ], + 114 => [ + 0 => 5, + 1 => 6, + 2 => 1, + ], + 115 => [ + 0 => 4, + 1 => 6, + 2 => 2, + ], + 116 => [ + 0 => 3, + 1 => 6, + 2 => 3, + ], + 117 => [ + 0 => 2, + 1 => 6, + 2 => 4, + ], + 118 => [ + 0 => 1, + 1 => 6, + 2 => 5, + ], + 119 => [ + 0 => 0, + 1 => 6, + 2 => 6, + ], + 120 => [ + 0 => -1, + 1 => 6, + 2 => 7, + ], + 121 => [ + 0 => -4, + 1 => 6, + 2 => 10, + ], + 122 => [ + 0 => -14, + 1 => 6, + 2 => 20, + ], + 123 => [ + 0 => -24, + 1 => 6, + 2 => 30, + ], + 124 => [ + 0 => -44, + 1 => 6, + 2 => 50, + ], + 125 => [ + 0 => -94, + 1 => 6, + 2 => 100, + ], + 126 => [ + 0 => -994, + 1 => 6, + 2 => 1000, + ], + 127 => [ + 0 => -9994, + 1 => 6, + 2 => 10000, + ], + 128 => [ + 0 => 7, + 1 => 7, + 2 => 0, + ], + 129 => [ + 0 => 8, + 1 => 7, + 2 => -1, + ], + 130 => [ + 0 => 6, + 1 => 7, + 2 => 1, + ], + 131 => [ + 0 => 5, + 1 => 7, + 2 => 2, + ], + 132 => [ + 0 => 4, + 1 => 7, + 2 => 3, + ], + 133 => [ + 0 => 3, + 1 => 7, + 2 => 4, + ], + 134 => [ + 0 => 2, + 1 => 7, + 2 => 5, + ], + 135 => [ + 0 => 1, + 1 => 7, + 2 => 6, + ], + 136 => [ + 0 => 0, + 1 => 7, + 2 => 7, + ], + 137 => [ + 0 => -3, + 1 => 7, + 2 => 10, + ], + 138 => [ + 0 => -13, + 1 => 7, + 2 => 20, + ], + 139 => [ + 0 => -23, + 1 => 7, + 2 => 30, + ], + 140 => [ + 0 => -43, + 1 => 7, + 2 => 50, + ], + 141 => [ + 0 => -93, + 1 => 7, + 2 => 100, + ], + 142 => [ + 0 => -993, + 1 => 7, + 2 => 1000, + ], + 143 => [ + 0 => -9993, + 1 => 7, + 2 => 10000, + ], + 144 => [ + 0 => 10, + 1 => 10, + 2 => 0, + ], + 145 => [ + 0 => 11, + 1 => 10, + 2 => -1, + ], + 146 => [ + 0 => 9, + 1 => 10, + 2 => 1, + ], + 147 => [ + 0 => 8, + 1 => 10, + 2 => 2, + ], + 148 => [ + 0 => 7, + 1 => 10, + 2 => 3, + ], + 149 => [ + 0 => 6, + 1 => 10, + 2 => 4, + ], + 150 => [ + 0 => 5, + 1 => 10, + 2 => 5, + ], + 151 => [ + 0 => 4, + 1 => 10, + 2 => 6, + ], + 152 => [ + 0 => 3, + 1 => 10, + 2 => 7, + ], + 153 => [ + 0 => 0, + 1 => 10, + 2 => 10, + ], + 154 => [ + 0 => -10, + 1 => 10, + 2 => 20, + ], + 155 => [ + 0 => -20, + 1 => 10, + 2 => 30, + ], + 156 => [ + 0 => -40, + 1 => 10, + 2 => 50, + ], + 157 => [ + 0 => -90, + 1 => 10, + 2 => 100, + ], + 158 => [ + 0 => -990, + 1 => 10, + 2 => 1000, + ], + 159 => [ + 0 => -9990, + 1 => 10, + 2 => 10000, + ], + 160 => [ + 0 => 20, + 1 => 20, + 2 => 0, + ], + 161 => [ + 0 => 21, + 1 => 20, + 2 => -1, + ], + 162 => [ + 0 => 19, + 1 => 20, + 2 => 1, + ], + 163 => [ + 0 => 18, + 1 => 20, + 2 => 2, + ], + 164 => [ + 0 => 17, + 1 => 20, + 2 => 3, + ], + 165 => [ + 0 => 16, + 1 => 20, + 2 => 4, + ], + 166 => [ + 0 => 15, + 1 => 20, + 2 => 5, + ], + 167 => [ + 0 => 14, + 1 => 20, + 2 => 6, + ], + 168 => [ + 0 => 13, + 1 => 20, + 2 => 7, + ], + 169 => [ + 0 => 10, + 1 => 20, + 2 => 10, + ], + 170 => [ + 0 => 0, + 1 => 20, + 2 => 20, + ], + 171 => [ + 0 => -10, + 1 => 20, + 2 => 30, + ], + 172 => [ + 0 => -30, + 1 => 20, + 2 => 50, + ], + 173 => [ + 0 => -80, + 1 => 20, + 2 => 100, + ], + 174 => [ + 0 => -980, + 1 => 20, + 2 => 1000, + ], + 175 => [ + 0 => -9980, + 1 => 20, + 2 => 10000, + ], + 176 => [ + 0 => 30, + 1 => 30, + 2 => 0, + ], + 177 => [ + 0 => 31, + 1 => 30, + 2 => -1, + ], + 178 => [ + 0 => 29, + 1 => 30, + 2 => 1, + ], + 179 => [ + 0 => 28, + 1 => 30, + 2 => 2, + ], + 180 => [ + 0 => 27, + 1 => 30, + 2 => 3, + ], + 181 => [ + 0 => 26, + 1 => 30, + 2 => 4, + ], + 182 => [ + 0 => 25, + 1 => 30, + 2 => 5, + ], + 183 => [ + 0 => 24, + 1 => 30, + 2 => 6, + ], + 184 => [ + 0 => 23, + 1 => 30, + 2 => 7, + ], + 185 => [ + 0 => 20, + 1 => 30, + 2 => 10, + ], + 186 => [ + 0 => 10, + 1 => 30, + 2 => 20, + ], + 187 => [ + 0 => 0, + 1 => 30, + 2 => 30, + ], + 188 => [ + 0 => -20, + 1 => 30, + 2 => 50, + ], + 189 => [ + 0 => -70, + 1 => 30, + 2 => 100, + ], + 190 => [ + 0 => -970, + 1 => 30, + 2 => 1000, + ], + 191 => [ + 0 => -9970, + 1 => 30, + 2 => 10000, + ], + 192 => [ + 0 => 50, + 1 => 50, + 2 => 0, + ], + 193 => [ + 0 => 51, + 1 => 50, + 2 => -1, + ], + 194 => [ + 0 => 49, + 1 => 50, + 2 => 1, + ], + 195 => [ + 0 => 48, + 1 => 50, + 2 => 2, + ], + 196 => [ + 0 => 47, + 1 => 50, + 2 => 3, + ], + 197 => [ + 0 => 46, + 1 => 50, + 2 => 4, + ], + 198 => [ + 0 => 45, + 1 => 50, + 2 => 5, + ], + 199 => [ + 0 => 44, + 1 => 50, + 2 => 6, + ], + 200 => [ + 0 => 43, + 1 => 50, + 2 => 7, + ], + 201 => [ + 0 => 40, + 1 => 50, + 2 => 10, + ], + 202 => [ + 0 => 30, + 1 => 50, + 2 => 20, + ], + 203 => [ + 0 => 20, + 1 => 50, + 2 => 30, + ], + 204 => [ + 0 => 0, + 1 => 50, + 2 => 50, + ], + 205 => [ + 0 => -50, + 1 => 50, + 2 => 100, + ], + 206 => [ + 0 => -950, + 1 => 50, + 2 => 1000, + ], + 207 => [ + 0 => -9950, + 1 => 50, + 2 => 10000, + ], + 208 => [ + 0 => 100, + 1 => 100, + 2 => 0, + ], + 209 => [ + 0 => 101, + 1 => 100, + 2 => -1, + ], + 210 => [ + 0 => 99, + 1 => 100, + 2 => 1, + ], + 211 => [ + 0 => 98, + 1 => 100, + 2 => 2, + ], + 212 => [ + 0 => 97, + 1 => 100, + 2 => 3, + ], + 213 => [ + 0 => 96, + 1 => 100, + 2 => 4, + ], + 214 => [ + 0 => 95, + 1 => 100, + 2 => 5, + ], + 215 => [ + 0 => 94, + 1 => 100, + 2 => 6, + ], + 216 => [ + 0 => 93, + 1 => 100, + 2 => 7, + ], + 217 => [ + 0 => 90, + 1 => 100, + 2 => 10, + ], + 218 => [ + 0 => 80, + 1 => 100, + 2 => 20, + ], + 219 => [ + 0 => 70, + 1 => 100, + 2 => 30, + ], + 220 => [ + 0 => 50, + 1 => 100, + 2 => 50, + ], + 221 => [ + 0 => 0, + 1 => 100, + 2 => 100, + ], + 222 => [ + 0 => -900, + 1 => 100, + 2 => 1000, + ], + 223 => [ + 0 => -9900, + 1 => 100, + 2 => 10000, + ], + 224 => [ + 0 => 1000, + 1 => 1000, + 2 => 0, + ], + 225 => [ + 0 => 1001, + 1 => 1000, + 2 => -1, + ], + 226 => [ + 0 => 999, + 1 => 1000, + 2 => 1, + ], + 227 => [ + 0 => 998, + 1 => 1000, + 2 => 2, + ], + 228 => [ + 0 => 997, + 1 => 1000, + 2 => 3, + ], + 229 => [ + 0 => 996, + 1 => 1000, + 2 => 4, + ], + 230 => [ + 0 => 995, + 1 => 1000, + 2 => 5, + ], + 231 => [ + 0 => 994, + 1 => 1000, + 2 => 6, + ], + 232 => [ + 0 => 993, + 1 => 1000, + 2 => 7, + ], + 233 => [ + 0 => 990, + 1 => 1000, + 2 => 10, + ], + 234 => [ + 0 => 980, + 1 => 1000, + 2 => 20, + ], + 235 => [ + 0 => 970, + 1 => 1000, + 2 => 30, + ], + 236 => [ + 0 => 950, + 1 => 1000, + 2 => 50, + ], + 237 => [ + 0 => 900, + 1 => 1000, + 2 => 100, + ], + 238 => [ + 0 => 0, + 1 => 1000, + 2 => 1000, + ], + 239 => [ + 0 => -9000, + 1 => 1000, + 2 => 10000, + ], + 240 => [ + 0 => 10000, + 1 => 10000, + 2 => 0, + ], + 241 => [ + 0 => 10001, + 1 => 10000, + 2 => -1, + ], + 242 => [ + 0 => 9999, + 1 => 10000, + 2 => 1, + ], + 243 => [ + 0 => 9998, + 1 => 10000, + 2 => 2, + ], + 244 => [ + 0 => 9997, + 1 => 10000, + 2 => 3, + ], + 245 => [ + 0 => 9996, + 1 => 10000, + 2 => 4, + ], + 246 => [ + 0 => 9995, + 1 => 10000, + 2 => 5, + ], + 247 => [ + 0 => 9994, + 1 => 10000, + 2 => 6, + ], + 248 => [ + 0 => 9993, + 1 => 10000, + 2 => 7, + ], + 249 => [ + 0 => 9990, + 1 => 10000, + 2 => 10, + ], + 250 => [ + 0 => 9980, + 1 => 10000, + 2 => 20, + ], + 251 => [ + 0 => 9970, + 1 => 10000, + 2 => 30, + ], + 252 => [ + 0 => 9950, + 1 => 10000, + 2 => 50, + ], + 253 => [ + 0 => 9900, + 1 => 10000, + 2 => 100, + ], + 254 => [ + 0 => 9000, + 1 => 10000, + 2 => 1000, + ], + 255 => [ + 0 => 0, + 1 => 10000, + 2 => 10000, + ], + ]; + } +} diff --git a/tests/tests/Filtre/MultTest.php b/tests/tests/Filtre/MultTest.php new file mode 100644 index 0000000000..743d1bfdca --- /dev/null +++ b/tests/tests/Filtre/MultTest.php @@ -0,0 +1,1314 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction mult du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class MultTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresMult + */ + public function testFiltresMult($expected, ...$args): void + { + $actual = mult(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresMult(): array + { + return [ + 0 => [ + 0 => 0, + 1 => 0, + 2 => 0, + ], + 1 => [ + 0 => 0, + 1 => 0, + 2 => -1, + ], + 2 => [ + 0 => 0, + 1 => 0, + 2 => 1, + ], + 3 => [ + 0 => 0, + 1 => 0, + 2 => 2, + ], + 4 => [ + 0 => 0, + 1 => 0, + 2 => 3, + ], + 5 => [ + 0 => 0, + 1 => 0, + 2 => 4, + ], + 6 => [ + 0 => 0, + 1 => 0, + 2 => 5, + ], + 7 => [ + 0 => 0, + 1 => 0, + 2 => 6, + ], + 8 => [ + 0 => 0, + 1 => 0, + 2 => 7, + ], + 9 => [ + 0 => 0, + 1 => 0, + 2 => 10, + ], + 10 => [ + 0 => 0, + 1 => 0, + 2 => 20, + ], + 11 => [ + 0 => 0, + 1 => 0, + 2 => 30, + ], + 12 => [ + 0 => 0, + 1 => 0, + 2 => 50, + ], + 13 => [ + 0 => 0, + 1 => 0, + 2 => 100, + ], + 14 => [ + 0 => 0, + 1 => 0, + 2 => 1000, + ], + 15 => [ + 0 => 0, + 1 => 0, + 2 => 10000, + ], + 16 => [ + 0 => 0, + 1 => -1, + 2 => 0, + ], + 17 => [ + 0 => 1, + 1 => -1, + 2 => -1, + ], + 18 => [ + 0 => -1, + 1 => -1, + 2 => 1, + ], + 19 => [ + 0 => -2, + 1 => -1, + 2 => 2, + ], + 20 => [ + 0 => -3, + 1 => -1, + 2 => 3, + ], + 21 => [ + 0 => -4, + 1 => -1, + 2 => 4, + ], + 22 => [ + 0 => -5, + 1 => -1, + 2 => 5, + ], + 23 => [ + 0 => -6, + 1 => -1, + 2 => 6, + ], + 24 => [ + 0 => -7, + 1 => -1, + 2 => 7, + ], + 25 => [ + 0 => -10, + 1 => -1, + 2 => 10, + ], + 26 => [ + 0 => -20, + 1 => -1, + 2 => 20, + ], + 27 => [ + 0 => -30, + 1 => -1, + 2 => 30, + ], + 28 => [ + 0 => -50, + 1 => -1, + 2 => 50, + ], + 29 => [ + 0 => -100, + 1 => -1, + 2 => 100, + ], + 30 => [ + 0 => -1000, + 1 => -1, + 2 => 1000, + ], + 31 => [ + 0 => -10000, + 1 => -1, + 2 => 10000, + ], + 32 => [ + 0 => 0, + 1 => 1, + 2 => 0, + ], + 33 => [ + 0 => -1, + 1 => 1, + 2 => -1, + ], + 34 => [ + 0 => 1, + 1 => 1, + 2 => 1, + ], + 35 => [ + 0 => 2, + 1 => 1, + 2 => 2, + ], + 36 => [ + 0 => 3, + 1 => 1, + 2 => 3, + ], + 37 => [ + 0 => 4, + 1 => 1, + 2 => 4, + ], + 38 => [ + 0 => 5, + 1 => 1, + 2 => 5, + ], + 39 => [ + 0 => 6, + 1 => 1, + 2 => 6, + ], + 40 => [ + 0 => 7, + 1 => 1, + 2 => 7, + ], + 41 => [ + 0 => 10, + 1 => 1, + 2 => 10, + ], + 42 => [ + 0 => 20, + 1 => 1, + 2 => 20, + ], + 43 => [ + 0 => 30, + 1 => 1, + 2 => 30, + ], + 44 => [ + 0 => 50, + 1 => 1, + 2 => 50, + ], + 45 => [ + 0 => 100, + 1 => 1, + 2 => 100, + ], + 46 => [ + 0 => 1000, + 1 => 1, + 2 => 1000, + ], + 47 => [ + 0 => 10000, + 1 => 1, + 2 => 10000, + ], + 48 => [ + 0 => 0, + 1 => 2, + 2 => 0, + ], + 49 => [ + 0 => -2, + 1 => 2, + 2 => -1, + ], + 50 => [ + 0 => 2, + 1 => 2, + 2 => 1, + ], + 51 => [ + 0 => 4, + 1 => 2, + 2 => 2, + ], + 52 => [ + 0 => 6, + 1 => 2, + 2 => 3, + ], + 53 => [ + 0 => 8, + 1 => 2, + 2 => 4, + ], + 54 => [ + 0 => 10, + 1 => 2, + 2 => 5, + ], + 55 => [ + 0 => 12, + 1 => 2, + 2 => 6, + ], + 56 => [ + 0 => 14, + 1 => 2, + 2 => 7, + ], + 57 => [ + 0 => 20, + 1 => 2, + 2 => 10, + ], + 58 => [ + 0 => 40, + 1 => 2, + 2 => 20, + ], + 59 => [ + 0 => 60, + 1 => 2, + 2 => 30, + ], + 60 => [ + 0 => 100, + 1 => 2, + 2 => 50, + ], + 61 => [ + 0 => 200, + 1 => 2, + 2 => 100, + ], + 62 => [ + 0 => 2000, + 1 => 2, + 2 => 1000, + ], + 63 => [ + 0 => 20000, + 1 => 2, + 2 => 10000, + ], + 64 => [ + 0 => 0, + 1 => 3, + 2 => 0, + ], + 65 => [ + 0 => -3, + 1 => 3, + 2 => -1, + ], + 66 => [ + 0 => 3, + 1 => 3, + 2 => 1, + ], + 67 => [ + 0 => 6, + 1 => 3, + 2 => 2, + ], + 68 => [ + 0 => 9, + 1 => 3, + 2 => 3, + ], + 69 => [ + 0 => 12, + 1 => 3, + 2 => 4, + ], + 70 => [ + 0 => 15, + 1 => 3, + 2 => 5, + ], + 71 => [ + 0 => 18, + 1 => 3, + 2 => 6, + ], + 72 => [ + 0 => 21, + 1 => 3, + 2 => 7, + ], + 73 => [ + 0 => 30, + 1 => 3, + 2 => 10, + ], + 74 => [ + 0 => 60, + 1 => 3, + 2 => 20, + ], + 75 => [ + 0 => 90, + 1 => 3, + 2 => 30, + ], + 76 => [ + 0 => 150, + 1 => 3, + 2 => 50, + ], + 77 => [ + 0 => 300, + 1 => 3, + 2 => 100, + ], + 78 => [ + 0 => 3000, + 1 => 3, + 2 => 1000, + ], + 79 => [ + 0 => 30000, + 1 => 3, + 2 => 10000, + ], + 80 => [ + 0 => 0, + 1 => 4, + 2 => 0, + ], + 81 => [ + 0 => -4, + 1 => 4, + 2 => -1, + ], + 82 => [ + 0 => 4, + 1 => 4, + 2 => 1, + ], + 83 => [ + 0 => 8, + 1 => 4, + 2 => 2, + ], + 84 => [ + 0 => 12, + 1 => 4, + 2 => 3, + ], + 85 => [ + 0 => 16, + 1 => 4, + 2 => 4, + ], + 86 => [ + 0 => 20, + 1 => 4, + 2 => 5, + ], + 87 => [ + 0 => 24, + 1 => 4, + 2 => 6, + ], + 88 => [ + 0 => 28, + 1 => 4, + 2 => 7, + ], + 89 => [ + 0 => 40, + 1 => 4, + 2 => 10, + ], + 90 => [ + 0 => 80, + 1 => 4, + 2 => 20, + ], + 91 => [ + 0 => 120, + 1 => 4, + 2 => 30, + ], + 92 => [ + 0 => 200, + 1 => 4, + 2 => 50, + ], + 93 => [ + 0 => 400, + 1 => 4, + 2 => 100, + ], + 94 => [ + 0 => 4000, + 1 => 4, + 2 => 1000, + ], + 95 => [ + 0 => 40000, + 1 => 4, + 2 => 10000, + ], + 96 => [ + 0 => 0, + 1 => 5, + 2 => 0, + ], + 97 => [ + 0 => -5, + 1 => 5, + 2 => -1, + ], + 98 => [ + 0 => 5, + 1 => 5, + 2 => 1, + ], + 99 => [ + 0 => 10, + 1 => 5, + 2 => 2, + ], + 100 => [ + 0 => 15, + 1 => 5, + 2 => 3, + ], + 101 => [ + 0 => 20, + 1 => 5, + 2 => 4, + ], + 102 => [ + 0 => 25, + 1 => 5, + 2 => 5, + ], + 103 => [ + 0 => 30, + 1 => 5, + 2 => 6, + ], + 104 => [ + 0 => 35, + 1 => 5, + 2 => 7, + ], + 105 => [ + 0 => 50, + 1 => 5, + 2 => 10, + ], + 106 => [ + 0 => 100, + 1 => 5, + 2 => 20, + ], + 107 => [ + 0 => 150, + 1 => 5, + 2 => 30, + ], + 108 => [ + 0 => 250, + 1 => 5, + 2 => 50, + ], + 109 => [ + 0 => 500, + 1 => 5, + 2 => 100, + ], + 110 => [ + 0 => 5000, + 1 => 5, + 2 => 1000, + ], + 111 => [ + 0 => 50000, + 1 => 5, + 2 => 10000, + ], + 112 => [ + 0 => 0, + 1 => 6, + 2 => 0, + ], + 113 => [ + 0 => -6, + 1 => 6, + 2 => -1, + ], + 114 => [ + 0 => 6, + 1 => 6, + 2 => 1, + ], + 115 => [ + 0 => 12, + 1 => 6, + 2 => 2, + ], + 116 => [ + 0 => 18, + 1 => 6, + 2 => 3, + ], + 117 => [ + 0 => 24, + 1 => 6, + 2 => 4, + ], + 118 => [ + 0 => 30, + 1 => 6, + 2 => 5, + ], + 119 => [ + 0 => 36, + 1 => 6, + 2 => 6, + ], + 120 => [ + 0 => 42, + 1 => 6, + 2 => 7, + ], + 121 => [ + 0 => 60, + 1 => 6, + 2 => 10, + ], + 122 => [ + 0 => 120, + 1 => 6, + 2 => 20, + ], + 123 => [ + 0 => 180, + 1 => 6, + 2 => 30, + ], + 124 => [ + 0 => 300, + 1 => 6, + 2 => 50, + ], + 125 => [ + 0 => 600, + 1 => 6, + 2 => 100, + ], + 126 => [ + 0 => 6000, + 1 => 6, + 2 => 1000, + ], + 127 => [ + 0 => 60000, + 1 => 6, + 2 => 10000, + ], + 128 => [ + 0 => 0, + 1 => 7, + 2 => 0, + ], + 129 => [ + 0 => -7, + 1 => 7, + 2 => -1, + ], + 130 => [ + 0 => 7, + 1 => 7, + 2 => 1, + ], + 131 => [ + 0 => 14, + 1 => 7, + 2 => 2, + ], + 132 => [ + 0 => 21, + 1 => 7, + 2 => 3, + ], + 133 => [ + 0 => 28, + 1 => 7, + 2 => 4, + ], + 134 => [ + 0 => 35, + 1 => 7, + 2 => 5, + ], + 135 => [ + 0 => 42, + 1 => 7, + 2 => 6, + ], + 136 => [ + 0 => 49, + 1 => 7, + 2 => 7, + ], + 137 => [ + 0 => 70, + 1 => 7, + 2 => 10, + ], + 138 => [ + 0 => 140, + 1 => 7, + 2 => 20, + ], + 139 => [ + 0 => 210, + 1 => 7, + 2 => 30, + ], + 140 => [ + 0 => 350, + 1 => 7, + 2 => 50, + ], + 141 => [ + 0 => 700, + 1 => 7, + 2 => 100, + ], + 142 => [ + 0 => 7000, + 1 => 7, + 2 => 1000, + ], + 143 => [ + 0 => 70000, + 1 => 7, + 2 => 10000, + ], + 144 => [ + 0 => 0, + 1 => 10, + 2 => 0, + ], + 145 => [ + 0 => -10, + 1 => 10, + 2 => -1, + ], + 146 => [ + 0 => 10, + 1 => 10, + 2 => 1, + ], + 147 => [ + 0 => 20, + 1 => 10, + 2 => 2, + ], + 148 => [ + 0 => 30, + 1 => 10, + 2 => 3, + ], + 149 => [ + 0 => 40, + 1 => 10, + 2 => 4, + ], + 150 => [ + 0 => 50, + 1 => 10, + 2 => 5, + ], + 151 => [ + 0 => 60, + 1 => 10, + 2 => 6, + ], + 152 => [ + 0 => 70, + 1 => 10, + 2 => 7, + ], + 153 => [ + 0 => 100, + 1 => 10, + 2 => 10, + ], + 154 => [ + 0 => 200, + 1 => 10, + 2 => 20, + ], + 155 => [ + 0 => 300, + 1 => 10, + 2 => 30, + ], + 156 => [ + 0 => 500, + 1 => 10, + 2 => 50, + ], + 157 => [ + 0 => 1000, + 1 => 10, + 2 => 100, + ], + 158 => [ + 0 => 10000, + 1 => 10, + 2 => 1000, + ], + 159 => [ + 0 => 100000, + 1 => 10, + 2 => 10000, + ], + 160 => [ + 0 => 0, + 1 => 20, + 2 => 0, + ], + 161 => [ + 0 => -20, + 1 => 20, + 2 => -1, + ], + 162 => [ + 0 => 20, + 1 => 20, + 2 => 1, + ], + 163 => [ + 0 => 40, + 1 => 20, + 2 => 2, + ], + 164 => [ + 0 => 60, + 1 => 20, + 2 => 3, + ], + 165 => [ + 0 => 80, + 1 => 20, + 2 => 4, + ], + 166 => [ + 0 => 100, + 1 => 20, + 2 => 5, + ], + 167 => [ + 0 => 120, + 1 => 20, + 2 => 6, + ], + 168 => [ + 0 => 140, + 1 => 20, + 2 => 7, + ], + 169 => [ + 0 => 200, + 1 => 20, + 2 => 10, + ], + 170 => [ + 0 => 400, + 1 => 20, + 2 => 20, + ], + 171 => [ + 0 => 600, + 1 => 20, + 2 => 30, + ], + 172 => [ + 0 => 1000, + 1 => 20, + 2 => 50, + ], + 173 => [ + 0 => 2000, + 1 => 20, + 2 => 100, + ], + 174 => [ + 0 => 20000, + 1 => 20, + 2 => 1000, + ], + 175 => [ + 0 => 200000, + 1 => 20, + 2 => 10000, + ], + 176 => [ + 0 => 0, + 1 => 30, + 2 => 0, + ], + 177 => [ + 0 => -30, + 1 => 30, + 2 => -1, + ], + 178 => [ + 0 => 30, + 1 => 30, + 2 => 1, + ], + 179 => [ + 0 => 60, + 1 => 30, + 2 => 2, + ], + 180 => [ + 0 => 90, + 1 => 30, + 2 => 3, + ], + 181 => [ + 0 => 120, + 1 => 30, + 2 => 4, + ], + 182 => [ + 0 => 150, + 1 => 30, + 2 => 5, + ], + 183 => [ + 0 => 180, + 1 => 30, + 2 => 6, + ], + 184 => [ + 0 => 210, + 1 => 30, + 2 => 7, + ], + 185 => [ + 0 => 300, + 1 => 30, + 2 => 10, + ], + 186 => [ + 0 => 600, + 1 => 30, + 2 => 20, + ], + 187 => [ + 0 => 900, + 1 => 30, + 2 => 30, + ], + 188 => [ + 0 => 1500, + 1 => 30, + 2 => 50, + ], + 189 => [ + 0 => 3000, + 1 => 30, + 2 => 100, + ], + 190 => [ + 0 => 30000, + 1 => 30, + 2 => 1000, + ], + 191 => [ + 0 => 300000, + 1 => 30, + 2 => 10000, + ], + 192 => [ + 0 => 0, + 1 => 50, + 2 => 0, + ], + 193 => [ + 0 => -50, + 1 => 50, + 2 => -1, + ], + 194 => [ + 0 => 50, + 1 => 50, + 2 => 1, + ], + 195 => [ + 0 => 100, + 1 => 50, + 2 => 2, + ], + 196 => [ + 0 => 150, + 1 => 50, + 2 => 3, + ], + 197 => [ + 0 => 200, + 1 => 50, + 2 => 4, + ], + 198 => [ + 0 => 250, + 1 => 50, + 2 => 5, + ], + 199 => [ + 0 => 300, + 1 => 50, + 2 => 6, + ], + 200 => [ + 0 => 350, + 1 => 50, + 2 => 7, + ], + 201 => [ + 0 => 500, + 1 => 50, + 2 => 10, + ], + 202 => [ + 0 => 1000, + 1 => 50, + 2 => 20, + ], + 203 => [ + 0 => 1500, + 1 => 50, + 2 => 30, + ], + 204 => [ + 0 => 2500, + 1 => 50, + 2 => 50, + ], + 205 => [ + 0 => 5000, + 1 => 50, + 2 => 100, + ], + 206 => [ + 0 => 50000, + 1 => 50, + 2 => 1000, + ], + 207 => [ + 0 => 500000, + 1 => 50, + 2 => 10000, + ], + 208 => [ + 0 => 0, + 1 => 100, + 2 => 0, + ], + 209 => [ + 0 => -100, + 1 => 100, + 2 => -1, + ], + 210 => [ + 0 => 100, + 1 => 100, + 2 => 1, + ], + 211 => [ + 0 => 200, + 1 => 100, + 2 => 2, + ], + 212 => [ + 0 => 300, + 1 => 100, + 2 => 3, + ], + 213 => [ + 0 => 400, + 1 => 100, + 2 => 4, + ], + 214 => [ + 0 => 500, + 1 => 100, + 2 => 5, + ], + 215 => [ + 0 => 600, + 1 => 100, + 2 => 6, + ], + 216 => [ + 0 => 700, + 1 => 100, + 2 => 7, + ], + 217 => [ + 0 => 1000, + 1 => 100, + 2 => 10, + ], + 218 => [ + 0 => 2000, + 1 => 100, + 2 => 20, + ], + 219 => [ + 0 => 3000, + 1 => 100, + 2 => 30, + ], + 220 => [ + 0 => 5000, + 1 => 100, + 2 => 50, + ], + 221 => [ + 0 => 10000, + 1 => 100, + 2 => 100, + ], + 222 => [ + 0 => 100000, + 1 => 100, + 2 => 1000, + ], + 223 => [ + 0 => 1000000, + 1 => 100, + 2 => 10000, + ], + 224 => [ + 0 => 0, + 1 => 1000, + 2 => 0, + ], + 225 => [ + 0 => -1000, + 1 => 1000, + 2 => -1, + ], + 226 => [ + 0 => 1000, + 1 => 1000, + 2 => 1, + ], + 227 => [ + 0 => 2000, + 1 => 1000, + 2 => 2, + ], + 228 => [ + 0 => 3000, + 1 => 1000, + 2 => 3, + ], + 229 => [ + 0 => 4000, + 1 => 1000, + 2 => 4, + ], + 230 => [ + 0 => 5000, + 1 => 1000, + 2 => 5, + ], + 231 => [ + 0 => 6000, + 1 => 1000, + 2 => 6, + ], + 232 => [ + 0 => 7000, + 1 => 1000, + 2 => 7, + ], + 233 => [ + 0 => 10000, + 1 => 1000, + 2 => 10, + ], + 234 => [ + 0 => 20000, + 1 => 1000, + 2 => 20, + ], + 235 => [ + 0 => 30000, + 1 => 1000, + 2 => 30, + ], + 236 => [ + 0 => 50000, + 1 => 1000, + 2 => 50, + ], + 237 => [ + 0 => 100000, + 1 => 1000, + 2 => 100, + ], + 238 => [ + 0 => 1000000, + 1 => 1000, + 2 => 1000, + ], + 239 => [ + 0 => 10000000, + 1 => 1000, + 2 => 10000, + ], + 240 => [ + 0 => 0, + 1 => 10000, + 2 => 0, + ], + 241 => [ + 0 => -10000, + 1 => 10000, + 2 => -1, + ], + 242 => [ + 0 => 10000, + 1 => 10000, + 2 => 1, + ], + 243 => [ + 0 => 20000, + 1 => 10000, + 2 => 2, + ], + 244 => [ + 0 => 30000, + 1 => 10000, + 2 => 3, + ], + 245 => [ + 0 => 40000, + 1 => 10000, + 2 => 4, + ], + 246 => [ + 0 => 50000, + 1 => 10000, + 2 => 5, + ], + 247 => [ + 0 => 60000, + 1 => 10000, + 2 => 6, + ], + 248 => [ + 0 => 70000, + 1 => 10000, + 2 => 7, + ], + 249 => [ + 0 => 100000, + 1 => 10000, + 2 => 10, + ], + 250 => [ + 0 => 200000, + 1 => 10000, + 2 => 20, + ], + 251 => [ + 0 => 300000, + 1 => 10000, + 2 => 30, + ], + 252 => [ + 0 => 500000, + 1 => 10000, + 2 => 50, + ], + 253 => [ + 0 => 1000000, + 1 => 10000, + 2 => 100, + ], + 254 => [ + 0 => 10000000, + 1 => 10000, + 2 => 1000, + ], + 255 => [ + 0 => 100000000, + 1 => 10000, + 2 => 10000, + ], + ]; + } +} diff --git a/tests/tests/Filtre/PlusTest.php b/tests/tests/Filtre/PlusTest.php new file mode 100644 index 0000000000..57fda685c2 --- /dev/null +++ b/tests/tests/Filtre/PlusTest.php @@ -0,0 +1,1314 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction plus du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class PlusTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresPlus + */ + public function testFiltresPlus($expected, ...$args): void + { + $actual = plus(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresPlus(): array + { + return [ + 0 => [ + 0 => 0, + 1 => 0, + 2 => 0, + ], + 1 => [ + 0 => -1, + 1 => 0, + 2 => -1, + ], + 2 => [ + 0 => 1, + 1 => 0, + 2 => 1, + ], + 3 => [ + 0 => 2, + 1 => 0, + 2 => 2, + ], + 4 => [ + 0 => 3, + 1 => 0, + 2 => 3, + ], + 5 => [ + 0 => 4, + 1 => 0, + 2 => 4, + ], + 6 => [ + 0 => 5, + 1 => 0, + 2 => 5, + ], + 7 => [ + 0 => 6, + 1 => 0, + 2 => 6, + ], + 8 => [ + 0 => 7, + 1 => 0, + 2 => 7, + ], + 9 => [ + 0 => 10, + 1 => 0, + 2 => 10, + ], + 10 => [ + 0 => 20, + 1 => 0, + 2 => 20, + ], + 11 => [ + 0 => 30, + 1 => 0, + 2 => 30, + ], + 12 => [ + 0 => 50, + 1 => 0, + 2 => 50, + ], + 13 => [ + 0 => 100, + 1 => 0, + 2 => 100, + ], + 14 => [ + 0 => 1000, + 1 => 0, + 2 => 1000, + ], + 15 => [ + 0 => 10000, + 1 => 0, + 2 => 10000, + ], + 16 => [ + 0 => -1, + 1 => -1, + 2 => 0, + ], + 17 => [ + 0 => -2, + 1 => -1, + 2 => -1, + ], + 18 => [ + 0 => 0, + 1 => -1, + 2 => 1, + ], + 19 => [ + 0 => 1, + 1 => -1, + 2 => 2, + ], + 20 => [ + 0 => 2, + 1 => -1, + 2 => 3, + ], + 21 => [ + 0 => 3, + 1 => -1, + 2 => 4, + ], + 22 => [ + 0 => 4, + 1 => -1, + 2 => 5, + ], + 23 => [ + 0 => 5, + 1 => -1, + 2 => 6, + ], + 24 => [ + 0 => 6, + 1 => -1, + 2 => 7, + ], + 25 => [ + 0 => 9, + 1 => -1, + 2 => 10, + ], + 26 => [ + 0 => 19, + 1 => -1, + 2 => 20, + ], + 27 => [ + 0 => 29, + 1 => -1, + 2 => 30, + ], + 28 => [ + 0 => 49, + 1 => -1, + 2 => 50, + ], + 29 => [ + 0 => 99, + 1 => -1, + 2 => 100, + ], + 30 => [ + 0 => 999, + 1 => -1, + 2 => 1000, + ], + 31 => [ + 0 => 9999, + 1 => -1, + 2 => 10000, + ], + 32 => [ + 0 => 1, + 1 => 1, + 2 => 0, + ], + 33 => [ + 0 => 0, + 1 => 1, + 2 => -1, + ], + 34 => [ + 0 => 2, + 1 => 1, + 2 => 1, + ], + 35 => [ + 0 => 3, + 1 => 1, + 2 => 2, + ], + 36 => [ + 0 => 4, + 1 => 1, + 2 => 3, + ], + 37 => [ + 0 => 5, + 1 => 1, + 2 => 4, + ], + 38 => [ + 0 => 6, + 1 => 1, + 2 => 5, + ], + 39 => [ + 0 => 7, + 1 => 1, + 2 => 6, + ], + 40 => [ + 0 => 8, + 1 => 1, + 2 => 7, + ], + 41 => [ + 0 => 11, + 1 => 1, + 2 => 10, + ], + 42 => [ + 0 => 21, + 1 => 1, + 2 => 20, + ], + 43 => [ + 0 => 31, + 1 => 1, + 2 => 30, + ], + 44 => [ + 0 => 51, + 1 => 1, + 2 => 50, + ], + 45 => [ + 0 => 101, + 1 => 1, + 2 => 100, + ], + 46 => [ + 0 => 1001, + 1 => 1, + 2 => 1000, + ], + 47 => [ + 0 => 10001, + 1 => 1, + 2 => 10000, + ], + 48 => [ + 0 => 2, + 1 => 2, + 2 => 0, + ], + 49 => [ + 0 => 1, + 1 => 2, + 2 => -1, + ], + 50 => [ + 0 => 3, + 1 => 2, + 2 => 1, + ], + 51 => [ + 0 => 4, + 1 => 2, + 2 => 2, + ], + 52 => [ + 0 => 5, + 1 => 2, + 2 => 3, + ], + 53 => [ + 0 => 6, + 1 => 2, + 2 => 4, + ], + 54 => [ + 0 => 7, + 1 => 2, + 2 => 5, + ], + 55 => [ + 0 => 8, + 1 => 2, + 2 => 6, + ], + 56 => [ + 0 => 9, + 1 => 2, + 2 => 7, + ], + 57 => [ + 0 => 12, + 1 => 2, + 2 => 10, + ], + 58 => [ + 0 => 22, + 1 => 2, + 2 => 20, + ], + 59 => [ + 0 => 32, + 1 => 2, + 2 => 30, + ], + 60 => [ + 0 => 52, + 1 => 2, + 2 => 50, + ], + 61 => [ + 0 => 102, + 1 => 2, + 2 => 100, + ], + 62 => [ + 0 => 1002, + 1 => 2, + 2 => 1000, + ], + 63 => [ + 0 => 10002, + 1 => 2, + 2 => 10000, + ], + 64 => [ + 0 => 3, + 1 => 3, + 2 => 0, + ], + 65 => [ + 0 => 2, + 1 => 3, + 2 => -1, + ], + 66 => [ + 0 => 4, + 1 => 3, + 2 => 1, + ], + 67 => [ + 0 => 5, + 1 => 3, + 2 => 2, + ], + 68 => [ + 0 => 6, + 1 => 3, + 2 => 3, + ], + 69 => [ + 0 => 7, + 1 => 3, + 2 => 4, + ], + 70 => [ + 0 => 8, + 1 => 3, + 2 => 5, + ], + 71 => [ + 0 => 9, + 1 => 3, + 2 => 6, + ], + 72 => [ + 0 => 10, + 1 => 3, + 2 => 7, + ], + 73 => [ + 0 => 13, + 1 => 3, + 2 => 10, + ], + 74 => [ + 0 => 23, + 1 => 3, + 2 => 20, + ], + 75 => [ + 0 => 33, + 1 => 3, + 2 => 30, + ], + 76 => [ + 0 => 53, + 1 => 3, + 2 => 50, + ], + 77 => [ + 0 => 103, + 1 => 3, + 2 => 100, + ], + 78 => [ + 0 => 1003, + 1 => 3, + 2 => 1000, + ], + 79 => [ + 0 => 10003, + 1 => 3, + 2 => 10000, + ], + 80 => [ + 0 => 4, + 1 => 4, + 2 => 0, + ], + 81 => [ + 0 => 3, + 1 => 4, + 2 => -1, + ], + 82 => [ + 0 => 5, + 1 => 4, + 2 => 1, + ], + 83 => [ + 0 => 6, + 1 => 4, + 2 => 2, + ], + 84 => [ + 0 => 7, + 1 => 4, + 2 => 3, + ], + 85 => [ + 0 => 8, + 1 => 4, + 2 => 4, + ], + 86 => [ + 0 => 9, + 1 => 4, + 2 => 5, + ], + 87 => [ + 0 => 10, + 1 => 4, + 2 => 6, + ], + 88 => [ + 0 => 11, + 1 => 4, + 2 => 7, + ], + 89 => [ + 0 => 14, + 1 => 4, + 2 => 10, + ], + 90 => [ + 0 => 24, + 1 => 4, + 2 => 20, + ], + 91 => [ + 0 => 34, + 1 => 4, + 2 => 30, + ], + 92 => [ + 0 => 54, + 1 => 4, + 2 => 50, + ], + 93 => [ + 0 => 104, + 1 => 4, + 2 => 100, + ], + 94 => [ + 0 => 1004, + 1 => 4, + 2 => 1000, + ], + 95 => [ + 0 => 10004, + 1 => 4, + 2 => 10000, + ], + 96 => [ + 0 => 5, + 1 => 5, + 2 => 0, + ], + 97 => [ + 0 => 4, + 1 => 5, + 2 => -1, + ], + 98 => [ + 0 => 6, + 1 => 5, + 2 => 1, + ], + 99 => [ + 0 => 7, + 1 => 5, + 2 => 2, + ], + 100 => [ + 0 => 8, + 1 => 5, + 2 => 3, + ], + 101 => [ + 0 => 9, + 1 => 5, + 2 => 4, + ], + 102 => [ + 0 => 10, + 1 => 5, + 2 => 5, + ], + 103 => [ + 0 => 11, + 1 => 5, + 2 => 6, + ], + 104 => [ + 0 => 12, + 1 => 5, + 2 => 7, + ], + 105 => [ + 0 => 15, + 1 => 5, + 2 => 10, + ], + 106 => [ + 0 => 25, + 1 => 5, + 2 => 20, + ], + 107 => [ + 0 => 35, + 1 => 5, + 2 => 30, + ], + 108 => [ + 0 => 55, + 1 => 5, + 2 => 50, + ], + 109 => [ + 0 => 105, + 1 => 5, + 2 => 100, + ], + 110 => [ + 0 => 1005, + 1 => 5, + 2 => 1000, + ], + 111 => [ + 0 => 10005, + 1 => 5, + 2 => 10000, + ], + 112 => [ + 0 => 6, + 1 => 6, + 2 => 0, + ], + 113 => [ + 0 => 5, + 1 => 6, + 2 => -1, + ], + 114 => [ + 0 => 7, + 1 => 6, + 2 => 1, + ], + 115 => [ + 0 => 8, + 1 => 6, + 2 => 2, + ], + 116 => [ + 0 => 9, + 1 => 6, + 2 => 3, + ], + 117 => [ + 0 => 10, + 1 => 6, + 2 => 4, + ], + 118 => [ + 0 => 11, + 1 => 6, + 2 => 5, + ], + 119 => [ + 0 => 12, + 1 => 6, + 2 => 6, + ], + 120 => [ + 0 => 13, + 1 => 6, + 2 => 7, + ], + 121 => [ + 0 => 16, + 1 => 6, + 2 => 10, + ], + 122 => [ + 0 => 26, + 1 => 6, + 2 => 20, + ], + 123 => [ + 0 => 36, + 1 => 6, + 2 => 30, + ], + 124 => [ + 0 => 56, + 1 => 6, + 2 => 50, + ], + 125 => [ + 0 => 106, + 1 => 6, + 2 => 100, + ], + 126 => [ + 0 => 1006, + 1 => 6, + 2 => 1000, + ], + 127 => [ + 0 => 10006, + 1 => 6, + 2 => 10000, + ], + 128 => [ + 0 => 7, + 1 => 7, + 2 => 0, + ], + 129 => [ + 0 => 6, + 1 => 7, + 2 => -1, + ], + 130 => [ + 0 => 8, + 1 => 7, + 2 => 1, + ], + 131 => [ + 0 => 9, + 1 => 7, + 2 => 2, + ], + 132 => [ + 0 => 10, + 1 => 7, + 2 => 3, + ], + 133 => [ + 0 => 11, + 1 => 7, + 2 => 4, + ], + 134 => [ + 0 => 12, + 1 => 7, + 2 => 5, + ], + 135 => [ + 0 => 13, + 1 => 7, + 2 => 6, + ], + 136 => [ + 0 => 14, + 1 => 7, + 2 => 7, + ], + 137 => [ + 0 => 17, + 1 => 7, + 2 => 10, + ], + 138 => [ + 0 => 27, + 1 => 7, + 2 => 20, + ], + 139 => [ + 0 => 37, + 1 => 7, + 2 => 30, + ], + 140 => [ + 0 => 57, + 1 => 7, + 2 => 50, + ], + 141 => [ + 0 => 107, + 1 => 7, + 2 => 100, + ], + 142 => [ + 0 => 1007, + 1 => 7, + 2 => 1000, + ], + 143 => [ + 0 => 10007, + 1 => 7, + 2 => 10000, + ], + 144 => [ + 0 => 10, + 1 => 10, + 2 => 0, + ], + 145 => [ + 0 => 9, + 1 => 10, + 2 => -1, + ], + 146 => [ + 0 => 11, + 1 => 10, + 2 => 1, + ], + 147 => [ + 0 => 12, + 1 => 10, + 2 => 2, + ], + 148 => [ + 0 => 13, + 1 => 10, + 2 => 3, + ], + 149 => [ + 0 => 14, + 1 => 10, + 2 => 4, + ], + 150 => [ + 0 => 15, + 1 => 10, + 2 => 5, + ], + 151 => [ + 0 => 16, + 1 => 10, + 2 => 6, + ], + 152 => [ + 0 => 17, + 1 => 10, + 2 => 7, + ], + 153 => [ + 0 => 20, + 1 => 10, + 2 => 10, + ], + 154 => [ + 0 => 30, + 1 => 10, + 2 => 20, + ], + 155 => [ + 0 => 40, + 1 => 10, + 2 => 30, + ], + 156 => [ + 0 => 60, + 1 => 10, + 2 => 50, + ], + 157 => [ + 0 => 110, + 1 => 10, + 2 => 100, + ], + 158 => [ + 0 => 1010, + 1 => 10, + 2 => 1000, + ], + 159 => [ + 0 => 10010, + 1 => 10, + 2 => 10000, + ], + 160 => [ + 0 => 20, + 1 => 20, + 2 => 0, + ], + 161 => [ + 0 => 19, + 1 => 20, + 2 => -1, + ], + 162 => [ + 0 => 21, + 1 => 20, + 2 => 1, + ], + 163 => [ + 0 => 22, + 1 => 20, + 2 => 2, + ], + 164 => [ + 0 => 23, + 1 => 20, + 2 => 3, + ], + 165 => [ + 0 => 24, + 1 => 20, + 2 => 4, + ], + 166 => [ + 0 => 25, + 1 => 20, + 2 => 5, + ], + 167 => [ + 0 => 26, + 1 => 20, + 2 => 6, + ], + 168 => [ + 0 => 27, + 1 => 20, + 2 => 7, + ], + 169 => [ + 0 => 30, + 1 => 20, + 2 => 10, + ], + 170 => [ + 0 => 40, + 1 => 20, + 2 => 20, + ], + 171 => [ + 0 => 50, + 1 => 20, + 2 => 30, + ], + 172 => [ + 0 => 70, + 1 => 20, + 2 => 50, + ], + 173 => [ + 0 => 120, + 1 => 20, + 2 => 100, + ], + 174 => [ + 0 => 1020, + 1 => 20, + 2 => 1000, + ], + 175 => [ + 0 => 10020, + 1 => 20, + 2 => 10000, + ], + 176 => [ + 0 => 30, + 1 => 30, + 2 => 0, + ], + 177 => [ + 0 => 29, + 1 => 30, + 2 => -1, + ], + 178 => [ + 0 => 31, + 1 => 30, + 2 => 1, + ], + 179 => [ + 0 => 32, + 1 => 30, + 2 => 2, + ], + 180 => [ + 0 => 33, + 1 => 30, + 2 => 3, + ], + 181 => [ + 0 => 34, + 1 => 30, + 2 => 4, + ], + 182 => [ + 0 => 35, + 1 => 30, + 2 => 5, + ], + 183 => [ + 0 => 36, + 1 => 30, + 2 => 6, + ], + 184 => [ + 0 => 37, + 1 => 30, + 2 => 7, + ], + 185 => [ + 0 => 40, + 1 => 30, + 2 => 10, + ], + 186 => [ + 0 => 50, + 1 => 30, + 2 => 20, + ], + 187 => [ + 0 => 60, + 1 => 30, + 2 => 30, + ], + 188 => [ + 0 => 80, + 1 => 30, + 2 => 50, + ], + 189 => [ + 0 => 130, + 1 => 30, + 2 => 100, + ], + 190 => [ + 0 => 1030, + 1 => 30, + 2 => 1000, + ], + 191 => [ + 0 => 10030, + 1 => 30, + 2 => 10000, + ], + 192 => [ + 0 => 50, + 1 => 50, + 2 => 0, + ], + 193 => [ + 0 => 49, + 1 => 50, + 2 => -1, + ], + 194 => [ + 0 => 51, + 1 => 50, + 2 => 1, + ], + 195 => [ + 0 => 52, + 1 => 50, + 2 => 2, + ], + 196 => [ + 0 => 53, + 1 => 50, + 2 => 3, + ], + 197 => [ + 0 => 54, + 1 => 50, + 2 => 4, + ], + 198 => [ + 0 => 55, + 1 => 50, + 2 => 5, + ], + 199 => [ + 0 => 56, + 1 => 50, + 2 => 6, + ], + 200 => [ + 0 => 57, + 1 => 50, + 2 => 7, + ], + 201 => [ + 0 => 60, + 1 => 50, + 2 => 10, + ], + 202 => [ + 0 => 70, + 1 => 50, + 2 => 20, + ], + 203 => [ + 0 => 80, + 1 => 50, + 2 => 30, + ], + 204 => [ + 0 => 100, + 1 => 50, + 2 => 50, + ], + 205 => [ + 0 => 150, + 1 => 50, + 2 => 100, + ], + 206 => [ + 0 => 1050, + 1 => 50, + 2 => 1000, + ], + 207 => [ + 0 => 10050, + 1 => 50, + 2 => 10000, + ], + 208 => [ + 0 => 100, + 1 => 100, + 2 => 0, + ], + 209 => [ + 0 => 99, + 1 => 100, + 2 => -1, + ], + 210 => [ + 0 => 101, + 1 => 100, + 2 => 1, + ], + 211 => [ + 0 => 102, + 1 => 100, + 2 => 2, + ], + 212 => [ + 0 => 103, + 1 => 100, + 2 => 3, + ], + 213 => [ + 0 => 104, + 1 => 100, + 2 => 4, + ], + 214 => [ + 0 => 105, + 1 => 100, + 2 => 5, + ], + 215 => [ + 0 => 106, + 1 => 100, + 2 => 6, + ], + 216 => [ + 0 => 107, + 1 => 100, + 2 => 7, + ], + 217 => [ + 0 => 110, + 1 => 100, + 2 => 10, + ], + 218 => [ + 0 => 120, + 1 => 100, + 2 => 20, + ], + 219 => [ + 0 => 130, + 1 => 100, + 2 => 30, + ], + 220 => [ + 0 => 150, + 1 => 100, + 2 => 50, + ], + 221 => [ + 0 => 200, + 1 => 100, + 2 => 100, + ], + 222 => [ + 0 => 1100, + 1 => 100, + 2 => 1000, + ], + 223 => [ + 0 => 10100, + 1 => 100, + 2 => 10000, + ], + 224 => [ + 0 => 1000, + 1 => 1000, + 2 => 0, + ], + 225 => [ + 0 => 999, + 1 => 1000, + 2 => -1, + ], + 226 => [ + 0 => 1001, + 1 => 1000, + 2 => 1, + ], + 227 => [ + 0 => 1002, + 1 => 1000, + 2 => 2, + ], + 228 => [ + 0 => 1003, + 1 => 1000, + 2 => 3, + ], + 229 => [ + 0 => 1004, + 1 => 1000, + 2 => 4, + ], + 230 => [ + 0 => 1005, + 1 => 1000, + 2 => 5, + ], + 231 => [ + 0 => 1006, + 1 => 1000, + 2 => 6, + ], + 232 => [ + 0 => 1007, + 1 => 1000, + 2 => 7, + ], + 233 => [ + 0 => 1010, + 1 => 1000, + 2 => 10, + ], + 234 => [ + 0 => 1020, + 1 => 1000, + 2 => 20, + ], + 235 => [ + 0 => 1030, + 1 => 1000, + 2 => 30, + ], + 236 => [ + 0 => 1050, + 1 => 1000, + 2 => 50, + ], + 237 => [ + 0 => 1100, + 1 => 1000, + 2 => 100, + ], + 238 => [ + 0 => 2000, + 1 => 1000, + 2 => 1000, + ], + 239 => [ + 0 => 11000, + 1 => 1000, + 2 => 10000, + ], + 240 => [ + 0 => 10000, + 1 => 10000, + 2 => 0, + ], + 241 => [ + 0 => 9999, + 1 => 10000, + 2 => -1, + ], + 242 => [ + 0 => 10001, + 1 => 10000, + 2 => 1, + ], + 243 => [ + 0 => 10002, + 1 => 10000, + 2 => 2, + ], + 244 => [ + 0 => 10003, + 1 => 10000, + 2 => 3, + ], + 245 => [ + 0 => 10004, + 1 => 10000, + 2 => 4, + ], + 246 => [ + 0 => 10005, + 1 => 10000, + 2 => 5, + ], + 247 => [ + 0 => 10006, + 1 => 10000, + 2 => 6, + ], + 248 => [ + 0 => 10007, + 1 => 10000, + 2 => 7, + ], + 249 => [ + 0 => 10010, + 1 => 10000, + 2 => 10, + ], + 250 => [ + 0 => 10020, + 1 => 10000, + 2 => 20, + ], + 251 => [ + 0 => 10030, + 1 => 10000, + 2 => 30, + ], + 252 => [ + 0 => 10050, + 1 => 10000, + 2 => 50, + ], + 253 => [ + 0 => 10100, + 1 => 10000, + 2 => 100, + ], + 254 => [ + 0 => 11000, + 1 => 10000, + 2 => 1000, + ], + 255 => [ + 0 => 20000, + 1 => 10000, + 2 => 10000, + ], + ]; + } +} diff --git a/tests/tests/Filtre/PostAutobrTest.php b/tests/tests/Filtre/PostAutobrTest.php new file mode 100644 index 0000000000..7b47eae58f --- /dev/null +++ b/tests/tests/Filtre/PostAutobrTest.php @@ -0,0 +1,70 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction post_autobr du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class PostAutobrTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresPostAutobr + */ + public function testFiltresPostAutobr($expected, ...$args): void + { + $actual = post_autobr(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresPostAutobr(): array + { + return [ + 0 => [ + 0 => 'Texte avec un +_ un retour simple à la ligne.', + 1 => 'Texte avec un +un retour simple à la ligne.', + 2 => ' +_ ', + ], + 1 => [ + 0 => '<cadre>cadre contenant un +retour simple (doit rester inchangé)</cadre>', + 1 => '<cadre>cadre contenant un +retour simple (doit rester inchangé)</cadre>', + 2 => ' +_ ', + ], + 2 => [ + 0 => 'Un double saut de ligne + + ne doit pas être modifié par post_autobr.', + 1 => 'Un double saut de ligne + + ne doit pas être modifié par post_autobr.', + 2 => ' +_ ', + ], + 3 => [ + 0 => '<modele123|param1=un appel de modèle + |param2=avec retour à la ligne + ne doit pas être modifié>', + 1 => '<modele123|param1=un appel de modèle + |param2=avec retour à la ligne + ne doit pas être modifié>', + 2 => ' +_ ', + ], + ]; + } +} diff --git a/tests/tests/Filtre/ProtegerAmpTest.php b/tests/tests/Filtre/ProtegerAmpTest.php new file mode 100644 index 0000000000..f84d156dd9 --- /dev/null +++ b/tests/tests/Filtre/ProtegerAmpTest.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction proteger_amp du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class ProtegerAmpTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresProtegerAmp + */ + public function testFiltresProtegerAmp($expected, ...$args): void + { + $actual = proteger_amp(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresProtegerAmp(): array + { + return [ + 0 => [ + 0 => '', + 1 => '', + ], + 1 => [ + 0 => '0', + 1 => '0', + ], + 2 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 3 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + ], + 4 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + ], + 5 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 6 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + ]; + } +} diff --git a/tests/tests/Filtre/RecupererNumeroTest.php b/tests/tests/Filtre/RecupererNumeroTest.php new file mode 100644 index 0000000000..42c4df3797 --- /dev/null +++ b/tests/tests/Filtre/RecupererNumeroTest.php @@ -0,0 +1,58 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction recuperer_numero du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class RecupererNumeroTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresRecupererNumero + */ + public function testFiltresRecupererNumero($expected, ...$args): void + { + $actual = recuperer_numero(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresRecupererNumero(): array + { + return [ + 0 => [ + 0 => '1', + 1 => '1. titre', + ], + 1 => [ + 0 => '', + 1 => '1.titre', + ], + 2 => [ + 0 => '', + 1 => '1 .titre', + ], + 3 => [ + 0 => '', + 1 => '1 . titre', + ], + 4 => [ + 0 => '0', + 1 => '0. titre', + ], + 5 => [ + 0 => '', + 1 => '-1. titre', + ], + ]; + } +} diff --git a/tests/tests/Filtre/SecondesTest.php b/tests/tests/Filtre/SecondesTest.php new file mode 100644 index 0000000000..7e195cfc2b --- /dev/null +++ b/tests/tests/Filtre/SecondesTest.php @@ -0,0 +1,330 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction secondes du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class SecondesTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresSecondes + */ + public function testFiltresSecondes($expected, ...$args): void + { + $actual = secondes(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresSecondes(): array + { + return [ + 0 => [ + 0 => '44', + 1 => '2001-00-00 12:33:44', + ], + 1 => [ + 0 => '57', + 1 => '2001-03-00 09:12:57', + ], + 2 => [ + 0 => '33', + 1 => '2001-02-29 14:12:33', + ], + 3 => [ + 0 => '0', + 1 => '0000-00-00', + ], + 4 => [ + 0 => '0', + 1 => '0001-01-01', + ], + 5 => [ + 0 => '0', + 1 => '1970-01-01', + ], + 6 => [ + 0 => '24', + 1 => '2001-07-05 18:25:24', + ], + 7 => [ + 0 => '00', + 1 => '2001-01-01 00:00:00', + ], + 8 => [ + 0 => '59', + 1 => '2001-12-31 23:59:59', + ], + 9 => [ + 0 => '33', + 1 => '2001-03-01 14:12:33', + ], + 10 => [ + 0 => '33', + 1 => '2004-02-29 14:12:33', + ], + 11 => [ + 0 => '00', + 1 => '2012-03-20 12:00:00', + ], + 12 => [ + 0 => '00', + 1 => '2012-03-21 12:00:00', + ], + 13 => [ + 0 => '00', + 1 => '2012-03-22 12:00:00', + ], + 14 => [ + 0 => '00', + 1 => '2012-06-20 12:00:00', + ], + 15 => [ + 0 => '00', + 1 => '2012-06-21 12:00:00', + ], + 16 => [ + 0 => '00', + 1 => '2012-06-22 12:00:00', + ], + 17 => [ + 0 => '00', + 1 => '2012-09-20 12:00:00', + ], + 18 => [ + 0 => '00', + 1 => '2012-09-21 12:00:00', + ], + 19 => [ + 0 => '00', + 1 => '2012-09-22 12:00:00', + ], + 20 => [ + 0 => '00', + 1 => '2012-12-20 12:00:00', + ], + 21 => [ + 0 => '00', + 1 => '2012-12-21 12:00:00', + ], + 22 => [ + 0 => '00', + 1 => '2012-12-22 12:00:00', + ], + 23 => [ + 0 => '0', + 1 => '2001-07-05', + ], + 24 => [ + 0 => '0', + 1 => '2001-01-01', + ], + 25 => [ + 0 => '0', + 1 => '2001-12-31', + ], + 26 => [ + 0 => '0', + 1 => '2001-03-01', + ], + 27 => [ + 0 => '0', + 1 => '2004-02-29', + ], + 28 => [ + 0 => '0', + 1 => '2012-03-20', + ], + 29 => [ + 0 => '0', + 1 => '2012-03-21', + ], + 30 => [ + 0 => '0', + 1 => '2012-03-22', + ], + 31 => [ + 0 => '0', + 1 => '2012-06-20', + ], + 32 => [ + 0 => '0', + 1 => '2012-06-21', + ], + 33 => [ + 0 => '0', + 1 => '2012-06-22', + ], + 34 => [ + 0 => '0', + 1 => '2012-09-20', + ], + 35 => [ + 0 => '0', + 1 => '2012-09-21', + ], + 36 => [ + 0 => '0', + 1 => '2012-09-22', + ], + 37 => [ + 0 => '0', + 1 => '2012-12-20', + ], + 38 => [ + 0 => '0', + 1 => '2012-12-21', + ], + 39 => [ + 0 => '0', + 1 => '2012-12-22', + ], + 40 => [ + 0 => '0', + 1 => '2001/07/05', + ], + 41 => [ + 0 => '0', + 1 => '2001/01/01', + ], + 42 => [ + 0 => '0', + 1 => '2001/12/31', + ], + 43 => [ + 0 => '0', + 1 => '2001/03/01', + ], + 44 => [ + 0 => '0', + 1 => '2004/02/29', + ], + 45 => [ + 0 => '0', + 1 => '2012/03/20', + ], + 46 => [ + 0 => '0', + 1 => '2012/03/21', + ], + 47 => [ + 0 => '0', + 1 => '2012/03/22', + ], + 48 => [ + 0 => '0', + 1 => '2012/06/20', + ], + 49 => [ + 0 => '0', + 1 => '2012/06/21', + ], + 50 => [ + 0 => '0', + 1 => '2012/06/22', + ], + 51 => [ + 0 => '0', + 1 => '2012/09/20', + ], + 52 => [ + 0 => '0', + 1 => '2012/09/21', + ], + 53 => [ + 0 => '0', + 1 => '2012/09/22', + ], + 54 => [ + 0 => '0', + 1 => '2012/12/20', + ], + 55 => [ + 0 => '0', + 1 => '2012/12/21', + ], + 56 => [ + 0 => '0', + 1 => '2012/12/22', + ], + 57 => [ + 0 => '0', + 1 => '05/07/2001', + ], + 58 => [ + 0 => '0', + 1 => '01/01/2001', + ], + 59 => [ + 0 => '0', + 1 => '31/12/2001', + ], + 60 => [ + 0 => '0', + 1 => '01/03/2001', + ], + 61 => [ + 0 => '0', + 1 => '29/02/2004', + ], + 62 => [ + 0 => '0', + 1 => '20/03/2012', + ], + 63 => [ + 0 => '0', + 1 => '21/03/2012', + ], + 64 => [ + 0 => '0', + 1 => '22/03/2012', + ], + 65 => [ + 0 => '0', + 1 => '20/06/2012', + ], + 66 => [ + 0 => '0', + 1 => '21/06/2012', + ], + 67 => [ + 0 => '0', + 1 => '22/06/2012', + ], + 68 => [ + 0 => '0', + 1 => '20/09/2012', + ], + 69 => [ + 0 => '0', + 1 => '21/09/2012', + ], + 70 => [ + 0 => '0', + 1 => '22/09/2012', + ], + 71 => [ + 0 => '0', + 1 => '20/12/2012', + ], + 72 => [ + 0 => '0', + 1 => '21/12/2012', + ], + 73 => [ + 0 => '0', + 1 => '22/12/2012', + ], + ]; + } +} diff --git a/tests/tests/Filtre/SinonTest.php b/tests/tests/Filtre/SinonTest.php new file mode 100644 index 0000000000..f2222c2681 --- /dev/null +++ b/tests/tests/Filtre/SinonTest.php @@ -0,0 +1,839 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction sinon du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class SinonTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresSinon + */ + public function testFiltresSinon($expected, ...$args): void + { + $actual = sinon(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresSinon(): array + { + return [ + 0 => [ + 0 => '', + 1 => '', + 2 => '', + ], + 1 => [ + 0 => '0', + 1 => '', + 2 => '0', + ], + 2 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => '', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 3 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => '', + 2 => 'Un texte avec des entités &<>"', + ], + 4 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => '', + 2 => 'Un texte sans entites &<>"\'', + ], + 5 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '', + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 6 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => '', + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 7 => [ + 0 => '0', + 1 => '0', + 2 => '', + ], + 8 => [ + 0 => '0', + 1 => '0', + 2 => '0', + ], + 9 => [ + 0 => '0', + 1 => '0', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 10 => [ + 0 => '0', + 1 => '0', + 2 => 'Un texte avec des entités &<>"', + ], + 11 => [ + 0 => '0', + 1 => '0', + 2 => 'Un texte sans entites &<>"\'', + ], + 12 => [ + 0 => '0', + 1 => '0', + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 13 => [ + 0 => '0', + 1 => '0', + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 14 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => '', + ], + 15 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => '0', + ], + 16 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 17 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => 'Un texte avec des entités &<>"', + ], + 18 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => 'Un texte sans entites &<>"\'', + ], + 19 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 20 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 21 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + 2 => '', + ], + 22 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + 2 => '0', + ], + 23 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 24 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + 2 => 'Un texte avec des entités &<>"', + ], + 25 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + 2 => 'Un texte sans entites &<>"\'', + ], + 26 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 27 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 28 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + 2 => '', + ], + 29 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + 2 => '0', + ], + 30 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 31 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + 2 => 'Un texte avec des entités &<>"', + ], + 32 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + 2 => 'Un texte sans entites &<>"\'', + ], + 33 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 34 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 35 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => '', + ], + 36 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => '0', + ], + 37 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 38 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => 'Un texte avec des entités &<>"', + ], + 39 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => 'Un texte sans entites &<>"\'', + ], + 40 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 41 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 42 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => '', + ], + 43 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => '0', + ], + 44 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 45 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => 'Un texte avec des entités &<>"', + ], + 46 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => 'Un texte sans entites &<>"\'', + ], + 47 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 48 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 49 => [ + 0 => 0, + 1 => 0, + 2 => '', + ], + 50 => [ + 0 => 0, + 1 => 0, + 2 => '0', + ], + 51 => [ + 0 => 0, + 1 => 0, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 52 => [ + 0 => 0, + 1 => 0, + 2 => 'Un texte avec des entités &<>"', + ], + 53 => [ + 0 => 0, + 1 => 0, + 2 => 'Un texte sans entites &<>"\'', + ], + 54 => [ + 0 => 0, + 1 => 0, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 55 => [ + 0 => 0, + 1 => 0, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 56 => [ + 0 => -1, + 1 => -1, + 2 => '', + ], + 57 => [ + 0 => -1, + 1 => -1, + 2 => '0', + ], + 58 => [ + 0 => -1, + 1 => -1, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 59 => [ + 0 => -1, + 1 => -1, + 2 => 'Un texte avec des entités &<>"', + ], + 60 => [ + 0 => -1, + 1 => -1, + 2 => 'Un texte sans entites &<>"\'', + ], + 61 => [ + 0 => -1, + 1 => -1, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 62 => [ + 0 => -1, + 1 => -1, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 63 => [ + 0 => 1, + 1 => 1, + 2 => '', + ], + 64 => [ + 0 => 1, + 1 => 1, + 2 => '0', + ], + 65 => [ + 0 => 1, + 1 => 1, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 66 => [ + 0 => 1, + 1 => 1, + 2 => 'Un texte avec des entités &<>"', + ], + 67 => [ + 0 => 1, + 1 => 1, + 2 => 'Un texte sans entites &<>"\'', + ], + 68 => [ + 0 => 1, + 1 => 1, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 69 => [ + 0 => 1, + 1 => 1, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 70 => [ + 0 => 2, + 1 => 2, + 2 => '', + ], + 71 => [ + 0 => 2, + 1 => 2, + 2 => '0', + ], + 72 => [ + 0 => 2, + 1 => 2, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 73 => [ + 0 => 2, + 1 => 2, + 2 => 'Un texte avec des entités &<>"', + ], + 74 => [ + 0 => 2, + 1 => 2, + 2 => 'Un texte sans entites &<>"\'', + ], + 75 => [ + 0 => 2, + 1 => 2, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 76 => [ + 0 => 2, + 1 => 2, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 77 => [ + 0 => 3, + 1 => 3, + 2 => '', + ], + 78 => [ + 0 => 3, + 1 => 3, + 2 => '0', + ], + 79 => [ + 0 => 3, + 1 => 3, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 80 => [ + 0 => 3, + 1 => 3, + 2 => 'Un texte avec des entités &<>"', + ], + 81 => [ + 0 => 3, + 1 => 3, + 2 => 'Un texte sans entites &<>"\'', + ], + 82 => [ + 0 => 3, + 1 => 3, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 83 => [ + 0 => 3, + 1 => 3, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 84 => [ + 0 => 4, + 1 => 4, + 2 => '', + ], + 85 => [ + 0 => 4, + 1 => 4, + 2 => '0', + ], + 86 => [ + 0 => 4, + 1 => 4, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 87 => [ + 0 => 4, + 1 => 4, + 2 => 'Un texte avec des entités &<>"', + ], + 88 => [ + 0 => 4, + 1 => 4, + 2 => 'Un texte sans entites &<>"\'', + ], + 89 => [ + 0 => 4, + 1 => 4, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 90 => [ + 0 => 4, + 1 => 4, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 91 => [ + 0 => 5, + 1 => 5, + 2 => '', + ], + 92 => [ + 0 => 5, + 1 => 5, + 2 => '0', + ], + 93 => [ + 0 => 5, + 1 => 5, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 94 => [ + 0 => 5, + 1 => 5, + 2 => 'Un texte avec des entités &<>"', + ], + 95 => [ + 0 => 5, + 1 => 5, + 2 => 'Un texte sans entites &<>"\'', + ], + 96 => [ + 0 => 5, + 1 => 5, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 97 => [ + 0 => 5, + 1 => 5, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 98 => [ + 0 => 6, + 1 => 6, + 2 => '', + ], + 99 => [ + 0 => 6, + 1 => 6, + 2 => '0', + ], + 100 => [ + 0 => 6, + 1 => 6, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 101 => [ + 0 => 6, + 1 => 6, + 2 => 'Un texte avec des entités &<>"', + ], + 102 => [ + 0 => 6, + 1 => 6, + 2 => 'Un texte sans entites &<>"\'', + ], + 103 => [ + 0 => 6, + 1 => 6, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 104 => [ + 0 => 6, + 1 => 6, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 105 => [ + 0 => 7, + 1 => 7, + 2 => '', + ], + 106 => [ + 0 => 7, + 1 => 7, + 2 => '0', + ], + 107 => [ + 0 => 7, + 1 => 7, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 108 => [ + 0 => 7, + 1 => 7, + 2 => 'Un texte avec des entités &<>"', + ], + 109 => [ + 0 => 7, + 1 => 7, + 2 => 'Un texte sans entites &<>"\'', + ], + 110 => [ + 0 => 7, + 1 => 7, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 111 => [ + 0 => 7, + 1 => 7, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 112 => [ + 0 => 10, + 1 => 10, + 2 => '', + ], + 113 => [ + 0 => 10, + 1 => 10, + 2 => '0', + ], + 114 => [ + 0 => 10, + 1 => 10, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 115 => [ + 0 => 10, + 1 => 10, + 2 => 'Un texte avec des entités &<>"', + ], + 116 => [ + 0 => 10, + 1 => 10, + 2 => 'Un texte sans entites &<>"\'', + ], + 117 => [ + 0 => 10, + 1 => 10, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 118 => [ + 0 => 10, + 1 => 10, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 119 => [ + 0 => 20, + 1 => 20, + 2 => '', + ], + 120 => [ + 0 => 20, + 1 => 20, + 2 => '0', + ], + 121 => [ + 0 => 20, + 1 => 20, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 122 => [ + 0 => 20, + 1 => 20, + 2 => 'Un texte avec des entités &<>"', + ], + 123 => [ + 0 => 20, + 1 => 20, + 2 => 'Un texte sans entites &<>"\'', + ], + 124 => [ + 0 => 20, + 1 => 20, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 125 => [ + 0 => 20, + 1 => 20, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 126 => [ + 0 => 30, + 1 => 30, + 2 => '', + ], + 127 => [ + 0 => 30, + 1 => 30, + 2 => '0', + ], + 128 => [ + 0 => 30, + 1 => 30, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 129 => [ + 0 => 30, + 1 => 30, + 2 => 'Un texte avec des entités &<>"', + ], + 130 => [ + 0 => 30, + 1 => 30, + 2 => 'Un texte sans entites &<>"\'', + ], + 131 => [ + 0 => 30, + 1 => 30, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 132 => [ + 0 => 30, + 1 => 30, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 133 => [ + 0 => 50, + 1 => 50, + 2 => '', + ], + 134 => [ + 0 => 50, + 1 => 50, + 2 => '0', + ], + 135 => [ + 0 => 50, + 1 => 50, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 136 => [ + 0 => 50, + 1 => 50, + 2 => 'Un texte avec des entités &<>"', + ], + 137 => [ + 0 => 50, + 1 => 50, + 2 => 'Un texte sans entites &<>"\'', + ], + 138 => [ + 0 => 50, + 1 => 50, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 139 => [ + 0 => 50, + 1 => 50, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 140 => [ + 0 => 100, + 1 => 100, + 2 => '', + ], + 141 => [ + 0 => 100, + 1 => 100, + 2 => '0', + ], + 142 => [ + 0 => 100, + 1 => 100, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 143 => [ + 0 => 100, + 1 => 100, + 2 => 'Un texte avec des entités &<>"', + ], + 144 => [ + 0 => 100, + 1 => 100, + 2 => 'Un texte sans entites &<>"\'', + ], + 145 => [ + 0 => 100, + 1 => 100, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 146 => [ + 0 => 100, + 1 => 100, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 147 => [ + 0 => 1000, + 1 => 1000, + 2 => '', + ], + 148 => [ + 0 => 1000, + 1 => 1000, + 2 => '0', + ], + 149 => [ + 0 => 1000, + 1 => 1000, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 150 => [ + 0 => 1000, + 1 => 1000, + 2 => 'Un texte avec des entités &<>"', + ], + 151 => [ + 0 => 1000, + 1 => 1000, + 2 => 'Un texte sans entites &<>"\'', + ], + 152 => [ + 0 => 1000, + 1 => 1000, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 153 => [ + 0 => 1000, + 1 => 1000, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 154 => [ + 0 => 10000, + 1 => 10000, + 2 => '', + ], + 155 => [ + 0 => 10000, + 1 => 10000, + 2 => '0', + ], + 156 => [ + 0 => 10000, + 1 => 10000, + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 157 => [ + 0 => 10000, + 1 => 10000, + 2 => 'Un texte avec des entités &<>"', + ], + 158 => [ + 0 => 10000, + 1 => 10000, + 2 => 'Un texte sans entites &<>"\'', + ], + 159 => [ + 0 => 10000, + 1 => 10000, + 2 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 160 => [ + 0 => 10000, + 1 => 10000, + 2 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + ]; + } +} diff --git a/tests/tests/Filtre/SpipHtmlentitiesTest.php b/tests/tests/Filtre/SpipHtmlentitiesTest.php new file mode 100644 index 0000000000..2810599032 --- /dev/null +++ b/tests/tests/Filtre/SpipHtmlentitiesTest.php @@ -0,0 +1,1619 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction spip_htmlentities du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class SpipHtmlentitiesTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresSpipHtmlentities + */ + public function testFiltresSpipHtmlentities($expected, ...$args): void + { + $actual = spip_htmlentities(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresSpipHtmlentities(): array + { + return [ + 0 => [ + 0 => '', + 1 => '', + ], + 1 => [ + 0 => '0', + 1 => '0', + ], + 2 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 3 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + ], + 4 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + ], + 5 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + ], + 6 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + ], + 7 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + ], + 8 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 9 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 10 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + 11 => [ + 0 => '', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + ], + 12 => [ + 0 => '', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 13 => [ + 0 => '', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 14 => [ + 0 => '', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 15 => [ + 0 => '', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 16 => [ + 0 => '', + 1 => "Un texte sans entites &<>\"\' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 17 => [ + 0 => '', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + ], + 18 => [ + 0 => '', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + ], + 19 => [ + 0 => '', + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 20 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + ], + 21 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 22 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 23 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 24 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 25 => [ + 0 => "Un texte sans entites &<>"' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü", + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 26 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + ], + 27 => [ + 0 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + ], + 28 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 29 => [ + 0 => '', + 1 => '', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 30 => [ + 0 => '0', + 1 => '0', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 31 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 32 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 33 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 34 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 35 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 36 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 37 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 38 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 39 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 40 => [ + 0 => '', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 41 => [ + 0 => '', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 42 => [ + 0 => '', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 43 => [ + 0 => '', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 44 => [ + 0 => '', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 45 => [ + 0 => '', + 1 => "Un texte sans entites &<>\"\' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 46 => [ + 0 => '', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 47 => [ + 0 => '', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 48 => [ + 0 => '', + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 49 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 50 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 51 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 52 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 53 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 54 => [ + 0 => "Un texte sans entites &<>"' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü", + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 55 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 56 => [ + 0 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 57 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 58 => [ + 0 => '', + 1 => '', + 2 => ENT_QUOTES, + ], + 59 => [ + 0 => '0', + 1 => '0', + 2 => ENT_QUOTES, + ], + 60 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_QUOTES, + ], + 61 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_QUOTES, + ], + 62 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_QUOTES, + ], + 63 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_QUOTES, + ], + 64 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_QUOTES, + ], + 65 => [ + 0 => 'Un texte sans entites &<>"'', + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_QUOTES, + ], + 66 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_QUOTES, + ], + 67 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_QUOTES, + ], + 68 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_QUOTES, + ], + 69 => [ + 0 => '', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + 2 => ENT_QUOTES, + ], + 70 => [ + 0 => '', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + ], + 71 => [ + 0 => '', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + ], + 72 => [ + 0 => '', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + ], + 73 => [ + 0 => '', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + ], + 74 => [ + 0 => '', + 1 => "Un texte sans entites &<>\"\' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + ], + 75 => [ + 0 => '', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + 2 => ENT_QUOTES, + ], + 76 => [ + 0 => '', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + 2 => ENT_QUOTES, + ], + 77 => [ + 0 => '', + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + ], + 78 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 2 => ENT_QUOTES, + ], + 79 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + ], + 80 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + ], + 81 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + ], + 82 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + ], + 83 => [ + 0 => 'Un texte sans entites &<>"' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + ], + 84 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 2 => ENT_QUOTES, + ], + 85 => [ + 0 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 2 => ENT_QUOTES, + ], + 86 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + ], + 87 => [ + 0 => '', + 1 => '', + 2 => ENT_NOQUOTES, + ], + 88 => [ + 0 => '0', + 1 => '0', + 2 => ENT_NOQUOTES, + ], + 89 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_NOQUOTES, + ], + 90 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_NOQUOTES, + ], + 91 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_NOQUOTES, + ], + 92 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_NOQUOTES, + ], + 93 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_NOQUOTES, + ], + 94 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_NOQUOTES, + ], + 95 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_NOQUOTES, + ], + 96 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_NOQUOTES, + ], + 97 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_NOQUOTES, + ], + 98 => [ + 0 => '', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + 2 => ENT_NOQUOTES, + ], + 99 => [ + 0 => '', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_NOQUOTES, + ], + 100 => [ + 0 => '', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_NOQUOTES, + ], + 101 => [ + 0 => '', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_NOQUOTES, + ], + 102 => [ + 0 => '', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_NOQUOTES, + ], + 103 => [ + 0 => '', + 1 => "Un texte sans entites &<>\"\' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_NOQUOTES, + ], + 104 => [ + 0 => '', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + 2 => ENT_NOQUOTES, + ], + 105 => [ + 0 => '', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + 2 => ENT_NOQUOTES, + ], + 106 => [ + 0 => '', + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_NOQUOTES, + ], + 107 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 2 => ENT_NOQUOTES, + ], + 108 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_NOQUOTES, + ], + 109 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_NOQUOTES, + ], + 110 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_NOQUOTES, + ], + 111 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_NOQUOTES, + ], + 112 => [ + 0 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_NOQUOTES, + ], + 113 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 2 => ENT_NOQUOTES, + ], + 114 => [ + 0 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 2 => ENT_NOQUOTES, + ], + 115 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_NOQUOTES, + ], + 116 => [ + 0 => '', + 1 => '', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 117 => [ + 0 => '0', + 1 => '0', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 118 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 119 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 120 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 121 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 122 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 123 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 124 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 125 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 126 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 127 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents ISO aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents ISO aàâä eéèêë iîï oô uùü->art1] [spip avec des accents ISO aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 128 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents ISO aàâä eéèêë iîï oô uùü', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 129 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents ISO aàâä eéèêë iîï oô uùü', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 130 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents ISO aàâä eéèêë iîï oô uùü', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 131 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents ISO aàâä eéèêë iîï oô uùü', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 132 => [ + 0 => "Un texte sans entites &<>"' et avec des accents ISO aàâä eéèêë iîï oô uùü", + 1 => "Un texte sans entites &<>\"' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 133 => [ + 0 => '{{{Des raccourcis avec des accents ISO aàâä eéèêë iîï oô uùü}}} {italique avec des accents ISO aàâä eéèêë iîï oô uùü} {{gras avec des accents ISO aàâä eéèêë iîï oô uùü}} <code>du code avec des accents ISO aàâä eéèêë iîï oô uùü</code>', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 134 => [ + 0 => 'Un modele avec des accents ISO aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents ISO aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 135 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO aàâä eéèêë iîï oô uùü', + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 136 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aà âä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aà âä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aà âä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 137 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aà âä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 138 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aà âä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 139 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aà âä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 140 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aà âä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 141 => [ + 0 => "Un texte sans entites &<>"' et avec des accents UTF-8 aà âä eéèêë iîï oô uùü", + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 142 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aà âä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aà âä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aà âä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aà âä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 143 => [ + 0 => 'Un modele avec des accents UTF-8 aà âä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aà âä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 144 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aà âä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 145 => [ + 0 => '', + 1 => '', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 146 => [ + 0 => '0', + 1 => '0', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 147 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 148 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 149 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 150 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 151 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 152 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 153 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 154 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 155 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 156 => [ + 0 => '', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 157 => [ + 0 => '', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 158 => [ + 0 => '', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 159 => [ + 0 => '', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 160 => [ + 0 => '', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 161 => [ + 0 => '', + 1 => "Un texte sans entites &<>\"\' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 162 => [ + 0 => '', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 163 => [ + 0 => '', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 164 => [ + 0 => '', + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 165 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 166 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 167 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 168 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 169 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 170 => [ + 0 => "Un texte sans entites &<>"' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü", + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 171 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 172 => [ + 0 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 173 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 174 => [ + 0 => '', + 1 => '', + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 175 => [ + 0 => '0', + 1 => '0', + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 176 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents ISO aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents ISO aàâä eéèêë iîï oô uùü->art1] [spip avec des accents ISO aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 177 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents ISO aàâä eéèêë iîï oô uùü', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 178 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents ISO aàâä eéèêë iîï oô uùü', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 179 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents ISO aàâä eéèêë iîï oô uùü', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 180 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents ISO aàâä eéèêë iîï oô uùü', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 181 => [ + 0 => 'Un texte sans entites &<>"' et avec des accents ISO aàâä eéèêë iîï oô uùü', + 1 => "Un texte sans entites &<>\"' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 182 => [ + 0 => '{{{Des raccourcis avec des accents ISO aàâä eéèêë iîï oô uùü}}} {italique avec des accents ISO aàâä eéèêë iîï oô uùü} {{gras avec des accents ISO aàâä eéèêë iîï oô uùü}} <code>du code avec des accents ISO aàâä eéèêë iîï oô uùü</code>', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 183 => [ + 0 => 'Un modele avec des accents ISO aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents ISO aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 184 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO aàâä eéèêë iîï oô uùü', + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 185 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aà âä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aà âä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aà âä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 186 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aà âä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 187 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aà âä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 188 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aà âä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 189 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aà âä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 190 => [ + 0 => 'Un texte sans entites &<>"' et avec des accents UTF-8 aà âä eéèêë iîï oô uùü', + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 191 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aà âä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aà âä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aà âä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aà âä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 192 => [ + 0 => 'Un modele avec des accents UTF-8 aà âä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aà âä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 193 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aà âä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + 3 => 'ISO-8859-1', + ], + 194 => [ + 0 => '', + 1 => '', + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 195 => [ + 0 => '0', + 1 => '0', + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 196 => [ + 0 => '', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 197 => [ + 0 => '', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 198 => [ + 0 => '', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 199 => [ + 0 => '', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 200 => [ + 0 => '', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 201 => [ + 0 => '', + 1 => "Un texte sans entites &<>\"\' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 202 => [ + 0 => '', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 203 => [ + 0 => '', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 204 => [ + 0 => '', + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 205 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 206 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 207 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 208 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 209 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 210 => [ + 0 => 'Un texte sans entites &<>"' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 211 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 212 => [ + 0 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 213 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + 3 => 'UTF-8', + ], + 214 => [ + 0 => '', + 1 => '', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => false, + ], + 215 => [ + 0 => '0', + 1 => '0', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => false, + ], + 216 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => false, + ], + 217 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => false, + ], + 218 => [ + 0 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => false, + ], + 219 => [ + 0 => 'Un texte avec des entités numériques &<>"', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => false, + ], + 220 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => false, + ], + 221 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => false, + ], + 222 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => false, + ], + 223 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => false, + ], + 224 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => false, + ], + 225 => [ + 0 => '', + 1 => '', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => true, + ], + 226 => [ + 0 => '0', + 1 => '0', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => true, + ], + 227 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => true, + ], + 228 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => true, + ], + 229 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => true, + ], + 230 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => true, + ], + 231 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => true, + ], + 232 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => true, + ], + 233 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => true, + ], + 234 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => true, + ], + 235 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + 4 => true, + ], + 236 => [ + 0 => '', + 1 => '', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => false, + ], + 237 => [ + 0 => '0', + 1 => '0', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => false, + ], + 238 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => false, + ], + 239 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => false, + ], + 240 => [ + 0 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => false, + ], + 241 => [ + 0 => 'Un texte avec des entités numériques &<>"', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => false, + ], + 242 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => false, + ], + 243 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => false, + ], + 244 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => false, + ], + 245 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => false, + ], + 246 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => false, + ], + 247 => [ + 0 => '', + 1 => '', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => true, + ], + 248 => [ + 0 => '0', + 1 => '0', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => true, + ], + 249 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => true, + ], + 250 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => true, + ], + 251 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => true, + ], + 252 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => true, + ], + 253 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => true, + ], + 254 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => true, + ], + 255 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => true, + ], + 256 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => true, + ], + 257 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + 4 => true, + ], + ]; + } +} diff --git a/tests/tests/Filtre/SpipHtmlspecialcharsTest.php b/tests/tests/Filtre/SpipHtmlspecialcharsTest.php new file mode 100644 index 0000000000..998fa0768b --- /dev/null +++ b/tests/tests/Filtre/SpipHtmlspecialcharsTest.php @@ -0,0 +1,866 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction spip_htmlspecialchars du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class SpipHtmlspecialcharsTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresSpipHtmlspecialchars + */ + public function testFiltresSpipHtmlspecialchars($expected, ...$args): void + { + $actual = spip_htmlspecialchars(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresSpipHtmlspecialchars(): array + { + return [ + 0 => [ + 0 => '', + 1 => '', + ], + 1 => [ + 0 => '0', + 1 => '0', + ], + 2 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 3 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + ], + 4 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + ], + 5 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + ], + 6 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + ], + 7 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + ], + 8 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 9 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 10 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + 11 => [ + 0 => '', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + ], + 12 => [ + 0 => '', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 13 => [ + 0 => '', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 14 => [ + 0 => '', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 15 => [ + 0 => '', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 16 => [ + 0 => '', + 1 => "Un texte sans entites &<>\"\' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 17 => [ + 0 => '', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + ], + 18 => [ + 0 => '', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + ], + 19 => [ + 0 => '', + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + ], + 20 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + ], + 21 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 22 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 23 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 24 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 25 => [ + 0 => "Un texte sans entites &<>"' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü", + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 26 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + ], + 27 => [ + 0 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + ], + 28 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + ], + 29 => [ + 0 => '', + 1 => '', + 2 => ENT_QUOTES, + ], + 30 => [ + 0 => '0', + 1 => '0', + 2 => ENT_QUOTES, + ], + 31 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_QUOTES, + ], + 32 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_QUOTES, + ], + 33 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_QUOTES, + ], + 34 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_QUOTES, + ], + 35 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_QUOTES, + ], + 36 => [ + 0 => 'Un texte sans entites &<>"'', + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_QUOTES, + ], + 37 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_QUOTES, + ], + 38 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_QUOTES, + ], + 39 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_QUOTES, + ], + 40 => [ + 0 => '', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + 2 => ENT_QUOTES, + ], + 41 => [ + 0 => '', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + ], + 42 => [ + 0 => '', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + ], + 43 => [ + 0 => '', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + ], + 44 => [ + 0 => '', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + ], + 45 => [ + 0 => '', + 1 => "Un texte sans entites &<>\"\' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + ], + 46 => [ + 0 => '', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + 2 => ENT_QUOTES, + ], + 47 => [ + 0 => '', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + 2 => ENT_QUOTES, + ], + 48 => [ + 0 => '', + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_QUOTES, + ], + 49 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 2 => ENT_QUOTES, + ], + 50 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + ], + 51 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + ], + 52 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + ], + 53 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + ], + 54 => [ + 0 => 'Un texte sans entites &<>"' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + ], + 55 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 2 => ENT_QUOTES, + ], + 56 => [ + 0 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 2 => ENT_QUOTES, + ], + 57 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_QUOTES, + ], + 58 => [ + 0 => '', + 1 => '', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 59 => [ + 0 => '0', + 1 => '0', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 60 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 61 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 62 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 63 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 64 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 65 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 66 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 67 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 68 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 69 => [ + 0 => '', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 70 => [ + 0 => '', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 71 => [ + 0 => '', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 72 => [ + 0 => '', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 73 => [ + 0 => '', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 74 => [ + 0 => '', + 1 => "Un texte sans entites &<>\"\' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 75 => [ + 0 => '', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 76 => [ + 0 => '', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 77 => [ + 0 => '', + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + ], + 78 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 79 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 80 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 81 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 82 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 83 => [ + 0 => "Un texte sans entites &<>"' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü", + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 84 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 85 => [ + 0 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 86 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + ], + 87 => [ + 0 => '', + 1 => '', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 88 => [ + 0 => '0', + 1 => '0', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 89 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 90 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 91 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 92 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 93 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 94 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 95 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 96 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 97 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 98 => [ + 0 => "Un texte avec des <a href="http://spip.net">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 99 => [ + 0 => "Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 100 => [ + 0 => "Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 101 => [ + 0 => "Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 102 => [ + 0 => "Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 103 => [ + 0 => "Un texte sans entites &<>"' et avec des accents ISO a\xe0\xe2\xe4 e\xe9\xe8\xea\xeb i\xee\xef o\xf4 u\xf9\xfc", + 1 => "Un texte sans entites &<>\"' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 104 => [ + 0 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 105 => [ + 0 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 106 => [ + 0 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 107 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 108 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 109 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 110 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 111 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 112 => [ + 0 => "Un texte sans entites &<>"' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü", + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 113 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 114 => [ + 0 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 115 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'ISO-8859-1', + ], + 116 => [ + 0 => '', + 1 => '', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 117 => [ + 0 => '0', + 1 => '0', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 118 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 119 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 120 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 121 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 122 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 123 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 124 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 125 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 126 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 127 => [ + 0 => '', + 1 => "Un texte avec des <a href=\"http://spip.net\">liens avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</a> [Article 1 avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->art1] [spip avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net] http://www.spip.net", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 128 => [ + 0 => '', + 1 => "Un texte avec des entités &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 129 => [ + 0 => '', + 1 => "Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 130 => [ + 0 => '', + 1 => "Un texte avec des entités numériques &<>" et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 131 => [ + 0 => '', + 1 => "Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 132 => [ + 0 => '', + 1 => "Un texte sans entites &<>\"\' et avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 133 => [ + 0 => '', + 1 => "{{{Des raccourcis avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}}} {italique avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC} {{gras avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC}} <code>du code avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC</code>", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 134 => [ + 0 => '', + 1 => "Un modele avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC <modeleinexistant|lien=[avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC->http://www.spip.net]>", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 135 => [ + 0 => '', + 1 => "Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents ISO a\xE0\xE2\xE4 e\xE9\xE8\xEA\xEB i\xEE\xEF o\xF4 u\xF9\xFC", + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 136 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens avec des accents UTF-8 aàâä eéèêë iîï oô uùü</a> [Article 1 avec des accents UTF-8 aàâä eéèêë iîï oô uùü->art1] [spip avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net] http://www.spip.net', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 137 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 138 => [ + 0 => 'Un texte avec des entit&amp;eacute;s echap&amp;eacute; &amp;amp;&amp;lt;&amp;gt;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 139 => [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entités numériques &<>" et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 140 => [ + 0 => 'Un texte avec des entit&amp;#233;s num&amp;#233;riques echap&amp;#233;es &amp;#38;&amp;#60;&amp;#62;&amp;quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot; et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 141 => [ + 0 => "Un texte sans entites &<>"' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü", + 1 => 'Un texte sans entites &<>"\' et avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 142 => [ + 0 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 1 => '{{{Des raccourcis avec des accents UTF-8 aàâä eéèêë iîï oô uùü}}} {italique avec des accents UTF-8 aàâä eéèêë iîï oô uùü} {{gras avec des accents UTF-8 aàâä eéèêë iîï oô uùü}} <code>du code avec des accents UTF-8 aàâä eéèêë iîï oô uùü</code>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 143 => [ + 0 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 1 => 'Un modele avec des accents UTF-8 aàâä eéèêë iîï oô uùü <modeleinexistant|lien=[avec des accents UTF-8 aàâä eéèêë iîï oô uùü->http://www.spip.net]>', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + 144 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü', + 2 => ENT_COMPAT | ENT_HTML401, + 3 => 'UTF-8', + ], + ]; + } +} diff --git a/tests/tests/Filtre/SupprimerClassTest.php b/tests/tests/Filtre/SupprimerClassTest.php new file mode 100644 index 0000000000..3e0b46a5bd --- /dev/null +++ b/tests/tests/Filtre/SupprimerClassTest.php @@ -0,0 +1,74 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction supprimer_class du fichier ./inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class SupprimerClassTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresSupprimerClass + */ + public function testFiltresSupprimerClass($expected, ...$args): void + { + $actual = supprimer_class(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresSupprimerClass(): array + { + return [ + 0 => [ + 0 => "<span class='maclasse-prefixe suffixe-maclasse maclasse--bem'>toto</span>", + 1 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 2 => 'maclasse', + ], + 1 => [ + 0 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 1 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 2 => 'autreclass', + ], + 2 => [ + 0 => "<span class='maclasse-prefixe suffixe-maclasse maclasse--bem'>toto</span>", + 1 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 2 => 'maclasse1 maclasse maclasse2', + ], + 3 => [ + 0 => "<span class='maclasse suffixe-maclasse'>toto</span>", + 1 => '<span class="maclasse maclasse-prefixe suffixe-maclasse maclasse--bem">toto</span>', + 2 => 'maclasse-prefixe maclasse--bem', + ], + 4 => [ + 0 => "<span class='maclasse-prefixe'>toto</span>", + 1 => '<span class="maclasse maclasse-prefixe">toto</span>', + 2 => 'maclasse', + ], + 5 => [ + 0 => "<span class='maclasse'>toto</span>", + 1 => '<span class="maclasse maclasse-prefixe">toto</span>', + 2 => 'maclasse-prefixe', + ], + 6 => [ + 0 => '<span>toto</span>', + 1 => '<span class="maclasse maclasse-prefixe">toto</span>', + 2 => 'maclasse maclasse-prefixe', + ], + 7 => [ + 0 => '<span>toto</span>', + 1 => '<span class="maclasse maclasse-prefixe">toto</span>', + 2 => 'maclasse-prefixe maclasse', + ], + ]; + } +} diff --git a/tests/tests/Filtre/SupprimerNumeroTest.php b/tests/tests/Filtre/SupprimerNumeroTest.php new file mode 100644 index 0000000000..f346976f13 --- /dev/null +++ b/tests/tests/Filtre/SupprimerNumeroTest.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction supprimer_numero du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class SupprimerNumeroTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresSupprimerNumero + */ + public function testFiltresSupprimerNumero($expected, ...$args): void + { + $actual = supprimer_numero(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresSupprimerNumero(): array + { + return [ + 0 => [ + 0 => '1.titre', + 1 => '1.titre', + ], + 1 => [ + 0 => 'titre', + 1 => '1. titre', + ], + 2 => [ + 0 => '1 .titre', + 1 => '1 .titre', + ], + 3 => [ + 0 => '1 . titre', + 1 => '1 . titre', + ], + 5 => [ + 0 => 'titre', + 1 => '0. titre', + ], + 6 => [ + 0 => 'titre', + 1 => ' 0. titre', + ], + 7 => [ + 0 => '-1. titre', + 1 => '-1. titre', + ], + ]; + } +} diff --git a/tests/tests/Filtre/SupprimerTagsTest.php b/tests/tests/Filtre/SupprimerTagsTest.php new file mode 100644 index 0000000000..a751dc37d2 --- /dev/null +++ b/tests/tests/Filtre/SupprimerTagsTest.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction supprimer_tags du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class SupprimerTagsTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresSupprimerTags + */ + public function testFiltresSupprimerTags($expected, ...$args): void + { + $actual = supprimer_tags(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresSupprimerTags(): array + { + return [ + 0 => [ + 0 => '', + 1 => '', + ], + 1 => [ + 0 => '0', + 1 => '0', + ], + 2 => [ + 0 => 'Un texte avec des liens [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 3 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + ], + 4 => [ + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + ], + 5 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} du code', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 6 => [ + 0 => 'Un modele http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + ]; + } +} diff --git a/tests/tests/Filtre/TailleEnOctetsTest.php b/tests/tests/Filtre/TailleEnOctetsTest.php new file mode 100644 index 0000000000..dcc36f9daa --- /dev/null +++ b/tests/tests/Filtre/TailleEnOctetsTest.php @@ -0,0 +1,90 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction taille_en_octets du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class TailleEnOctetsTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + protected function setUp(): void + { + changer_langue('fr'); + // ce test est en fr + } + + /** + * @dataProvider providerFiltresTailleEnOctetsBI + */ + public function testFiltresTailleEnOctetsBI($source, $expected): void + { + $actual = taille_en_octets($source); + $this->assertSame($expected, $actual); + + $actual = taille_en_octets($source, 'BI'); + $this->assertSame($expected, $actual); + } + + /** + * @dataProvider providerFiltresTailleEnOctetsSI + */ + public function testFiltresTailleEnOctetsSI($source, $expected): void + { + $actual = taille_en_octets($source, 'SI'); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresTailleEnOctetsBI(): array + { + $list = [ + 0 =>'', + -1 => '', + 1 => '1 octets', + 2 => '2 octets', + 10 => '10 octets', + 50 => '50 octets', + 100 => '100 octets', + 1000 => '1000 octets', + 10000 => '9.8 kio', + 100000 => '97.7 kio', + 1000000 => '976.6 kio', + 10000000 => '9.5 Mio', + 100000000 => '95.4 Mio', + 1000000000 => '953.7 Mio', + 10000000000 => '9.31 Gio', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + public static function providerFiltresTailleEnOctetsSI(): array + { + $list = [ + 0 =>'', + -1 => '', + 1 => '1 octets', + 2 => '2 octets', + 10 => '10 octets', + 50 => '50 octets', + 100 => '100 octets', + 1000 => '1 ko', + 10000 => '10 ko', + 100000 => '100 ko', + 1000000 => '1 Mo', + 10000000 => '10 Mo', + 100000000 => '100 Mo', + 1000000000 => '1 Go', + 10000000000 => '10 Go', + ]; + return array_map(null, array_keys($list), array_values($list)); + } +} diff --git a/tests/tests/Filtre/TailleImageTest.php b/tests/tests/Filtre/TailleImageTest.php new file mode 100644 index 0000000000..0f01b09e50 --- /dev/null +++ b/tests/tests/Filtre/TailleImageTest.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction taille_image du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class TailleImageTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresTailleImage + */ + public function testFiltresTailleImage($expected, ...$args): void + { + $actual = taille_image(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresTailleImage(): array + { + return [ + 0 => [ + 0 => [ + 0 => 223, + 1 => 300, + ], + 1 => 'https://www.spip.net/IMG/logo/siteon0.png', + ], + 2 => [ + 0 => [ + 0 => 172, + 1 => 231, + ], + 1 => 'prive/images/logo-spip.png', + ], + 3 => [ + 0 => [ + 0 => 0, + 1 => 0, + ], + 1 => 'prive/aide_body.css', + ], + 4 => [ + 0 => [ + 0 => 16, + 1 => 16, + ], + 1 => 'prive/images/searching.gif', + ], + ]; + } +} diff --git a/tests/tests/Filtre/TexteBackendTest.php b/tests/tests/Filtre/TexteBackendTest.php new file mode 100644 index 0000000000..d50c7517cc --- /dev/null +++ b/tests/tests/Filtre/TexteBackendTest.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction texte_backend du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class TexteBackendTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresTexteBackend + */ + public function testFiltresTexteBackend($expected, ...$args): void + { + $actual = texte_backend(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresTexteBackend(): array + { + return [ + 0 => [ + 0 => '', + 1 => '', + ], + 1 => [ + 0 => '0', + 1 => '0', + ], + 2 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 3 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + ], + 4 => [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + ], + 5 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 6 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + ]; + } +} diff --git a/tests/tests/Filtre/TexteBackendqTest.php b/tests/tests/Filtre/TexteBackendqTest.php new file mode 100644 index 0000000000..2ddec16148 --- /dev/null +++ b/tests/tests/Filtre/TexteBackendqTest.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction texte_backendq du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class TexteBackendqTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresTexteBackendq + */ + public function testFiltresTexteBackendq($expected, ...$args): void + { + $actual = texte_backendq(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresTexteBackendq(): array + { + return [ + 0 => [ + 0 => '', + 1 => '', + ], + 1 => [ + 0 => '0', + 1 => '0', + ], + 2 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 3 => [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + ], + 4 => [ + 0 => 'Un texte sans entites &<>"\\\'', + 1 => 'Un texte sans entites &<>"\'', + ], + 5 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 6 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + ]; + } +} diff --git a/tests/tests/Filtre/WrapTest.php b/tests/tests/Filtre/WrapTest.php new file mode 100644 index 0000000000..cc3329edb4 --- /dev/null +++ b/tests/tests/Filtre/WrapTest.php @@ -0,0 +1,49 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction wrap du fichier inc/filtres.php + */ + +namespace Spip\Core\Tests\Filtre; + +use PHPUnit\Framework\TestCase; + +class WrapTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerFiltresWrap + */ + public function testFiltresWrap($expected, ...$args): void + { + $actual = wrap(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFiltresWrap(): array + { + return [ + 0 => [ + 0 => '<h3>un mot</h3>', + 1 => 'un mot', + 2 => '<h3>', + ], + 1 => [ + 0 => '<h3><b>un mot</b></h3>', + 1 => 'un mot', + 2 => '<h3><b>', + ], + 2 => [ + 0 => '<h3 class="spip"><b>un mot</b></h3>', + 1 => 'un mot', + 2 => '<h3 class="spip"><b>', + ], + ]; + } +} diff --git a/tests/tests/Fixtures/data/dailymotion.rss b/tests/tests/Fixtures/data/dailymotion.rss new file mode 100644 index 0000000000..621ea9b7c0 --- /dev/null +++ b/tests/tests/Fixtures/data/dailymotion.rss @@ -0,0 +1,277 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- http://www.dailymotion.com/rss --> +<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss"> + <channel> + <title>Dailymotion - vidéos</title> + <description><![CDATA[Dailymotion/]]></description> + <link>http://www.dailymotion.com/</link> + <lastBuildDate>Mon, 21 May 2007 20:41:26 +0100</lastBuildDate> + <item> + <title>But de Raul</title> + <link>http://www.dailymotion.com/video/x21kjg_but-de-raul?from=rss</link> + <description><![CDATA[<a href="http://www.dailymotion.com/video/x21kjg_but-de-raul?from=rss"><img align="left" width="120" height="90" src="http://static-02.dailymotion.com/dyn/preview/160x120/3432508.jpg?20070521203049" style="border: 1px solid black"></a><p></p><p>Auteur : <a href="http://www.dailymotion.com/Deep_33?from=rss">Deep_33</a><br />Tags : <a href="http://www.dailymotion.com/tag/but">but</a> <a href="http://www.dailymotion.com/tag/raul">raul</a> <a href="http://www.dailymotion.com/tag/country:FR">country:FR</a> <a href="http://www.dailymotion.com/tag/user-category:videogames">user-category:videogames</a> <br />Envoyé : 21 mai 2007<br /></p>]]></description> + <author>rss@dailymotion.com (Deep_33)</author> + <pubDate>Mon, 21 May 2007 18:29:16 +0100</pubDate> + <guid>http://www.dailymotion.com/video/x21kjg_but-de-raul</guid> + <media:title>But de Raul</media:title> + <media:credit>Deep_33</media:credit> + <media:thumbnail url="http://static-02.dailymotion.com/dyn/preview/320x240/3432508.jpg?20070521203049" height="240" width="320" /> + <media:player url="http://www.dailymotion.com/video/x21kjg_but-de-raul" height="600" width="800" /> + <media:group> + <media:content url="http://www.dailymotion.com/get/14/320x240/flv/3432508.flv?key=ba2fc1a1600571b2d689662abe2cbe7012c2f81.flv" type="video/x-flv" duration="24" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/get/14/80x60/flv/3432508.flv?key=ba2fc1a1600571b2d689662abe2cbe7012c2f81.flv" type="video/x-flv" duration="24" width="80" height="60"/> + <media:content url="http://www.dailymotion.com/get/14/320x240/mp4/3432508.mp4?key=ba2fc1a1600571b2d689662abe2cbe7012c2f81.mp4" type="video/mp4" duration="24" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/swf/3YR951no8lVHMeoX2" type="application/x-shockwave-flash" duration="24" width="320" height="240"/> + </media:group> + <media:category>but</media:category> + <media:category>raul</media:category> + <media:category>country:FR</media:category> + <media:category>user-category:videogames</media:category> + </item> + <item> + <title>boom</title> + <link>http://www.dailymotion.com/video/x21kja_boom?from=rss</link> + <description><![CDATA[<a href="http://www.dailymotion.com/video/x21kja_boom?from=rss"><img align="left" width="120" height="90" src="http://static-03.dailymotion.com/dyn/preview/160x120/3432502.jpg?20070521203049" style="border: 1px solid black"></a><p></p><p>Auteur : <a href="http://www.dailymotion.com/pimppin?from=rss">pimppin</a><br />Tags : <a href="http://www.dailymotion.com/tag/comercial">comercial</a> <a href="http://www.dailymotion.com/tag/boom">boom</a> <a href="http://www.dailymotion.com/tag/sport">sport</a> <a href="http://www.dailymotion.com/tag/+1">1</a> <a href="http://www.dailymotion.com/tag/country:RO">country:RO</a> <a href="http://www.dailymotion.com/tag/user-category:creation">user-category:creation</a> <a href="http://www.dailymotion.com/tag/user-category:shortfilms">user-category:shortfilms</a> <br />Envoyé : 21 mai 2007<br /></p>]]></description> + <author>rss@dailymotion.com (pimppin)</author> + <pubDate>Mon, 21 May 2007 18:29:02 +0100</pubDate> + <guid>http://www.dailymotion.com/video/x21kja_boom</guid> + <media:title>boom</media:title> + <media:credit>pimppin</media:credit> + <media:thumbnail url="http://static-03.dailymotion.com/dyn/preview/320x240/3432502.jpg?20070521203049" height="240" width="320" /> + <media:player url="http://www.dailymotion.com/video/x21kja_boom" height="600" width="800" /> + <media:group> + <media:content url="http://www.dailymotion.com/get/14/320x240/flv/3432502.flv?key=3c2445c11eaec953ad911d0f7228c3e312c2f81.flv" type="video/x-flv" duration="23" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/get/14/80x60/flv/3432502.flv?key=3c2445c11eaec953ad911d0f7228c3e312c2f81.flv" type="video/x-flv" duration="23" width="80" height="60"/> + <media:content url="http://www.dailymotion.com/get/14/320x240/mp4/3432502.mp4?key=3c2445c11eaec953ad911d0f7228c3e312c2f81.mp4" type="video/mp4" duration="23" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/swf/4uWhd1F18qOFyeoWW" type="application/x-shockwave-flash" duration="23" width="320" height="240"/> + </media:group> + <media:category>comercial</media:category> + <media:category>boom</media:category> + <media:category>sport</media:category> + <media:category>1</media:category> + <media:category>country:RO</media:category> + <media:category>user-category:creation</media:category> + <media:category>user-category:shortfilms</media:category> + </item> + <item> + <title>37 rdc 85yz</title> + <link>http://www.dailymotion.com/video/x21kiy_37-rdc-85yz?from=rss</link> + <description><![CDATA[<a href="http://www.dailymotion.com/video/x21kiy_37-rdc-85yz?from=rss"><img align="left" width="120" height="90" src="http://static-05.dailymotion.com/dyn/preview/160x120/3432490.jpg?20070521203049" style="border: 1px solid black"></a><p></p><p>Auteur : <a href="http://www.dailymotion.com/med37?from=rss">med37</a><br />Tags : <a href="http://www.dailymotion.com/tag/yz">yz</a> <a href="http://www.dailymotion.com/tag/ktm">ktm</a> <a href="http://www.dailymotion.com/tag/cr">cr</a> <a href="http://www.dailymotion.com/tag/kx">kx</a> <a href="http://www.dailymotion.com/tag/rm">rm</a> <a href="http://www.dailymotion.com/tag/cross">cross</a> <a href="http://www.dailymotion.com/tag/quartier">quartier</a> <a href="http://www.dailymotion.com/tag/cité">cité</a> <a href="http://www.dailymotion.com/tag/banlieu">banlieu</a> <a href="http://www.dailymotion.com/tag/tours">tours</a> <a href="http://www.dailymotion.com/tag/rive">rive</a> <a href="http://www.dailymotion.com/tag/du">du</a> <a href="http://www.dailymotion.com/tag/cher">cher</a> <a href="http://www.dailymotion.com/tag/rdc">rdc</a> <a href="http://www.dailymotion.com/tag/mehdi">mehdi</a> <a href="http://www.dailymotion.com/tag/lim">lim</a> <a href="http://www.dailymotion.com/tag/+37">37</a> <a href="http://www.dailymotion.com/tag/city:Tours">city:Tours</a> <a href="http://www.dailymotion.com/tag/country:FR">country:FR</a> <a href="http://www.dailymotion.com/tag/user-category:auto">user-category:auto</a> <a href="http://www.dailymotion.com/tag/user-category:sport">user-category:sport</a> <br />Envoyé : 21 mai 2007<br /></p>]]></description> + <author>rss@dailymotion.com (med37)</author> + <pubDate>Mon, 21 May 2007 18:27:58 +0100</pubDate> + <guid>http://www.dailymotion.com/video/x21kiy_37-rdc-85yz</guid> + <media:title>37 rdc 85yz</media:title> + <media:credit>med37</media:credit> + <media:thumbnail url="http://static-05.dailymotion.com/dyn/preview/320x240/3432490.jpg?20070521203049" height="240" width="320" /> + <media:player url="http://www.dailymotion.com/video/x21kiy_37-rdc-85yz" height="600" width="800" /> + <media:group> + <media:content url="http://www.dailymotion.com/get/14/320x240/flv/3432490.flv?key=deb1ae73afd54e99f7747119ff35d67f12c2f81.flv" type="video/x-flv" duration="7" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/get/14/80x60/flv/3432490.flv?key=deb1ae73afd54e99f7747119ff35d67f12c2f81.flv" type="video/x-flv" duration="7" width="80" height="60"/> + <media:content url="http://www.dailymotion.com/get/14/320x240/mp4/3432490.mp4?key=deb1ae73afd54e99f7747119ff35d67f12c2f81.mp4" type="video/mp4" duration="7" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/swf/56YNKiA1rOWeReoWK" type="application/x-shockwave-flash" duration="7" width="320" height="240"/> + </media:group> + <media:category>yz</media:category> + <media:category>ktm</media:category> + <media:category>cr</media:category> + <media:category>kx</media:category> + <media:category>rm</media:category> + <media:category>cross</media:category> + <media:category>quartier</media:category> + <media:category>cité</media:category> + <media:category>banlieu</media:category> + <media:category>tours</media:category> + <media:category>rive</media:category> + <media:category>du</media:category> + <media:category>cher</media:category> + <media:category>rdc</media:category> + <media:category>mehdi</media:category> + <media:category>lim</media:category> + <media:category>37</media:category> + <media:category>city:Tours</media:category> + <media:category>country:FR</media:category> + <media:category>user-category:auto</media:category> + <media:category>user-category:sport</media:category> + </item> + <item> + <title>Moumour & moumourette</title> + <link>http://www.dailymotion.com/video/x21kix_moumour-moumourette?from=rss</link> + <description><![CDATA[<a href="http://www.dailymotion.com/video/x21kix_moumour-moumourette?from=rss"><img align="left" width="120" height="90" src="http://static-04.dailymotion.com/dyn/preview/160x120/3432489.jpg?20070521203049" style="border: 1px solid black"></a><p></p><p>Auteur : <a href="http://www.dailymotion.com/Fred_et_Manon?from=rss">Fred_et_Manon</a><br />Tags : <a href="http://www.dailymotion.com/tag/L'amour">L'amour</a> <a href="http://www.dailymotion.com/tag/parfait">parfait</a> <a href="http://www.dailymotion.com/tag/city:Hasnon">city:Hasnon</a> <a href="http://www.dailymotion.com/tag/country:FR">country:FR</a> <a href="http://www.dailymotion.com/tag/user-category:blog">user-category:blog</a> <br />Envoyé : 21 mai 2007<br /></p>]]></description> + <author>rss@dailymotion.com (Fred_et_Manon)</author> + <pubDate>Mon, 21 May 2007 18:27:37 +0100</pubDate> + <guid>http://www.dailymotion.com/video/x21kix_moumour-moumourette</guid> + <media:title>Moumour & moumourette</media:title> + <media:credit>Fred_et_Manon</media:credit> + <media:thumbnail url="http://static-04.dailymotion.com/dyn/preview/320x240/3432489.jpg?20070521203049" height="240" width="320" /> + <media:player url="http://www.dailymotion.com/video/x21kix_moumour-moumourette" height="600" width="800" /> + <media:group> + <media:content url="http://www.dailymotion.com/get/14/320x240/flv/3432489.flv?key=84e1eedbdfa9bc91599fa805c68f61a212c2f81.flv" type="video/x-flv" duration="212" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/get/14/80x60/flv/3432489.flv?key=84e1eedbdfa9bc91599fa805c68f61a212c2f81.flv" type="video/x-flv" duration="212" width="80" height="60"/> + <media:content url="http://www.dailymotion.com/get/14/320x240/mp4/3432489.mp4?key=84e1eedbdfa9bc91599fa805c68f61a212c2f81.mp4" type="video/mp4" duration="212" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/swf/12bPjPG66PRC7eoWJ" type="application/x-shockwave-flash" duration="212" width="320" height="240"/> + </media:group> + <media:category>L'amour</media:category> + <media:category>parfait</media:category> + <media:category>city:Hasnon</media:category> + <media:category>country:FR</media:category> + <media:category>user-category:blog</media:category> + </item> + <item> + <title>Le Week-End en Bretagne</title> + <link>http://www.dailymotion.com/video/x21kiq_le-weekend-en-bretagne?from=rss</link> + <description><![CDATA[<a href="http://www.dailymotion.com/video/x21kiq_le-weekend-en-bretagne?from=rss"><img align="left" width="120" height="90" src="http://static-04.dailymotion.com/dyn/preview/160x120/3432482.jpg?20070521203049" style="border: 1px solid black"></a><p>Vidéo à retravailler (trop sombre, mettez la luminosité de votre écran à fond pour y voir quelque chose) des membres de l'association Sudria Fun Board durant le week-end en Bretagne.</p><p>Auteur : <a href="http://www.dailymotion.com/sudriafunboard?from=rss">sudriafunboard</a><br />Tags : <a href="http://www.dailymotion.com/tag/surf">surf</a> <a href="http://www.dailymotion.com/tag/week-end">week-end</a> <a href="http://www.dailymotion.com/tag/bretagne">bretagne</a> <a href="http://www.dailymotion.com/tag/sudria">sudria</a> <a href="http://www.dailymotion.com/tag/fun">fun</a> <a href="http://www.dailymotion.com/tag/board">board</a> <a href="http://www.dailymotion.com/tag/country:FR">country:FR</a> <a href="http://www.dailymotion.com/tag/user-category:sport">user-category:sport</a> <br />Envoyé : 21 mai 2007<br /></p>]]></description> + <author>rss@dailymotion.com (sudriafunboard)</author> + <pubDate>Mon, 21 May 2007 18:27:15 +0100</pubDate> + <guid>http://www.dailymotion.com/video/x21kiq_le-weekend-en-bretagne</guid> + <media:title>Le Week-End en Bretagne</media:title> + <media:credit>sudriafunboard</media:credit> + <media:thumbnail url="http://static-04.dailymotion.com/dyn/preview/320x240/3432482.jpg?20070521203049" height="240" width="320" /> + <media:player url="http://www.dailymotion.com/video/x21kiq_le-weekend-en-bretagne" height="600" width="800" /> + <media:group> + <media:content url="http://www.dailymotion.com/get/14/320x240/flv/3432482.flv?key=ec50691a44691c12cfc8606d00c4145912c2f81.flv" type="video/x-flv" duration="37" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/get/14/80x60/flv/3432482.flv?key=ec50691a44691c12cfc8606d00c4145912c2f81.flv" type="video/x-flv" duration="37" width="80" height="60"/> + <media:content url="http://www.dailymotion.com/get/14/320x240/mp4/3432482.mp4?key=ec50691a44691c12cfc8606d00c4145912c2f81.mp4" type="video/mp4" duration="37" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/swf/6KVd1PJFd9l3zeoWC" type="application/x-shockwave-flash" duration="37" width="320" height="240"/> + </media:group> + <media:category>surf</media:category> + <media:category>week-end</media:category> + <media:category>bretagne</media:category> + <media:category>sudria</media:category> + <media:category>fun</media:category> + <media:category>board</media:category> + <media:category>country:FR</media:category> + <media:category>user-category:sport</media:category> + </item> + <item> + <title>After Effects Animation: Placing an image</title> + <link>http://www.dailymotion.com/video/x21kip_after-effects-animation-placing-an?from=rss</link> + <description><![CDATA[<a href="http://www.dailymotion.com/video/x21kip_after-effects-animation-placing-an?from=rss"><img align="left" width="120" height="90" src="http://static-03.dailymotion.com/dyn/preview/160x120/3432481.jpg?20070521203049" style="border: 1px solid black"></a><p></p><p>Auteur : <a href="http://www.dailymotion.com/helptronica?from=rss">helptronica</a><br />Tags : <a href="http://www.dailymotion.com/tag/Animation">Animation</a> <a href="http://www.dailymotion.com/tag/After">After</a> <a href="http://www.dailymotion.com/tag/Effects">Effects</a> <a href="http://www.dailymotion.com/tag/Composition">Composition</a> <a href="http://www.dailymotion.com/tag/Basic">Basic</a> <a href="http://www.dailymotion.com/tag/Tutorial">Tutorial</a> <a href="http://www.dailymotion.com/tag/Beginer">Beginer</a> <a href="http://www.dailymotion.com/tag/Image">Image</a> <a href="http://www.dailymotion.com/tag/Motion">Motion</a> <a href="http://www.dailymotion.com/tag/Graphics">Graphics</a> <a href="http://www.dailymotion.com/tag/Collage">Collage</a> <a href="http://www.dailymotion.com/tag/city:Washington DC">city:Washington DC</a> <a href="http://www.dailymotion.com/tag/country:US">country:US</a> <a href="http://www.dailymotion.com/tag/user-category:business">user-category:business</a> <a href="http://www.dailymotion.com/tag/user-category:school">user-category:school</a> <br />Envoyé : 21 mai 2007<br /></p>]]></description> + <author>rss@dailymotion.com (helptronica)</author> + <pubDate>Mon, 21 May 2007 18:27:13 +0100</pubDate> + <guid>http://www.dailymotion.com/video/x21kip_after-effects-animation-placing-an</guid> + <media:title>After Effects Animation: Placing an image</media:title> + <media:credit>helptronica</media:credit> + <media:thumbnail url="http://static-03.dailymotion.com/dyn/preview/320x240/3432481.jpg?20070521203049" height="240" width="320" /> + <media:player url="http://www.dailymotion.com/video/x21kip_after-effects-animation-placing-an" height="600" width="800" /> + <media:group> + <media:content url="http://www.dailymotion.com/get/14/320x240/flv/3432481.flv?key=d9c13dc33b6b37e1502cda2abca7bdc812c2f81.flv" type="video/x-flv" duration="43" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/get/14/80x60/flv/3432481.flv?key=d9c13dc33b6b37e1502cda2abca7bdc812c2f81.flv" type="video/x-flv" duration="43" width="80" height="60"/> + <media:content url="http://www.dailymotion.com/get/14/320x240/mp4/3432481.mp4?key=d9c13dc33b6b37e1502cda2abca7bdc812c2f81.mp4" type="video/mp4" duration="43" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/swf/56BNIle19KD7SeoWB" type="application/x-shockwave-flash" duration="43" width="320" height="240"/> + </media:group> + <media:category>Animation</media:category> + <media:category>After</media:category> + <media:category>Effects</media:category> + <media:category>Composition</media:category> + <media:category>Basic</media:category> + <media:category>Tutorial</media:category> + <media:category>Beginer</media:category> + <media:category>Image</media:category> + <media:category>Motion</media:category> + <media:category>Graphics</media:category> + <media:category>Collage</media:category> + <media:category>city:Washington DC</media:category> + <media:category>country:US</media:category> + <media:category>user-category:business</media:category> + <media:category>user-category:school</media:category> + </item> + <item> + <title>Kelli110-1[1]</title> + <link>http://www.dailymotion.com/video/x21kin_kelli11011?from=rss</link> + <description><![CDATA[<a href="http://www.dailymotion.com/video/x21kin_kelli11011?from=rss"><img align="left" width="120" height="90" src="http://static-01.dailymotion.com/dyn/preview/160x120/3432479.jpg?20070521203049" style="border: 1px solid black"></a><p></p><p>Auteur : <a href="http://www.dailymotion.com/Pirate_Penguin?from=rss">Pirate_Penguin</a><br />Tags : <a href="http://www.dailymotion.com/tag/girl">girl</a> <a href="http://www.dailymotion.com/tag/peed">peed</a> <a href="http://www.dailymotion.com/tag/country:US">country:US</a> <a href="http://www.dailymotion.com/tag/user-category:fun">user-category:fun</a> <a href="http://www.dailymotion.com/tag/user-category:people">user-category:people</a> <br />Envoyé : 21 mai 2007<br /></p>]]></description> + <author>rss@dailymotion.com (Pirate_Penguin)</author> + <pubDate>Mon, 21 May 2007 18:27:05 +0100</pubDate> + <guid>http://www.dailymotion.com/video/x21kin_kelli11011</guid> + <media:title>Kelli110-1[1]</media:title> + <media:credit>Pirate_Penguin</media:credit> + <media:thumbnail url="http://static-01.dailymotion.com/dyn/preview/320x240/3432479.jpg?20070521203049" height="240" width="320" /> + <media:player url="http://www.dailymotion.com/video/x21kin_kelli11011" height="600" width="800" /> + <media:group> + <media:content url="http://www.dailymotion.com/get/14/320x240/flv/3432479.flv?key=1e71d75ba64b399b133a5f2c5acce4fe12c2f81.flv" type="video/x-flv" duration="50" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/get/14/80x60/flv/3432479.flv?key=1e71d75ba64b399b133a5f2c5acce4fe12c2f81.flv" type="video/x-flv" duration="50" width="80" height="60"/> + <media:content url="http://www.dailymotion.com/get/14/320x240/mp4/3432479.mp4?key=1e71d75ba64b399b133a5f2c5acce4fe12c2f81.mp4" type="video/mp4" duration="50" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/swf/R7x39FMkd1UuoeoWz" type="application/x-shockwave-flash" duration="50" width="320" height="240"/> + </media:group> + <media:category>girl</media:category> + <media:category>peed</media:category> + <media:category>country:US</media:category> + <media:category>user-category:fun</media:category> + <media:category>user-category:people</media:category> + </item> + <item> + <title>VOICI LE PROCHAIN NEED FOR SPEED</title> + <link>http://www.dailymotion.com/video/x21kik_voici-le-prochain-need-for-speed?from=rss</link> + <description><![CDATA[<a href="http://www.dailymotion.com/video/x21kik_voici-le-prochain-need-for-speed?from=rss"><img align="left" width="120" height="90" src="http://static-05.dailymotion.com/dyn/preview/160x120/3432476.jpg?20070521203049" style="border: 1px solid black"></a><p></p><p>Auteur : <a href="http://www.dailymotion.com/KEVIN300ZX?from=rss">KEVIN300ZX</a><br />Tags : <a href="http://www.dailymotion.com/tag/TUNING">TUNING</a> <a href="http://www.dailymotion.com/tag/city:isigny le buat">city:isigny le buat</a> <a href="http://www.dailymotion.com/tag/country:FR">country:FR</a> <a href="http://www.dailymotion.com/tag/user-category:shortfilms">user-category:shortfilms</a> <a href="http://www.dailymotion.com/tag/user-category:videogames">user-category:videogames</a> <br />Envoyé : 21 mai 2007<br /></p>]]></description> + <author>rss@dailymotion.com (KEVIN300ZX)</author> + <pubDate>Mon, 21 May 2007 18:26:59 +0100</pubDate> + <guid>http://www.dailymotion.com/video/x21kik_voici-le-prochain-need-for-speed</guid> + <media:title>VOICI LE PROCHAIN NEED FOR SPEED</media:title> + <media:credit>KEVIN300ZX</media:credit> + <media:thumbnail url="http://static-05.dailymotion.com/dyn/preview/320x240/3432476.jpg?20070521203049" height="240" width="320" /> + <media:player url="http://www.dailymotion.com/video/x21kik_voici-le-prochain-need-for-speed" height="600" width="800" /> + <media:group> + <media:content url="http://www.dailymotion.com/get/14/320x240/flv/3432476.flv?key=46d08cfae6a3c75c20badd5383fb6f2012c2f81.flv" type="video/x-flv" duration="55" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/get/14/80x60/flv/3432476.flv?key=46d08cfae6a3c75c20badd5383fb6f2012c2f81.flv" type="video/x-flv" duration="55" width="80" height="60"/> + <media:content url="http://www.dailymotion.com/get/14/320x240/mp4/3432476.mp4?key=46d08cfae6a3c75c20badd5383fb6f2012c2f81.mp4" type="video/mp4" duration="55" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/swf/3VFzaUh0bALOmeoWw" type="application/x-shockwave-flash" duration="55" width="320" height="240"/> + </media:group> + <media:category>TUNING</media:category> + <media:category>city:isigny le buat</media:category> + <media:category>country:FR</media:category> + <media:category>user-category:shortfilms</media:category> + <media:category>user-category:videogames</media:category> + </item> + <item> + <title>But d'Henry</title> + <link>http://www.dailymotion.com/video/x21kii_but-dhenry?from=rss</link> + <description><![CDATA[<a href="http://www.dailymotion.com/video/x21kii_but-dhenry?from=rss"><img align="left" width="120" height="90" src="http://static-03.dailymotion.com/dyn/preview/160x120/3432474.jpg?20070521203049" style="border: 1px solid black"></a><p></p><p>Auteur : <a href="http://www.dailymotion.com/Deep_33?from=rss">Deep_33</a><br />Tags : <a href="http://www.dailymotion.com/tag/but">but</a> <a href="http://www.dailymotion.com/tag/henry">henry</a> <a href="http://www.dailymotion.com/tag/country:FR">country:FR</a> <a href="http://www.dailymotion.com/tag/user-category:videogames">user-category:videogames</a> <br />Envoyé : 21 mai 2007<br /></p>]]></description> + <author>rss@dailymotion.com (Deep_33)</author> + <pubDate>Mon, 21 May 2007 18:26:49 +0100</pubDate> + <guid>http://www.dailymotion.com/video/x21kii_but-dhenry</guid> + <media:title>But d'Henry</media:title> + <media:credit>Deep_33</media:credit> + <media:thumbnail url="http://static-03.dailymotion.com/dyn/preview/320x240/3432474.jpg?20070521203049" height="240" width="320" /> + <media:player url="http://www.dailymotion.com/video/x21kii_but-dhenry" height="600" width="800" /> + <media:group> + <media:content url="http://www.dailymotion.com/get/14/320x240/flv/3432474.flv?key=66279e86229d67f489c23dec246f52ec12c2f81.flv" type="video/x-flv" duration="23" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/get/14/80x60/flv/3432474.flv?key=66279e86229d67f489c23dec246f52ec12c2f81.flv" type="video/x-flv" duration="23" width="80" height="60"/> + <media:content url="http://www.dailymotion.com/get/14/320x240/mp4/3432474.mp4?key=66279e86229d67f489c23dec246f52ec12c2f81.mp4" type="video/mp4" duration="23" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/swf/2mdIxUmyignHweoWu" type="application/x-shockwave-flash" duration="23" width="320" height="240"/> + </media:group> + <media:category>but</media:category> + <media:category>henry</media:category> + <media:category>country:FR</media:category> + <media:category>user-category:videogames</media:category> + </item> + <item> + <title>Running_Machine</title> + <link>http://www.dailymotion.com/video/x21kig_runningmachine?from=rss</link> + <description><![CDATA[<a href="http://www.dailymotion.com/video/x21kig_runningmachine?from=rss"><img align="left" width="120" height="90" src="http://static-01.dailymotion.com/dyn/preview/160x120/3432472.jpg?20070521203049" style="border: 1px solid black"></a><p></p><p>Auteur : <a href="http://www.dailymotion.com/mt345?from=rss">mt345</a><br />Tags : <a href="http://www.dailymotion.com/tag/run">run</a> <a href="http://www.dailymotion.com/tag/running">running</a> <a href="http://www.dailymotion.com/tag/tapis">tapis</a> <a href="http://www.dailymotion.com/tag/roulant">roulant</a> <a href="http://www.dailymotion.com/tag/ours">ours</a> <a href="http://www.dailymotion.com/tag/nounours">nounours</a> <a href="http://www.dailymotion.com/tag/fun">fun</a> <a href="http://www.dailymotion.com/tag/funny">funny</a> <a href="http://www.dailymotion.com/tag/humour">humour</a> <a href="http://www.dailymotion.com/tag/drole">drole</a> <a href="http://www.dailymotion.com/tag/video">video</a> <a href="http://www.dailymotion.com/tag/country:FR">country:FR</a> <a href="http://www.dailymotion.com/tag/user-category:fun">user-category:fun</a> <br />Envoyé : 21 mai 2007<br /></p>]]></description> + <author>rss@dailymotion.com (mt345)</author> + <pubDate>Mon, 21 May 2007 18:26:39 +0100</pubDate> + <guid>http://www.dailymotion.com/video/x21kig_runningmachine</guid> + <media:title>Running_Machine</media:title> + <media:credit>mt345</media:credit> + <media:thumbnail url="http://static-01.dailymotion.com/dyn/preview/320x240/3432472.jpg?20070521203049" height="240" width="320" /> + <media:player url="http://www.dailymotion.com/video/x21kig_runningmachine" height="600" width="800" /> + <media:group> + <media:content url="http://www.dailymotion.com/get/14/320x240/flv/3432472.flv?key=d5f487be1cb9edfab8e9e4bcf91916f112c2f81.flv" type="video/x-flv" duration="93" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/get/14/80x60/flv/3432472.flv?key=d5f487be1cb9edfab8e9e4bcf91916f112c2f81.flv" type="video/x-flv" duration="93" width="80" height="60"/> + <media:content url="http://www.dailymotion.com/get/14/320x240/mp4/3432472.mp4?key=d5f487be1cb9edfab8e9e4bcf91916f112c2f81.mp4" type="video/mp4" duration="93" width="320" height="240"/> + <media:content url="http://www.dailymotion.com/swf/6FoVMbi0qfhNNeoWs" type="application/x-shockwave-flash" duration="93" width="320" height="240"/> + </media:group> + <media:category>run</media:category> + <media:category>running</media:category> + <media:category>tapis</media:category> + <media:category>roulant</media:category> + <media:category>ours</media:category> + <media:category>nounours</media:category> + <media:category>fun</media:category> + <media:category>funny</media:category> + <media:category>humour</media:category> + <media:category>drole</media:category> + <media:category>video</media:category> + <media:category>country:FR</media:category> + <media:category>user-category:fun</media:category> + </item> + </channel> +</rss> diff --git a/tests/tests/Format/Json/Var2jsTest.php b/tests/tests/Format/Json/Var2jsTest.php new file mode 100644 index 0000000000..eddbe8e4fb --- /dev/null +++ b/tests/tests/Format/Json/Var2jsTest.php @@ -0,0 +1,212 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction var2js du fichier ./inc/json.php + */ + +namespace Spip\Core\Tests\Format\Json; + +use PHPUnit\Framework\TestCase; + +class Var2jsTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/json.php', '', true); + } + + /** + * @dataProvider providerJsonVar2js + */ + public function testJsonVar2js($expected, ...$args): void + { + $actual = var2js(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerJsonVar2js(): array + { + return [ + 0 => [ + 0 => 'true', + 1 => true, + ], + 1 => [ + 0 => 'false', + 1 => false, + ], + 2 => [ + 0 => '0', + 1 => 0, + ], + 3 => [ + 0 => '-1', + 1 => -1, + ], + 4 => [ + 0 => '1', + 1 => 1, + ], + 5 => [ + 0 => '2', + 1 => 2, + ], + 6 => [ + 0 => '3', + 1 => 3, + ], + 7 => [ + 0 => '4', + 1 => 4, + ], + 8 => [ + 0 => '5', + 1 => 5, + ], + 9 => [ + 0 => '6', + 1 => 6, + ], + 10 => [ + 0 => '7', + 1 => 7, + ], + 11 => [ + 0 => '10', + 1 => 10, + ], + 12 => [ + 0 => '20', + 1 => 20, + ], + 13 => [ + 0 => '30', + 1 => 30, + ], + 14 => [ + 0 => '50', + 1 => 50, + ], + 15 => [ + 0 => '100', + 1 => 100, + ], + 16 => [ + 0 => '1000', + 1 => 1000, + ], + 17 => [ + 0 => '10000', + 1 => 10000, + ], + 18 => [ + 0 => '""', + 1 => '', + ], + 19 => [ + 0 => '"0"', + 1 => '0', + ], + 20 => [ + 0 => '"Un texte avec des <a href=\"http:\/\/spip.net\">liens<\/a> [Article 1->art1] [spip->http:\/\/www.spip.net] http:\/\/www.spip.net"', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 21 => [ + 0 => '"Un texte avec des entités &<>""', + 1 => 'Un texte avec des entités &<>"', + ], + 22 => [ + 0 => '"Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;"', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + ], + 23 => [ + 0 => '"Un texte avec des entités numériques &<>""', + 1 => 'Un texte avec des entités numériques &<>"', + ], + 24 => [ + 0 => '"Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;"', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + ], + 25 => [ + 0 => '"Un texte sans entites &<>\"\'"', + 1 => 'Un texte sans entites &<>"\'', + ], + 26 => [ + 0 => '"{{{Des raccourcis}}} {italique} {{gras}} <code>du code<\/code>"', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 27 => [ + 0 => '"Un modele <modeleinexistant|lien=[->http:\/\/www.spip.net]>"', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 28 => [ + 0 => '"Un texte avec des retour\na la ligne et meme des\n\nparagraphes"', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + 29 => [ + 0 => '[]', + 1 => [], + ], + 30 => [ + 0 => '["","0","Un texte avec des <a href=\"http:\/\/spip.net\">liens<\/a> [Article 1->art1] [spip->http:\/\/www.spip.net] http:\/\/www.spip.net","Un texte avec des entités &<>"","Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;","Un texte avec des entités numériques &<>"","Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;","Un texte sans entites &<>\"\'","{{{Des raccourcis}}} {italique} {{gras}} <code>du code<\/code>","Un modele <modeleinexistant|lien=[->http:\/\/www.spip.net]>","Un texte avec des retour\na la ligne et meme des\n\nparagraphes"]', + 1 => [ + 0 => '', + 1 => '0', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 3 => 'Un texte avec des entités &<>"', + 4 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 5 => 'Un texte avec des entités numériques &<>"', + 6 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 7 => 'Un texte sans entites &<>"\'', + 8 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 9 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 10 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + ], + 31 => [ + 0 => '[0,-1,1,2,3,4,5,6,7,10,20,30,50,100,1000,10000]', + 1 => [ + 0 => 0, + 1 => -1, + 2 => 1, + 3 => 2, + 4 => 3, + 5 => 4, + 6 => 5, + 7 => 6, + 8 => 7, + 9 => 10, + 10 => 20, + 11 => 30, + 12 => 50, + 13 => 100, + 14 => 1000, + 15 => 10000, + ], + ], + 32 => [ + 0 => '[true,false]', + 1 => [ + 0 => true, + 1 => false, + ], + ], + 33 => [ + 0 => 'null', + 1 => null, + ], + 34 => [ + 0 => 'null', + 1 => null, + ], + ]; + } +} diff --git a/tests/tests/Format/Xml/SpipXmlParseTest.php b/tests/tests/Format/Xml/SpipXmlParseTest.php new file mode 100644 index 0000000000..54290dea13 --- /dev/null +++ b/tests/tests/Format/Xml/SpipXmlParseTest.php @@ -0,0 +1,118 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction spip_xml_parse du fichier inc/xml.php + */ + +namespace Spip\Core\Tests\Format\Xml; + +use PHPUnit\Framework\TestCase; + +class SpipXmlParseTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/xml.php', '', true); + } + + /** + * @dataProvider providerXmlSpipXmlParse + */ + public function testXmlSpipXmlParse($expected, ...$args): void + { + $actual = serialize(spip_xml_parse(...$args)); + $this->assertSame($expected, $actual); + } + + public static function providerXmlSpipXmlParse(): array + { + $essais = []; + $xml1 = '<' . <<<CODE_SAMPLE +?xml version="1.0" encoding="utf-8"?> +<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"> +<url><loc>http://localhost/_core/spip/spip.php?breve25</loc> +<lastmod>2003-12-31</lastmod> +<priority>0.8</priority> +</url> +<url> +<loc>http://localhost/_core/spip/spip.php?breve32</loc> +<lastmod>2004-02-10</lastmod> +<priority>0.8</priority> +</url> +<url> +<loc>http://localhost/_core/spip/spip.php?breve64</loc> +<lastmod>2005-01-31</lastmod> +<priority>0.8</priority> +</url> +</urlset> +CODE_SAMPLE; + $tree1 = <<<CODE_SAMPLE +a:1:{s:57:"urlset xmlns="http://www.google.com/schemas/sitemap/0.84"";a:1:{i:0;a:1:{s:3:"url";a:3:{i:0;a:3:{s:3:"loc";a:1:{i:0;s:44:"http://localhost/_core/spip/spip.php?breve25";}s:7:"lastmod";a:1:{i:0;s:10:"2003-12-31";}s:8:"priority";a:1:{i:0;s:3:"0.8";}}i:1;a:3:{s:3:"loc";a:1:{i:0;s:44:"http://localhost/_core/spip/spip.php?breve32";}s:7:"lastmod";a:1:{i:0;s:10:"2004-02-10";}s:8:"priority";a:1:{i:0;s:3:"0.8";}}i:2;a:3:{s:3:"loc";a:1:{i:0;s:44:"http://localhost/_core/spip/spip.php?breve64";}s:7:"lastmod";a:1:{i:0;s:10:"2005-01-31";}s:8:"priority";a:1:{i:0;s:3:"0.8";}}}}}} +CODE_SAMPLE; + $xml2 = '<' . <<<CODE_SAMPLE +?xml version="1.0" encoding="UTF-8"?> +<opml version="1.0"> + <head> + <title>arbo_riec</title> + <expansionState>0,9,14,24,28,30,31,35,41,43,44,46,48,55,58,61,66,71,74,77,78,82,87,89,90,92,96,98,102,110,112</expansionState> + </head> + <body> + <outline text="Citoyenneté"> + <outline text="Page d'accueil" Contenu="Articles et brèves d'actualité + Vos questions en direct"/> + <outline text="Le maire et les adjoints" Contenu="Nom, fonction, contact, horaires de permanence et photo de chaque élu" Fonctionnalité="Trombinoscope"/> + <outline text="Les conseillers municipaux" Contenu="idem" Fonctionnalité="Trombinoscope"/> + <outline text="Les commissions" Contenu="Présentation générale des commissions"> + <outline text="Une fiche par commission" Contenu="Domaine de compétence et membres"/> + </outline> + <outline text="Les conseils municipaux" Contenu="Présentation générale, téléchargement du dernier compte-rendu et agenda des prochains conseils" Fonctionnalité="Agenda"> + <outline text="Comptes-rendus" Contenu="Les comptes-rendus de conseils à télécharger" Fonctionnalité="Publications et archivage auto"> + <outline text="Un article par compte-rendu" Contenu="Texte ou doc à télécharger"/> + </outline> + </outline> + <outline text="Les réunions de quartier" Contenu="Présentation et agenda des réunions" Fonctionnalité="Agenda"/> + <outline text="L’Atelier municipal sur l’environnement" Contenu="Texte + photos"/> + <outline text="L’intercommunalité" Contenu="Texte de présentation + photos"> + <outline text="Cocopaq" Contenu="Texte + photos"/> + <outline text="Syndicat de Voirie de Rosporden" Contenu="Texte + photos"/> + <outline text="SIVU de Riec sur Bélon" Contenu="Texte + photos"/> + <outline text="Sicom" Contenu="Texte + photos"/> + <outline text="Syndicat d’eau et d’électricification de Riec sur Belon" Contenu="Texte + photos"/> + </outline> + </outline> + <outline text="Economie"> + <outline text="Page d'accueil" Contenu="Actualité + lien vers les marchés publics"/> + <outline text="Marchés publics" Contenu="Texte de présentation + contact"> + <outline text="Avis d'attribution" Contenu="Texte accueil et affichage des derniers avis" Fonctionnalité="Publications + archivage"> + <outline text="Un article par avis" Contenu="Texte ou doc à télécharger"/> + </outline> + <outline text="Avis de publicité" Contenu="Texte + affichage des avis en cours" Fonctionnalité="Marchés public"> + <outline text="Un article par avis" Contenu="Texte + docs à télécharger" Fonctionnalité="Un formulaire invite le visiteur à fournir son adresse email. Un email lui est alors automatiquement expédié qui contient un lien. En cliquant sur ce lien, le visiteur revient sur la page mais cette fois il a la possibilité de télécharger les pièces jointes à l'avis. Les mails sont ainsi collectés et ceux qui ont téléchargé les pièces peuvent ainsi être contactés en cas de changement."/> + </outline> + </outline> + <outline text="Les atouts de la ville"> + <outline text="Production ostréicole" Contenu="Texte + photos"/> + <outline text="Situation géographique" Contenu="Même contenu que dans La Ville ?" Fonctionnalité="modèle de duplication d'article"/> + </outline> + <outline text="S’implanter" Contenu="Texte + photos"/> + <outline text="Le GAER" Contenu="Texte + photos"/> + <outline text="Les commerces" Contenu="Présentation + formulaire d'inscription à l'annuaire" Fonctionnalité="Fonctionnalité annuaire"/> + <outline text="Les entreprises" Contenu="Présentation + formulaire d'inscription à l'annuaire" Fonctionnalité="Fonctionnalité annuaire"/> + <outline text="Les ZA et ZI" Contenu="Présentation + carte des ZA-ZI" Fonctionnalité="Carte interactive"> + <outline text="Une page par zone" Contenu="Fiche de présentation + photo + plan accès"/> + </outline> + <outline text="Le marché" Contenu="Texte + photos"/> + </outline> + <outline text="Tourisme version anglaise"/> + </body> +</opml> +CODE_SAMPLE; + $tree2 = <<<CODE_SAMPLE +a:1:{s:18:"opml version="1.0"";a:1:{i:0;a:2:{s:4:"head";a:1:{i:0;a:2:{s:5:"title";a:1:{i:0;s:9:"arbo_riec";}s:14:"expansionState";a:1:{i:0;s:93:"0,9,14,24,28,30,31,35,41,43,44,46,48,55,58,61,66,71,74,77,78,82,87,89,90,92,96,98,102,110,112";}}}s:4:"body";a:1:{i:0;a:3:{s:27:"outline text="Citoyenneté"";a:1:{i:0;a:8:{s:98:"outline text="Page d'accueil" Contenu="Articles et brèves d'actualité + Vos questions en direct"";a:1:{i:0;s:0:"";}s:152:"outline text="Le maire et les adjoints" Contenu="Nom, fonction, contact, horaires de permanence et photo de chaque élu" Fonctionnalité="Trombinoscope"";a:1:{i:0;s:0:"";}s:88:"outline text="Les conseillers municipaux" Contenu="idem" Fonctionnalité="Trombinoscope"";a:1:{i:0;s:0:"";}s:81:"outline text="Les commissions" Contenu="Présentation générale des commissions"";a:1:{i:0;a:1:{s:83:"outline text="Une fiche par commission" Contenu="Domaine de compétence et membres"";a:1:{i:0;s:0:"";}}}s:173:"outline text="Les conseils municipaux" Contenu="Présentation générale, téléchargement du dernier compte-rendu et agenda des prochains conseils" Fonctionnalité="Agenda"";a:1:{i:0;a:1:{s:136:"outline text="Comptes-rendus" Contenu="Les comptes-rendus de conseils à télécharger" Fonctionnalité="Publications et archivage auto"";a:1:{i:0;a:1:{s:82:"outline text="Un article par compte-rendu" Contenu="Texte ou doc à télécharger"";a:1:{i:0;s:0:"";}}}}}s:113:"outline text="Les réunions de quartier" Contenu="Présentation et agenda des réunions" Fonctionnalité="Agenda"";a:1:{i:0;s:0:"";}s:83:"outline text="L’Atelier municipal sur l’environnement" Contenu="Texte + photos"";a:1:{i:0;s:0:"";}s:78:"outline text="L’intercommunalité" Contenu="Texte de présentation + photos"";a:1:{i:0;a:5:{s:47:"outline text="Cocopaq" Contenu="Texte + photos"";a:1:{i:0;s:0:"";}s:71:"outline text="Syndicat de Voirie de Rosporden" Contenu="Texte + photos"";a:1:{i:0;s:0:"";}s:63:"outline text="SIVU de Riec sur Bélon" Contenu="Texte + photos"";a:1:{i:0;s:0:"";}s:45:"outline text="Sicom" Contenu="Texte + photos"";a:1:{i:0;s:0:"";}s:100:"outline text="Syndicat d’eau et d’électricification de Riec sur Belon" Contenu="Texte + photos"";a:1:{i:0;s:0:"";}}}}}s:23:"outline text="Economie"";a:1:{i:0;a:9:{s:83:"outline text="Page d'accueil" Contenu="Actualité + lien vers les marchés publics"";a:1:{i:0;s:0:"";}s:74:"outline text="Marchés publics" Contenu="Texte de présentation + contact"";a:1:{i:0;a:2:{s:131:"outline text="Avis d'attribution" Contenu="Texte accueil et affichage des derniers avis" Fonctionnalité="Publications + archivage"";a:1:{i:0;a:1:{s:74:"outline text="Un article par avis" Contenu="Texte ou doc à télécharger"";a:1:{i:0;s:0:"";}}}s:113:"outline text="Avis de publicité" Contenu="Texte + affichage des avis en cours" Fonctionnalité="Marchés public"";a:1:{i:0;a:1:{s:495:"outline text="Un article par avis" Contenu="Texte + docs à télécharger" Fonctionnalité="Un formulaire invite le visiteur à fournir son adresse email. Un email lui est alors automatiquement expédié qui contient un lien. En cliquant sur ce lien, le visiteur revient sur la page mais cette fois il a la possibilité de télécharger les pièces jointes à l'avis. Les mails sont ainsi collectés et ceux qui ont téléchargé les pièces peuvent ainsi être contactés en cas de changement."";a:1:{i:0;s:0:"";}}}}}s:37:"outline text="Les atouts de la ville"";a:1:{i:0;a:2:{s:62:"outline text="Production ostréicole" Contenu="Texte + photos"";a:1:{i:0;s:0:"";}s:133:"outline text="Situation géographique" Contenu="Même contenu que dans La Ville ?" Fonctionnalité="modèle de duplication d'article"";a:1:{i:0;s:0:"";}}}s:53:"outline text="S’implanter" Contenu="Texte + photos"";a:1:{i:0;s:0:"";}s:47:"outline text="Le GAER" Contenu="Texte + photos"";a:1:{i:0;s:0:"";}s:136:"outline text="Les commerces" Contenu="Présentation + formulaire d'inscription à l'annuaire" Fonctionnalité="Fonctionnalité annuaire"";a:1:{i:0;s:0:"";}s:138:"outline text="Les entreprises" Contenu="Présentation + formulaire d'inscription à l'annuaire" Fonctionnalité="Fonctionnalité annuaire"";a:1:{i:0;s:0:"";}s:105:"outline text="Les ZA et ZI" Contenu="Présentation + carte des ZA-ZI" Fonctionnalité="Carte interactive"";a:1:{i:0;a:1:{s:87:"outline text="Une page par zone" Contenu="Fiche de présentation + photo + plan accès"";a:1:{i:0;s:0:"";}}}s:50:"outline text="Le marché" Contenu="Texte + photos"";a:1:{i:0;s:0:"";}}}s:40:"outline text="Tourisme version anglaise"";a:1:{i:0;s:0:"";}}}}}} +CODE_SAMPLE; + $essais['sitemap'] = [$tree1, $xml1]; + $essais['opml'] = [$tree2, $xml2]; + return $essais; + } +} diff --git a/tests/tests/Formulaire/ProtegeChampTest.php b/tests/tests/Formulaire/ProtegeChampTest.php new file mode 100644 index 0000000000..963ae7c7f3 --- /dev/null +++ b/tests/tests/Formulaire/ProtegeChampTest.php @@ -0,0 +1,176 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction protege_champ du fichier ./balise/formulaire_.php + */ + +namespace Spip\Core\Tests\Formulaire; + +use PHPUnit\Framework\TestCase; + +class ProtegeChampTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./balise/formulaire_.php', '', true); + } + + /** + * @dataProvider providerFormulaireProtegeChamp + */ + public function testFormulaireProtegeChamp($expected, ...$args): void + { + $actual = protege_champ(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerFormulaireProtegeChamp(): array + { + return [ + 0 => [ + 0 => 'i:1;', + 1 => 'i:1;', + ], + 1 => [ + 0 => 's:4:"toto";', + 1 => 's:4:"toto";', + ], + 2 => [ + 0 => 'b:1;', + 1 => 'b:1;', + ], + 3 => [ + 0 => 'b:0;', + 1 => 'b:0;', + ], + 4 => [ + 0 => 'a:1:{i:0;s:4:"toto";}', + 1 => 'a:1:{i:0;s:4:"toto";}', + ], + 5 => [ + 0 => '', + 1 => '', + ], + 6 => [ + 0 => '0', + 1 => '0', + ], + 7 => [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 8 => [ + 0 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + ], + 9 => [ + 0 => 'Un texte sans entites &<>"'', + 1 => 'Un texte sans entites &<>"\'', + ], + 10 => [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 11 => [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 12 => [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + 13 => [ + 0 => [], + 1 => [], + ], + 14 => [ + 0 => [ + 0 => '', + 1 => '0', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 3 => 'Un texte avec des entit&eacute;s &amp;&lt;&gt;&quot;', + 4 => 'Un texte sans entites &<>"'', + 5 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 6 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 7 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + 1 => [ + 0 => '', + 1 => '0', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 3 => 'Un texte avec des entités &<>"', + 4 => 'Un texte sans entites &<>"\'', + 5 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 6 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 7 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + ], + 15 => [ + 0 => [ + 0 => 0, + 1 => -1, + 2 => 1, + 3 => 2, + 4 => 3, + 5 => 4, + 6 => 5, + 7 => 6, + 8 => 7, + 9 => 10, + 10 => 20, + 11 => 30, + 12 => 50, + 13 => 100, + 14 => 1000, + 15 => 10000, + ], + 1 => [ + 0 => 0, + 1 => -1, + 2 => 1, + 3 => 2, + 4 => 3, + 5 => 4, + 6 => 5, + 7 => 6, + 8 => 7, + 9 => 10, + 10 => 20, + 11 => 30, + 12 => 50, + 13 => 100, + 14 => 1000, + 15 => 10000, + ], + ], + 16 => [ + 0 => [ + 0 => '1', + 1 => '', + ], + 1 => [ + 0 => true, + 1 => false, + ], + ], + 17 => [ + 0 => null, + 1 => null, + ], + ]; + } +} diff --git a/tests/tests/Genie/MajTest.php b/tests/tests/Genie/MajTest.php new file mode 100644 index 0000000000..8984c689bd --- /dev/null +++ b/tests/tests/Genie/MajTest.php @@ -0,0 +1,79 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction info_maj_versions du fichier ./genie/mise_a_jour.php + */ + +namespace Spip\Core\Tests\Genie; + +use PHPUnit\Framework\TestCase; + +class MajTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./genie/mise_a_jour.php', '', true); + } + + /** + * @dataProvider providerInfoMajVersions + */ + public function testInfoMajVersions($expected, ...$args): void + { + $actual = info_maj_versions(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerInfoMajVersions(): array + { + return [ + 'version locale inconnue, maj distantes inconnues : ne rien signaler' => [ + 0 => ['mineure' => '', 'majeure' => ''], + 1 => '', + 2 => [], + ], + 'maj distantes inconnues : ne rien signaler' => [ + 0 => ['mineure' => '', 'majeure' => ''], + 1 => '4.1.8', + 2 => [], + ], + 'version locale inconnue : ne rien signaler' => [ + 0 => ['mineure' => '', 'majeure' => ''], + 1 => '', + 2 => ['4.2.0', '4.2.1'], + ], + 'une maj mineure existe, sans maj majeure : signaler la mineure' => [ + 0 => ['mineure' => '4.2.1', 'majeure' => ''], + 1 => '4.2.0-beta', + 2 => ['4.2.0', '4.2.1'], + ], + 'aucune maj mineure, une maj majeure uniquement : signaler la majeure' => [ + 0 => ['mineure' => '', 'majeure' => '4.2.1'], + 1 => '4.1.7', + 2 => ['3.2.24', '4.1.7', '4.2.1'], + ], + 'aucune maj mineure, plusieurs maj majeures : signaler la majeure la plus haute' => [ + 0 => ['mineure' => '', 'majeure' => '4.3.0'], + 1 => '4.1.7', + 2 => ['4.1.7', '4.2.1', '4.3.0'], + ], + 'maj majeure en alpha : ne pas la signaler' => [ + 0 => ['mineure' => '', 'majeure' => ''], + 1 => '4.1.7', + 2 => ['4.1.7', '4.2.0-alpha'], + ], + 'plusieurs maj majeures, mais la plus haute en alpha : signaler la plus haute stable' => [ + 0 => ['mineure' => '', 'majeure' => '4.2.1'], + 1 => '4.0.7', + 2 => ['4.0.7', '4.1.10', '4.2.1', '4.3.0-rc'], + ], + 'maj mineure et majeure : signaler les deux' => [ + 0 => ['mineure' => '4.1.7', 'majeure' => '4.2.1'], + 1 => '4.1.2', + 2 => ['4.0.10', '4.1.7', '4.2.1'], + ], + ]; + } +} diff --git a/tests/tests/LegacyUnitHtmlTest.php b/tests/tests/LegacyUnitHtmlTest.php new file mode 100644 index 0000000000..14ed2ae58f --- /dev/null +++ b/tests/tests/LegacyUnitHtmlTest.php @@ -0,0 +1,76 @@ +<?php + +declare(strict_types=1); + +/***************************************************************************\ + * SPIP, Système de publication pour l'internet * + * * + * Copyright © avec tendresse depuis 2001 * + * Arnaud Martin, Antoine Pitrou, Philippe Rivière, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribué sous licence GNU/GPL. * + * Pour plus de détails voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +namespace Spip\Core\Tests; + +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\TestCase; + +/** + * LegacyUnitHtmlTest test - runs all the unit/ php tests and check the ouput is 'OK' + */ +#[Group('legacy')] +class LegacyUnitHtmlTest extends TestCase +{ + + #[DataProvider('providerLegacyHtmlfileName')] + public function testLegacyUnitHtml($inFname, $output) + { + $result = $this->legacyHtmlRun($inFname); + $this->assertEquals($output, $result); + } + + public static function providerLegacyHtmlfileName() + { + require_once(__DIR__ . '/legacy/test.inc'); + + $liste_fichiers = tests_legacy_lister('html'); + $tests = []; + foreach ($liste_fichiers as $k => $fichier) { + $tests[$k] = [$fichier, 'OK']; + } + + return $tests; + } + + protected function legacyHtmlRun($inFname) + { + chdir(_SPIP_TEST_INC); + if (! is_file('../' . $inFname)) { + $this->fail( + "{$inFname} is missing" . json_encode([getcwd(), _SPIP_TEST_INC, _SPIP_TEST_CHDIR], JSON_THROW_ON_ERROR) + ); + } + + $output = []; + $returnCode = 0; + $realPath = realpath('tests/legacy/squel.php'); + $php = PHP_BINARY; + exec("{$php} \"{$realPath}\" test={$inFname} mode=test_general var_mode=recalcul", $output, $returnCode); + + if ($returnCode) { + array_unshift($output, 'ReturnCode: ' . $returnCode); + } + + $result = rtrim(implode("\n", $output)); + if (substr($result, 0, 2) === 'NA') { + $this->markTestSkipped($result); + } elseif (preg_match("#^OK \(?\d+\)?$#", $result)) { + $result = 'OK'; + } + + return $result; + } +} diff --git a/tests/tests/LegacyUnitPhpTest.php b/tests/tests/LegacyUnitPhpTest.php new file mode 100644 index 0000000000..8aa5a7217f --- /dev/null +++ b/tests/tests/LegacyUnitPhpTest.php @@ -0,0 +1,80 @@ +<?php + +declare(strict_types=1); + +/***************************************************************************\ + * SPIP, Système de publication pour l'internet * + * * + * Copyright © avec tendresse depuis 2001 * + * Arnaud Martin, Antoine Pitrou, Philippe Rivière, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribué sous licence GNU/GPL. * + * Pour plus de détails voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +namespace Spip\Core\Tests; + +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\TestCase; + + +/** + * LegacyUnitPhpTest test - runs all the unit/ php tests and check the ouput is 'OK' + */ +#[Group('legacy')] +class LegacyUnitPhpTest extends TestCase +{ + #[DataProvider('providerLegacyPhpfileName')] + public function testLegacyUnitPHP($inFname, $output) + { + $result = $this->legacyPhpRun($inFname); + if ($result === $output) { + $this->assertEquals($output, $result, $result); + } else { + $this->fail($result); + } + } + + public static function providerLegacyPhpfileName() + { + require_once(__DIR__ . '/legacy/test.inc'); + + $liste_fichiers = tests_legacy_lister('php'); + $tests = []; + foreach ($liste_fichiers as $k => $fichier) { + $tests[$k] = [$fichier, 'OK']; + } + + return $tests; + } + + protected function legacyPhpRun($inFname) + { + chdir(_SPIP_TEST_INC); + if (! is_file('../' . $inFname) || ! $realPath = realpath('../' . $inFname)) { + $this->fail( + "{$inFname} is missing" . json_encode([getcwd(), _SPIP_TEST_INC, _SPIP_TEST_CHDIR], JSON_THROW_ON_ERROR) + ); + } + + $output = []; + $returnCode = 0; + chdir(__DIR__ . '/legacy'); + $php = PHP_BINARY; + exec("{$php} \"{$realPath}\" mode=test_general", $output, $returnCode); + + if ($returnCode) { + array_unshift($output, 'ReturnCode: ' . $returnCode); + } + + $result = rtrim(implode("\n", $output)); + if (substr($result, 0, 2) === 'NA') { + $this->markTestSkipped($result); + } elseif (preg_match("#^OK \(?\d+\)?$#", $result)) { + $result = 'OK'; + } + + return $result; + } +} diff --git a/tests/tests/Plugin/PluginVersionCompatibleTest.php b/tests/tests/Plugin/PluginVersionCompatibleTest.php new file mode 100644 index 0000000000..fcbdedac5c --- /dev/null +++ b/tests/tests/Plugin/PluginVersionCompatibleTest.php @@ -0,0 +1,484 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction plugin_version_compatible du fichier ./inc/plugin.php + */ + +namespace Spip\Core\Tests\Plugin; + +use PHPUnit\Framework\TestCase; + +class PluginVersionCompatibleTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/plugin.php', '', true); + } + + /** + * @dataProvider providerPluginPluginVersionCompatible + */ + public function testPluginPluginVersionCompatible($expected, ...$args): void + { + $actual = plugin_version_compatible(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerPluginPluginVersionCompatible(): array + { + return [ + 0 => [ + 0 => true, + 1 => '[1.0.0;3.0.0]', + 2 => '2', + ], + 1 => [ + 0 => true, + 1 => '[1.0.0;3.0.0]', + 2 => '2.0', + ], + 2 => [ + 0 => true, + 1 => '[1.0.0;3.0.0]', + 2 => '2.0.0', + ], + 3 => [ + 0 => true, + 1 => '[1.0.0;3.0.0]', + 2 => '2.0.0dev', + ], + 4 => [ + 0 => true, + 1 => '[1.0.0;3.0.0]', + 2 => '2.0.0alpha', + ], + 5 => [ + 0 => true, + 1 => '[1.0.0;3.0.0]', + 2 => '2.0.0beta', + ], + 6 => [ + 0 => true, + 1 => '[1.0.0;3.0.0]', + 2 => '2.0.0rc', + ], + 7 => [ + 0 => true, + 1 => '[1.0.0;3.0.0]', + 2 => '2.0.0#', + ], + 8 => [ + 0 => true, + 1 => '[1.0.0;3.0.0]', + 2 => '2.0.0pl', + ], + 9 => [ + 0 => true, + 1 => '[1.0.0;3.0.0]', + 2 => '2.0.1', + ], + 10 => [ + 0 => true, + 1 => '[2.0.0;3.0.0]', + 2 => '2', + ], + 11 => [ + 0 => true, + 1 => '[2.0.0;3.0.0]', + 2 => '2.0', + ], + 12 => [ + 0 => true, + 1 => '[2.0.0;3.0.0]', + 2 => '2.0.0', + ], + 13 => [ + 0 => false, + 1 => '[2.0.0;3.0.0]', + 2 => '2.0.0dev', + ], + 14 => [ + 0 => false, + 1 => '[2.0.0;3.0.0]', + 2 => '2.0.0alpha', + ], + 15 => [ + 0 => false, + 1 => '[2.0.0;3.0.0]', + 2 => '2.0.0beta', + ], + 16 => [ + 0 => false, + 1 => '[2.0.0;3.0.0]', + 2 => '2.0.0rc', + ], + 17 => [ + 0 => true, + 1 => '[2.0.0;3.0.0]', + 2 => '2.0.0#', + ], + 18 => [ + 0 => true, + 1 => '[2.0.0;3.0.0]', + 2 => '2.0.0pl', + ], + 19 => [ + 0 => true, + 1 => '[2.0.0;3.0.0]', + 2 => '2.0.1', + ], + 20 => [ + 0 => false, + 1 => ']2.0.0;3.0.0]', + 2 => '2', + ], + 21 => [ + 0 => false, + 1 => ']2.0.0;3.0.0]', + 2 => '2.0', + ], + 22 => [ + 0 => false, + 1 => ']2.0.0;3.0.0]', + 2 => '2.0.0', + ], + 23 => [ + 0 => false, + 1 => ']2.0.0;3.0.0]', + 2 => '2.0.0dev', + ], + 24 => [ + 0 => false, + 1 => ']2.0.0;3.0.0]', + 2 => '2.0.0alpha', + ], + 25 => [ + 0 => false, + 1 => ']2.0.0;3.0.0]', + 2 => '2.0.0beta', + ], + 26 => [ + 0 => false, + 1 => ']2.0.0;3.0.0]', + 2 => '2.0.0rc', + ], + 27 => [ + 0 => false, + 1 => ']2.0.0;3.0.0]', + 2 => '2.0.0#', + ], + 28 => [ + 0 => true, + 1 => ']2.0.0;3.0.0]', + 2 => '2.0.0pl', + ], + 29 => [ + 0 => true, + 1 => ']2.0.0;3.0.0]', + 2 => '2.0.1', + ], + 30 => [ + 0 => false, + 1 => ')2.0.0;3.0.0]', + 2 => '2', + ], + 31 => [ + 0 => false, + 1 => ')2.0.0;3.0.0]', + 2 => '2.0', + ], + 32 => [ + 0 => false, + 1 => ')2.0.0;3.0.0]', + 2 => '2.0.0', + ], + 33 => [ + 0 => false, + 1 => ')2.0.0;3.0.0]', + 2 => '2.0.0dev', + ], + 34 => [ + 0 => false, + 1 => ')2.0.0;3.0.0]', + 2 => '2.0.0alpha', + ], + 35 => [ + 0 => false, + 1 => ')2.0.0;3.0.0]', + 2 => '2.0.0beta', + ], + 36 => [ + 0 => false, + 1 => ')2.0.0;3.0.0]', + 2 => '2.0.0rc', + ], + 37 => [ + 0 => false, + 1 => ')2.0.0;3.0.0]', + 2 => '2.0.0#', + ], + 38 => [ + 0 => false, + 1 => ')2.0.0;3.0.0]', + 2 => '2.0.0pl', + ], + 39 => [ + 0 => false, + 1 => ')2.0.0;3.0.0]', + 2 => '2.0.1', + ], + 40 => [ + 0 => true, + 1 => '[1.0.0;2.0.0]', + 2 => '2', + ], + 41 => [ + 0 => true, + 1 => '[1.0.0;2.0.0]', + 2 => '2.0', + ], + 42 => [ + 0 => true, + 1 => '[1.0.0;2.0.0]', + 2 => '2.0.0', + ], + 43 => [ + 0 => true, + 1 => '[1.0.0;2.0.0]', + 2 => '2.0.0dev', + ], + 44 => [ + 0 => true, + 1 => '[1.0.0;2.0.0]', + 2 => '2.0.0alpha', + ], + 45 => [ + 0 => true, + 1 => '[1.0.0;2.0.0]', + 2 => '2.0.0beta', + ], + 46 => [ + 0 => true, + 1 => '[1.0.0;2.0.0]', + 2 => '2.0.0rc', + ], + 47 => [ + 0 => true, + 1 => '[1.0.0;2.0.0]', + 2 => '2.0.0#', + ], + 48 => [ + 0 => false, + 1 => '[1.0.0;2.0.0]', + 2 => '2.0.0pl', + ], + 49 => [ + 0 => false, + 1 => '[1.0.0;2.0.0]', + 2 => '2.0.1', + ], + 50 => [ + 0 => false, + 1 => '[1.0.0;2.0.0[', + 2 => '2', + ], + 51 => [ + 0 => false, + 1 => '[1.0.0;2.0.0[', + 2 => '2.0', + ], + 52 => [ + 0 => false, + 1 => '[1.0.0;2.0.0[', + 2 => '2.0.0', + ], + 53 => [ + 0 => true, + 1 => '[1.0.0;2.0.0[', + 2 => '2.0.0dev', + ], + 54 => [ + 0 => true, + 1 => '[1.0.0;2.0.0[', + 2 => '2.0.0alpha', + ], + 55 => [ + 0 => true, + 1 => '[1.0.0;2.0.0[', + 2 => '2.0.0beta', + ], + 56 => [ + 0 => true, + 1 => '[1.0.0;2.0.0[', + 2 => '2.0.0rc', + ], + 57 => [ + 0 => false, + 1 => '[1.0.0;2.0.0[', + 2 => '2.0.0#', + ], + 58 => [ + 0 => false, + 1 => '[1.0.0;2.0.0[', + 2 => '2.0.0pl', + ], + 59 => [ + 0 => false, + 1 => '[1.0.0;2.0.0[', + 2 => '2.0.1', + ], + 60 => [ + 0 => false, + 1 => '[1.0.0;2.0.*[', + 2 => '2', + ], + 61 => [ + 0 => false, + 1 => '[1.0.0;2.0.*[', + 2 => '2.0', + ], + 62 => [ + 0 => false, + 1 => '[1.0.0;2.0.*[', + 2 => '2.0.0', + ], + 63 => [ + 0 => true, + 1 => '[1.0.0;2.0.*[', + 2 => '2.0.0dev', + ], + 64 => [ + 0 => true, + 1 => '[1.0.0;2.0.*[', + 2 => '2.0.0alpha', + ], + 65 => [ + 0 => true, + 1 => '[1.0.0;2.0.*[', + 2 => '2.0.0beta', + ], + 66 => [ + 0 => true, + 1 => '[1.0.0;2.0.*[', + 2 => '2.0.0rc', + ], + 67 => [ + 0 => false, + 1 => '[1.0.0;2.0.*[', + 2 => '2.0.0#', + ], + 68 => [ + 0 => false, + 1 => '[1.0.0;2.0.*[', + 2 => '2.0.0pl', + ], + 69 => [ + 0 => false, + 1 => '[1.0.0;2.0.*[', + 2 => '2.0.1', + ], + 70 => [ + 0 => true, + 1 => '[1.0.0;2.0.*]', + 2 => '2', + ], + 71 => [ + 0 => true, + 1 => '[1.0.0;2.0.*]', + 2 => '2.0', + ], + 72 => [ + 0 => true, + 1 => '[1.0.0;2.0.*]', + 2 => '2.0.0', + ], + 73 => [ + 0 => true, + 1 => '[1.0.0;2.0.*]', + 2 => '2.0.0dev', + ], + 74 => [ + 0 => true, + 1 => '[1.0.0;2.0.*]', + 2 => '2.0.0alpha', + ], + 75 => [ + 0 => true, + 1 => '[1.0.0;2.0.*]', + 2 => '2.0.0beta', + ], + 76 => [ + 0 => true, + 1 => '[1.0.0;2.0.*]', + 2 => '2.0.0rc', + ], + 77 => [ + 0 => true, + 1 => '[1.0.0;2.0.*]', + 2 => '2.0.0#', + ], + 78 => [ + 0 => true, + 1 => '[1.0.0;2.0.*]', + 2 => '2.0.0pl', + ], + 79 => [ + 0 => true, + 1 => '[1.0.0;2.0.*]', + 2 => '2.0.1', + ], + 80 => [ + 0 => true, + 1 => '[1.0.0;2.*]', + 2 => '2', + ], + 81 => [ + 0 => true, + 1 => '[1.0.0;2.*]', + 2 => '2.0', + ], + 82 => [ + 0 => true, + 1 => '[1.0.0;2.*]', + 2 => '2.0.0', + ], + 83 => [ + 0 => true, + 1 => '[1.0.0;2.*]', + 2 => '2.0.0dev', + ], + 84 => [ + 0 => true, + 1 => '[1.0.0;2.*]', + 2 => '2.0.0alpha', + ], + 85 => [ + 0 => true, + 1 => '[1.0.0;2.*]', + 2 => '2.0.0beta', + ], + 86 => [ + 0 => true, + 1 => '[1.0.0;2.*]', + 2 => '2.0.0rc', + ], + 87 => [ + 0 => true, + 1 => '[1.0.0;2.*]', + 2 => '2.0.0#', + ], + 88 => [ + 0 => true, + 1 => '[1.0.0;2.*]', + 2 => '2.0.0pl', + ], + 89 => [ + 0 => true, + 1 => '[1.0.0;2.*]', + 2 => '2.0.1', + ], + ]; + } +} diff --git a/tests/tests/Plugin/SpipVersionCompareTest.php b/tests/tests/Plugin/SpipVersionCompareTest.php new file mode 100644 index 0000000000..27e995b627 --- /dev/null +++ b/tests/tests/Plugin/SpipVersionCompareTest.php @@ -0,0 +1,568 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction spip_version_compare du fichier ./inc/plugin.php + */ + +namespace Spip\Core\Tests\Plugin; + +use PHPUnit\Framework\TestCase; + +class SpipVersionCompareTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/plugin.php', '', true); + } + + /** + * @dataProvider providerPluginSpipVersionCompare + */ + public function testPluginSpipVersionCompare($expected, ...$args): void + { + $actual = spip_version_compare(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerPluginSpipVersionCompare(): array + { + return [ + 0 => [ + 0 => false, + 1 => '2', + 2 => '2', + 3 => '>', + ], + 1 => [ + 0 => false, + 1 => '2', + 2 => '2.0', + 3 => '>', + ], + 2 => [ + 0 => false, + 1 => '2', + 2 => '2.0.0', + 3 => '>', + ], + 3 => [ + 0 => true, + 1 => '2', + 2 => '2.0.0dev', + 3 => '>', + ], + 4 => [ + 0 => true, + 1 => '2', + 2 => '2.0.0alpha', + 3 => '>', + ], + 5 => [ + 0 => true, + 1 => '2', + 2 => '2.0.0beta', + 3 => '>', + ], + 6 => [ + 0 => true, + 1 => '2', + 2 => '2.0.0rc', + 3 => '>', + ], + 8 => [ + 0 => false, + 1 => '2', + 2 => '2.0.0pl', + 3 => '>', + ], + 9 => [ + 0 => false, + 1 => '2', + 2 => '2.0.1', + 3 => '>', + ], + 10 => [ + 0 => false, + 1 => '2.0', + 2 => '2', + 3 => '>', + ], + 11 => [ + 0 => false, + 1 => '2.0', + 2 => '2.0', + 3 => '>', + ], + 12 => [ + 0 => false, + 1 => '2.0', + 2 => '2.0.0', + 3 => '>', + ], + 13 => [ + 0 => true, + 1 => '2.0', + 2 => '2.0.0dev', + 3 => '>', + ], + 14 => [ + 0 => true, + 1 => '2.0', + 2 => '2.0.0alpha', + 3 => '>', + ], + 15 => [ + 0 => true, + 1 => '2.0', + 2 => '2.0.0beta', + 3 => '>', + ], + 16 => [ + 0 => true, + 1 => '2.0', + 2 => '2.0.0rc', + 3 => '>', + ], + 18 => [ + 0 => false, + 1 => '2.0', + 2 => '2.0.0pl', + 3 => '>', + ], + 19 => [ + 0 => false, + 1 => '2.0', + 2 => '2.0.1', + 3 => '>', + ], + 20 => [ + 0 => false, + 1 => '2.0.0', + 2 => '2', + 3 => '>', + ], + 21 => [ + 0 => false, + 1 => '2.0.0', + 2 => '2.0', + 3 => '>', + ], + 22 => [ + 0 => false, + 1 => '2.0.0', + 2 => '2.0.0', + 3 => '>', + ], + 23 => [ + 0 => true, + 1 => '2.0.0', + 2 => '2.0.0dev', + 3 => '>', + ], + 24 => [ + 0 => true, + 1 => '2.0.0', + 2 => '2.0.0alpha', + 3 => '>', + ], + 25 => [ + 0 => true, + 1 => '2.0.0', + 2 => '2.0.0beta', + 3 => '>', + ], + 26 => [ + 0 => true, + 1 => '2.0.0', + 2 => '2.0.0rc', + 3 => '>', + ], + 28 => [ + 0 => false, + 1 => '2.0.0', + 2 => '2.0.0pl', + 3 => '>', + ], + 29 => [ + 0 => false, + 1 => '2.0.0', + 2 => '2.0.1', + 3 => '>', + ], + 30 => [ + 0 => false, + 1 => '2.0.0dev', + 2 => '2', + 3 => '>', + ], + 31 => [ + 0 => false, + 1 => '2.0.0dev', + 2 => '2.0', + 3 => '>', + ], + 32 => [ + 0 => false, + 1 => '2.0.0dev', + 2 => '2.0.0', + 3 => '>', + ], + 33 => [ + 0 => false, + 1 => '2.0.0dev', + 2 => '2.0.0dev', + 3 => '>', + ], + 34 => [ + 0 => false, + 1 => '2.0.0dev', + 2 => '2.0.0alpha', + 3 => '>', + ], + 35 => [ + 0 => false, + 1 => '2.0.0dev', + 2 => '2.0.0beta', + 3 => '>', + ], + 36 => [ + 0 => false, + 1 => '2.0.0dev', + 2 => '2.0.0rc', + 3 => '>', + ], + 38 => [ + 0 => false, + 1 => '2.0.0dev', + 2 => '2.0.0pl', + 3 => '>', + ], + 39 => [ + 0 => false, + 1 => '2.0.0dev', + 2 => '2.0.1', + 3 => '>', + ], + 40 => [ + 0 => false, + 1 => '2.0.0alpha', + 2 => '2', + 3 => '>', + ], + 41 => [ + 0 => false, + 1 => '2.0.0alpha', + 2 => '2.0', + 3 => '>', + ], + 42 => [ + 0 => false, + 1 => '2.0.0alpha', + 2 => '2.0.0', + 3 => '>', + ], + 43 => [ + 0 => true, + 1 => '2.0.0alpha', + 2 => '2.0.0dev', + 3 => '>', + ], + 44 => [ + 0 => false, + 1 => '2.0.0alpha', + 2 => '2.0.0alpha', + 3 => '>', + ], + 45 => [ + 0 => false, + 1 => '2.0.0alpha', + 2 => '2.0.0beta', + 3 => '>', + ], + 46 => [ + 0 => false, + 1 => '2.0.0alpha', + 2 => '2.0.0rc', + 3 => '>', + ], + 48 => [ + 0 => false, + 1 => '2.0.0alpha', + 2 => '2.0.0pl', + 3 => '>', + ], + 49 => [ + 0 => false, + 1 => '2.0.0alpha', + 2 => '2.0.1', + 3 => '>', + ], + 50 => [ + 0 => false, + 1 => '2.0.0beta', + 2 => '2', + 3 => '>', + ], + 51 => [ + 0 => false, + 1 => '2.0.0beta', + 2 => '2.0', + 3 => '>', + ], + 52 => [ + 0 => false, + 1 => '2.0.0beta', + 2 => '2.0.0', + 3 => '>', + ], + 53 => [ + 0 => true, + 1 => '2.0.0beta', + 2 => '2.0.0dev', + 3 => '>', + ], + 54 => [ + 0 => true, + 1 => '2.0.0beta', + 2 => '2.0.0alpha', + 3 => '>', + ], + 55 => [ + 0 => false, + 1 => '2.0.0beta', + 2 => '2.0.0beta', + 3 => '>', + ], + 56 => [ + 0 => false, + 1 => '2.0.0beta', + 2 => '2.0.0rc', + 3 => '>', + ], + 58 => [ + 0 => false, + 1 => '2.0.0beta', + 2 => '2.0.0pl', + 3 => '>', + ], + 59 => [ + 0 => false, + 1 => '2.0.0beta', + 2 => '2.0.1', + 3 => '>', + ], + 60 => [ + 0 => false, + 1 => '2.0.0rc', + 2 => '2', + 3 => '>', + ], + 61 => [ + 0 => false, + 1 => '2.0.0rc', + 2 => '2.0', + 3 => '>', + ], + 62 => [ + 0 => false, + 1 => '2.0.0rc', + 2 => '2.0.0', + 3 => '>', + ], + 63 => [ + 0 => true, + 1 => '2.0.0rc', + 2 => '2.0.0dev', + 3 => '>', + ], + 64 => [ + 0 => true, + 1 => '2.0.0rc', + 2 => '2.0.0alpha', + 3 => '>', + ], + 65 => [ + 0 => true, + 1 => '2.0.0rc', + 2 => '2.0.0beta', + 3 => '>', + ], + 66 => [ + 0 => false, + 1 => '2.0.0rc', + 2 => '2.0.0rc', + 3 => '>', + ], + 68 => [ + 0 => false, + 1 => '2.0.0rc', + 2 => '2.0.0pl', + 3 => '>', + ], + 69 => [ + 0 => false, + 1 => '2.0.0rc', + 2 => '2.0.1', + 3 => '>', + ], + 80 => [ + 0 => true, + 1 => '2.0.0pl', + 2 => '2', + 3 => '>', + ], + 81 => [ + 0 => true, + 1 => '2.0.0pl', + 2 => '2.0', + 3 => '>', + ], + 82 => [ + 0 => true, + 1 => '2.0.0pl', + 2 => '2.0.0', + 3 => '>', + ], + 83 => [ + 0 => true, + 1 => '2.0.0pl', + 2 => '2.0.0dev', + 3 => '>', + ], + 84 => [ + 0 => true, + 1 => '2.0.0pl', + 2 => '2.0.0alpha', + 3 => '>', + ], + 85 => [ + 0 => true, + 1 => '2.0.0pl', + 2 => '2.0.0beta', + 3 => '>', + ], + 86 => [ + 0 => true, + 1 => '2.0.0pl', + 2 => '2.0.0rc', + 3 => '>', + ], + 88 => [ + 0 => false, + 1 => '2.0.0pl', + 2 => '2.0.0pl', + 3 => '>', + ], + 89 => [ + 0 => false, + 1 => '2.0.0pl', + 2 => '2.0.1', + 3 => '>', + ], + 90 => [ + 0 => true, + 1 => '2.0.1', + 2 => '2', + 3 => '>', + ], + 91 => [ + 0 => true, + 1 => '2.0.1', + 2 => '2.0', + 3 => '>', + ], + 92 => [ + 0 => true, + 1 => '2.0.1', + 2 => '2.0.0', + 3 => '>', + ], + 93 => [ + 0 => true, + 1 => '2.0.1', + 2 => '2.0.0dev', + 3 => '>', + ], + 94 => [ + 0 => true, + 1 => '2.0.1', + 2 => '2.0.0alpha', + 3 => '>', + ], + 95 => [ + 0 => true, + 1 => '2.0.1', + 2 => '2.0.0beta', + 3 => '>', + ], + 96 => [ + 0 => true, + 1 => '2.0.1', + 2 => '2.0.0rc', + 3 => '>', + ], + 98 => [ + 0 => true, + 1 => '2.0.1', + 2 => '2.0.0pl', + 3 => '>', + ], + 99 => [ + 0 => false, + 1 => '2.0.1', + 2 => '2.0.1', + 3 => '>', + ], + 100 => [ + 0 => true, + 1 => '2', + 2 => '2.0', + 3 => '=', + ], + 101 => [ + 0 => true, + 1 => '2.0', + 2 => '2.0.0', + 3 => '=', + ], + 102 => [ + 0 => true, + 1 => '2.0.0alpha', + 2 => '2.0.0 alpha', + 3 => '=', + ], + 103 => [ + 0 => true, + 1 => '2.0.0alpha', + 2 => '2.0.0-alpha', + 3 => '=', + ], + 104 => [ + 0 => true, + 1 => '2.0.0alpha', + 2 => '2.0.0a', + 3 => '=', + ], + 105 => [ + 0 => true, + 1 => '2.0.0beta', + 2 => '2.0.0b', + 3 => '=', + ], + 106 => [ + 0 => true, + 1 => '2.0.0pl', + 2 => '2.0.0p', + 3 => '=', + ], + 107 => [ + 0 => true, + 1 => '2.0.0-rc', + 2 => '2.0.0RC', + 3 => '=', + ], + ]; + } +} diff --git a/tests/tests/Propre/ChevronOuvrantTest.php b/tests/tests/Propre/ChevronOuvrantTest.php new file mode 100644 index 0000000000..53a03530d8 --- /dev/null +++ b/tests/tests/Propre/ChevronOuvrantTest.php @@ -0,0 +1,70 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction propre du fichier inc/texte.php + * + * cas du chevron ouvrant + */ + +namespace Spip\Core\Tests\Propre; + +use PHPUnit\Framework\TestCase; + +class ChevronOuvrantTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/texte.php', '', true); + } + + protected function setUp(): void + { + $GLOBALS['meta']['type_urls'] = 'page'; + $GLOBALS['type_urls'] = 'page'; + // initialiser les plugins qui changent les intertitre (Z), et les restaurer juste apres + $mem = [$GLOBALS['debut_intertitre'] ?? null, $GLOBALS['spip_raccourcis_typo'] ?? null]; + propre('rien du tout'); + [$GLOBALS['debut_intertitre'], $GLOBALS['spip_raccourcis_typo']] = $mem; + } + + /** + * @dataProvider providerPropreChevronOuvrant + */ + public function testPropreChevronOuvrant($expected, ...$args): void + { + $actual = propre(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerPropreChevronOuvrant(): array + { + return [ + 0 => [ + 0 => '<p>a<b</p>', + 1 => 'a<b', + ], + 1 => [ + 0 => '<p><i>a<b</i></p>', + 1 => '{a<b}', + ], + 2 => [ + 0 => '<p><strong>a<b</strong></p>', + 1 => '{{a<b}}', + ], + 3 => [ + 0 => '<h2 class="spip">a<b</h2>', + 1 => '{{{a<b}}}', + ], + 4 => [ + 0 => '<p><i>0 < a < 1</i> et <i>a > 5</i></p>', + 1 => '{0 < a < 1} et {a > 5}', + ], + 5 => [ + 0 => '<p><i>0 < a < 1.0</i> et <i>a > 5</i></p>', + 1 => '{0 < a < 1.0} et {a > 5}', + ], + ]; + } +} diff --git a/tests/tests/Propre/CodeImbriqueTest.php b/tests/tests/Propre/CodeImbriqueTest.php new file mode 100644 index 0000000000..6965f7a26c --- /dev/null +++ b/tests/tests/Propre/CodeImbriqueTest.php @@ -0,0 +1,240 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction propre du fichier inc/texte.php + * + * cas du code imbriqué : Ne pas crasher sur les <code><code></code> imbriqués + */ + +namespace Spip\Core\Tests\Propre; + +use PHPUnit\Framework\TestCase; + +class CodeImbriqueTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/texte.php', '', true); + } + + /** + * @dataProvider providerPropreCodeImbrique + */ + public function testPropreCodeImbrique($expected, ...$args): void + { + $actual = strlen(propre(...$args)) > 0; + $this->assertSame($expected, $actual); + } + + public static function providerPropreCodeImbrique(): array + { + return [[true, '({{{Classificar els resultats}}} + +<html><tt><b>{par</b> <i>critère_de_classement</i><b>}</b></tt></html> iIndica l’ordre en què es presenten els resultats. Aquest criteri de classificació correspon a una de les etiquetes extretes de la base de dades per cada tipus de bucle. Per exemple, podrem classificar els articles per la data <code>{per date}</code>, per la data en què han estat redactats <code>{par date_redac}</code> o per títol <code>{par titre}</code>. (Fixeu-vos que, tot i que les etiquetes es presenten en majúscules, els criteris de classificació es presenten en minúscules.) + +{Cas particular}: {{<code>{par hasard}</code>}} (per atzar) permet mostrar una llista presentada en ordre aleatori. + +{Invertir la classificació}. A més a més, {{<code>{inverse}</code>}} provoca la presentació d’una classificació en ordre invers. Per exemple <code>{par date}</code> comença pels articles més antics; amb <code>{par date}{inverse}</code> la llista es comença amb els articles més recents. + +A partir d\'[->3369], el criteri {inverse} pot agafar com a paràmetre qualsevol marcador per tal de variar dinàmicament el sentit de la tria. Per exemple, és possible escriure: <code><BOUCLE_exemple(ARTICLES){par #ENV{tri}}{inverse #ENV{senstri}}></code>, la qual cosa permet escollir la columna de selecció i el sentit del que s\'escull per mitjà del url (&senstri=1 o &senstri=0) + +{Classificar per número}. <span style=\'color: red;\'>[SPIP 1.3]</span> Quan el criteri de classificació es un element de text (per exemple el títol –{titre}-), la classificació es fa per ordre {alfabètic}. No obstant, per forçar un ordre de presentació, es pot posar un número al davant del títol. Per exemple: «1. El meu primer article», « 2. Segon article», « 3. Tercer... », etc. Amb una classificació alfabètica, la classificació d’aquests elements donaria la sèrie «1, 10, 11, 2, 3...». Per restablir la classificació numèrica, es pot fer servir el criteri: + +<html><tt><b>{par num</b> critère<b>}</b></tt></html> + +Per exemple: + +<cadre><BOUCLE_articles(ARTICLES){id_rubrique}{par date}{inverse}></cadre> + +mostra els articles d’una secció classificats segons un ordre cronològic invers (els més recents al començament, els més antics al final), i: + +<cadre><BOUCLE_articles(ARTICLES){id_rubrique}{par titre}> +</cadre> + +els mostra segons l’ordre alfabètic del seu títol; finalment: + +<cadre><BOUCLE_articles(ARTICLES){id_rubrique}{par num titre}> +</cadre> + +els mostra segons l’ordre del número del seu títol. (ALERTA: l\'opció <code>{par num titre<code>}</code> no funciona en les versions de MySQL anteriors a la versió 3.23). + +{Classificar segons diversos criteris} A partir de [->3005], es pot classificar segons diversos criteris: <html><tt><b>{par</b> critère1<b>,</b> critère2<b>}</b></tt></html>. S\'indiquen d\'aquesta manera ordres de classificació consecutives. Els resultats es s\'ordenaran primerament segons el {critère1}, després el {critère2} pels resultats que tinguin el mateix {critère1}. Es poden especificar tants criteris com sigui necessari. + +Per exemple <code>{par date, titre}</code> ordena els resultats per {date} després els resultats que tenen la mateixa {date} seran ordenats per {titre}. + +Amb [->3176] podem especificar diversos criteris <html><tt><b>{par</b> <i>...</i><b>}</b></tt></html> per un boucle per arribar al mateix resultat. Per exemple: <code>{par date} {par titre}</code> és equivalent a l\'exemple anterior. + +<blockquote> +{Comentari:} Quan s\'utilitzen diversos criteris de classificació, el criteri <HTML><TT><B>{inverse}</B></TT></HTML> només s\'aplica al criteri de classificació situat just abans. + +És per això que [->3176] introdueix la notació <HTML><TT><B>{!par ...}</B></TT></HTML> que inversa un criteri de classificació en particular. Per exemple: <code>{!par date} {par num titre}</code> classifica per {date} decreixents, després per números creixents en el mateix {titre} pels resultats que tenen la mateixa {date}. +</blockquote> + + +{{{Comparacions, igualtats}}} + +<HTML><TT><B>{</B><I>critère</I> <B> < </B><I>valeur</I><B>}</B></TT></HTML> Comparació amb un valor fixat (es pot utilitzar «>», «<», «=», «>=», «<=». Tots els {criteris de classificació} (tal i com són extrets de la base de dades) poden ser utilitzats igualment per limitar el número de resultats. + +El valor a la dreta de l\'operador pot ser: + +- Un valor constant fixat a l\'esquelet. Per exemple: + +<cadre><BOUCLE_art(ARTICLES){id_article=5}></cadre> +mostra només l’article que té el número 5. És útil, per exemple, per ressaltar un article concret a la pàgina d’inici. + +<cadre><BOUCLE_art(ARTICLES){id_secteur=2}></cadre> +mostra els articles del sector número 2. + +- A partir de <span style=\'color: #fa9a00;\'>[SPIP 1.8]</span>, una etiqueta disponible en el context del bucle. Per exemple: + +<cadre> +<BOUCLE_art(ARTICLES){id_article=5}> +<BOUCLE_titre(ARTICLES) {titre=#TITRE}> +... +</BOUCLE_titre> +</BOUCLE_art> +</cadre> +serveix per trobar els articles que tenen el mateix títol que l\'article 5. + +<blockquote> +{Atenció:} Només podem fer servir una etiqueta simple. No està permès ni filtrar-la ni posar-hi codi opcional. + +En especial, si volem utilitzar l\'etiqueta {{#ENV}} -- o una altra etiqueta que admeti paràmetres --, hem d\'emprar la notació: <code>{titre = #ENV{titre}}</code> i {{no}}: <code>{titre = [(#ENV{titre})]}</code>. +</blockquote> + +{{Expressions regulars:}} + +Molt potent (però força més complexe de manipular), el terme de comparació « == » introdueix una comparació segons una expressió regular. Per exemple: + +<cadre><BOUCLE_art(ARTICLES){titre==^[aA]}></cadre> +selecciona els articles el títol dels quals comença per « a » o « A ». + +{{Negació:}} + +A partir de <span style=\'color: red;\'>[SPIP 1.2]</span> es pot fer servir la notació <html><tt>{xxx != yyy}</tt> i <tt>{xxx !== yyy}</tt></html>, el <html>!</html> corresponent a la negació (operador lògic NOT). + +<cadre><BOUCLE_art(ARTICLES){id_secteur != 2}></cadre> +selecciona els articles que no pertanyen al sector número 2. + +<cadre><BOUCLE_art(ARTICLES){titre!==^[aA]}></cadre> +selecciona els articles el títol dels quals {no} comença per « a » o « A ». + +{{{Publicació en funció de la data}}} + +Per facilitar l\'ús de les comparacions a les dates, s\'han afegit els criteris següents: +- <TT>age</TT> i <TT>age_redac</TT> corresponen respectivament a l’antiguitat de la publicació i de la primera publicació d’un article, en dies: <TT><code>{</code>age<30<code>}</code></TT> selecciona els elements publicats des de fa menys d’un mes; +- els critères <TT>mois</TT>, <TT>mois_redac</TT>, <TT>annee</TT>, <TT>annee_redac</TT> permeten comparar amb valors fixes (per exemple, <code>{annee<=2000}</code> pels elements publicats fins l’any 2000). + +Es poden combinar diversos criteris per efectuar seleccions més precises. Per exemple: + +<cadre><BOUCLE_art(ARTICLES){id_secteur=2}{id_rubrique!=3}{age<30}></cadre> +mostra els articles del sector 2, excepte els de la secció 3, i publicats des de fa menys de 30 dies. + +{Una astúcia}. El criteri <code>edat</code> és molt pràctic per mostrar els articles o les breus la data dels quals és « posterior » a l’actual, amb valors negatius (a condició d’haver seleccionat, a la Configuració precisa del lloc, la opció « Publicar els articles amb data posterior »). Per exemple, aquest criteri permet de donar èmfasi a futurs esdeveniments: <code>{age<0}</code> selecciona els articles o les breus d’una data posterior (« desprès » d’avui)... + +<span style=\'color: red;\'>(SPIP 1.3)</span> {Edat respecte a una data donada}. El criteri edat <code>(age)</code> es calcula en relació a la data d’avui (d’aquesta manera, <code>{age<30}</code> correspon als articles publicats des de fa menys d’un mes respecte a la data d’avui). El criteri <tt><b>age_relatif</b></tt> (edat relativa) compara la data d’un article o d’una breu amb una data «actual»; per exemple, a l’interior d’un bucle ARTICLES, coneixem ja una data per a cada resultat del bucle, per tant, podem seleccionar en relació a aquesta data (i no només en relació amb la data d’avui). + +Per exemple: +<cadre> +<BOUCLE_article_principal(ARTICLES){id_article}> + + <h1>#TITRE</h1> + +<BOUCLE_suivant(ARTICLES){id_rubrique}{age_relatif<=0}{exclus}{par date}{0,1}> + Article següent: #TITRE + </BOUCLE_suivant> + +</BOUCLE_article_principal> +</cadre> + +el BOUCLE_suivant mostra un únic article de la mateixa secció, classificat per data, la data de publicació del qual és inferior o igual a la data de l’« article_principal »; és a dir, l’article de la mateixa secció publicat després de l’article principal. + +Trobareu informació més àmplia sobre la utilització de les dates a l\'article que parla sobre «[->2198]». + +{{{Presentació d’una part dels resultats}}} + +- {{<code>{branche}</code>}} A partir de <span style=\'color: #066;\'>[SPIP 1.8.2]</span>, limita els resultats -- pels bucles que tenen un #ID_RUBRIQUE -- a la branca actual (la secció actual i les subseccions). Per exemple: +_ <code><BOUCLE_articles(ARTICLES) {branche}></code> ens tornarà tots els articles de la secció actual i de les seves subseccions, +_ <code><BOUCLE_articles(ARTICLES) {!branche}></code> ens tornarà tots els articles uq no es troben dins de la secció actual o les seves subseccions, + +Es pot utilitzar el criteri +<HTML><TT><B>{branche?}</B></TT></HTML> {optionnel} per aplicar-lo només si una secció es selecciona dins del context (un bucle englobant o l\'url proporcionada per un id_rubrique). Per exemple: +_ <code><BOUCLE_articles(ARTICLES) {branche?}></code> ens retornarà tots els articles de la secció actual i de les seves subseccions si hi ha un id_rubrique en el context, sinó, ens torna tots els articles del lloc Web. + +[#doublons<-] +- {{<code>{doublons}</code>}} o {{<code>{unique}</code>}} (aquests dos criteris són absolutament idèntics) permeten prohibit que es mostrin resultats que ja s\'han mostrar dins d\'altres bucles utilitzant aquest criteri. + +<quote>{històric:} +A partir de <span style=\'color: red;\'>[SPIP 1.2]</span> i fins a [<span style=\'color: red;\'>S</span><span style=\'color: orange;\'>P</span><span style=\'color: yellow;\'>I</span><span style=\'color: green;\'>P </span><span style=\'color: blue;\'>1</span><span style=\'color: black;\'>.</span><span style=\'color: darkviolet;\'>7</span>.2], només els bucles {{<tt>ARTICLES, RUBRIQUES, DOCUMENTS</tt>}} i {{<tt>SITES</tt>}} acceptaven aquest criteri.</quote> + +[#doublons_nomme<-] +- {{<code>{doublons</code>}} {<code>xxxx</code>}{{<code>}</code>}} a partir de <span style=\'color: #fa9a00;\'>[SPIP 1.8]</span>, es poden tenir diversos criteris <code>{doublons}</code> independents. Els bucles que tinguin <code>{doublons rouge}</code> no tindran cap incidència sobre els bucles que tinguin <code>{doublons bleu}</code> com a criteri. + +[#exclus<-] +- {{<code>{exclus}</code>}} permet excloure del resultat l\'element (article, breu, secció, etc.) en el qual ja ens trobem. Per exemple, quan publiquem els articles continguts en una mateixa secció, no volem publicar un enllaç cap a l\'article en el que ja ens trobem. + +[#critere_in<-] +- <HTML><TT><B>{</B><I>xxxx</I><B> IN </B><I>a,b,c,d,...</I><B>}</B></TT></HTML> a partir de <span style=\'color: #fa9a00;\'>[SPIP 1.8]</span>, limita la presentació als resultats que tinguin el criteri {xxxx} igual a {a, b, c} {{o}} {d.} Els resultats són ordenats segons l\'ordre indicat (excepte per demanda explícita d\'un altre criteri d\'ordre). També és possible seleccionar cadenes de caràcters, per exemple amb <code>{titre IN \'Chine\', \'Japon\'}</code>. + +Amb +[->3369], les etiquetes són reconegudes en els arguments d\'IN, i sobretot l\'etiqueta <TT>ENV</TT>, a la que se li apliquen els filtres d\'anàlisi per assegurar que l\'ordre SQL s\'escriurà bé. De forma derogatòria, Spip verificarà si l\'argument d\' <TT>ENV</TT> apunta cap a una taula (venint per exemple d\'entrades de formulari l\'atribut de les quals <tt>name</tt> s\'acaba per <tt>[]</tt>). Si aquest és el cas, i si els filtres d\'anàlisi han estat desactivats sufixant aquesta etiqueta per una doble estrella, llavors cada element de la taula serà considerat com argument d\'IN, aplicant Spip els filtres de seguretat damunt de cadascun d\'ells. + +L\'esquelet estàndard <tt>formulaire_forum_previsu</tt> subministra un exemple d\'ús amb un bucle MOTS que té el criteri <HTML><tt>{id_mot IN #ENV**{ajouter_mot}}</tt></HTML>: aquest bucle selecciona només les paraules clau que pertanyen a un conjunt indicat dinàmicament. Aquí, aquest conjunt haurà estat construit pel formulari de l\'esquelet estàndard <tt>choix_mots</tt>, el qual utilitza atributs <tt>name=ajouter_mot[]</tt>. + +- <HTML><TT><B>{</B><I>a</I><B>,</B><I>b</I><B>}</B></TT></HTML> on {a} i {b} són xifres. Aquest criteri permet limitar el número de resultats. {a} indica el resultat a partir del qual es comença la visualització (atenció, el primer resultat porta el número 0 - zero) ; {b} indica el número de resultats mostrats. + +Per exemple <HTML><TT>{0,10}</TT></HTML> mostra els deu primers resultats; <HTML><TT>{4,2}</TT></HTML> mostra els dos resultats a partir del cinquè (inclòs). + +<HTML><TT><B>{debut_</B><I>xxx</I><B>,</B><I>b</I><B>}</B></TT></HTML> és una variant molt elaborada del criteri anterior. Permet fer començar la limitació dels resultats per una variable passada per l’URL (aquesta variable reemplaça així la {a} que se li indicava anteriorment). És un funcionament una mica complex, però afortunadament no es necessari fer-la servir gaire sovint. + +La variable passada per l’URL comença forçosament per <TT>debut_xxx</TT> (on {xxx} és una paraula escollida pel webmestre). D’aquesta manera, per una pàgina que té com URL: + +<HTML><TT>spip.php?page=petition&id_article=13&debut_signatures=200</TT></HTML> + +amb un esquelet <TT>(petition.html)</TT> que conté, per exemple: + +<cadre><BOUCLE_signatures(SIGNATURES){id_article}{debut_signatures,100}></cadre> + +obtindrem la llista de 100 signatures a partir de la 201[[<recorda> el primer resultat té el número 0, per tant el resultat 200 representa realment la signatura número 201]]. Amb l’URL: + +<HTML><TT>spip.php?page=petition&id_article=13&debut_signatures=300</TT></HTML> + +obtindríem la llista de 100 signatures a partir de la 301[[<recorda>]]. + +- <HTML><TT><B>{</B><I>a</I><B>,n-</B><I>b</I><B>}</B></TT></HTML> a partir de <span style=\'color: #fa9a00;\'>[SPIP 1.8]</span>, és una variant de <code>{a,b}</code> la que limita la publicació en funció del número de resultats dins el bucle. {a} és el resultat a partir del qual començar a fer la publicació; {b} indica el número de resultats a {{no mostrar}} al final del bucle. + +<code>{0,n-10}</code> mostrarà tots els resultats del bucle excepte els 10 últims. + +- <HTML><TT><B>{n-</B><I>a</I><B>,</B><I>b</I><B>}</B></TT></HTML> a partir de <span style=\'color: #fa9a00;\'>[SPIP 1.8]</span>, és el que penja de <code>{a, n-b}</code>. Es limita la publicació a {b} resultats després del {a}<sup>e</sup> resultat del bucle. + +Per exemple: <code>{n-20,10}</code> mostrarà 10 resultats partint del 20<sup>è</sup> resultat abans del final del bucle. + +- <HTML><TT><B>{</B><I>a</I><B>/</B><I>b</I><B>}</B></TT></HTML> on {a} i {b} són xifres. Aquest criteri permet mostrar una part {a} (proporcionalment) dels resultats en relació al nombre total «porcions» {b}. + +Per exemple: <HTML><TT>{1/3}</TT></HTML> mostra el primer terç dels resultats. Aquest criteri és útil, sobretot, per presentar llistes en diverses columnes. Per obtenir una visualització en dues columnes, hem de crear un primer bucle, dins d’una cel·la d’una taula, amb el criteri <code>{1/2}</code> (la primera meitat dels resultats); després mostrarem un segon bucle dins una nova cel·la, amb el criteri <code>{2/2}</code> (la segona meitat dels resultats). + +{Atenció}. La utilització del [criteri <code>{doublons}</code>->#doublons] amb aquest criteri és perillós. Per exemple: + +<cadre> +<BOUCLE_prem(ARTICLES){id_rubrique}{1/2}{doublons}> + <li> #TITRE +</BOUCLE_prem> +<BOUCLE_deux(ARTICLES){id_rubrique}{2/2}{doublons}> + <li> #TITRE +</BOUCLE_deux> +</cadre> + +no mostrarà tots els articles de la secció! Imaginem, per exemple, que hi ha un total de 20 articles a la nostra secció. El BOUCLE_prem mostrarà la primera meitat dels articles, és a dir els 10 primers, i impedirà (com a conseqüència de <tt><code>{doublons}</code></tt>) de tornar-los a utilitzar. El BOUCLE_deux, per la seva part, recuperarà la segona meitat dels articles d’aquesta secció {que encara no s’han mostrat} pel BOUCLE_prem; o sigui, la meitat dels 10 articles següents, és a dir els 5 últims articles de la secció. Haurem « perdut », per tant, 5 articles en aquesta operació... + +{{{Visualització {entre} els resultats}}} + +<tt>{{<code>{</code>}}"{inter}"{{<code>}</code>}}</tt> permet indicar un codi HTML (aquí, {inter}) inserit {entre} els resultats del bucle. Per exemple, per separar una llista d’autors per una coma, ho farem de la manera següent: +<cadre><BOUCLE_auteurs(AUTEURS){id_article}{","}></cadre> + +{{{Divers}}} + +{{<code>{logo}</code>}} permet seleccionar només els articles (o seccions, etc) que disposin d\'un logo. Funciona també en el bucle (HIERARCHIE). El criteri invers <code>{!logo}</code> llista els objectes que no tenen logo.']]; + } +} diff --git a/tests/tests/Propre/EchappeHtmlTest.php b/tests/tests/Propre/EchappeHtmlTest.php new file mode 100644 index 0000000000..f92c079826 --- /dev/null +++ b/tests/tests/Propre/EchappeHtmlTest.php @@ -0,0 +1,232 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction echappe_html du fichier inc/texte.php + */ + +namespace Spip\Core\Tests\Propre; + +use PHPUnit\Framework\TestCase; + +function callback_test_propre_echappe_html_echappe($regs): string +{ + return 'A'; +} + +function callback_test_propre_echappe_html_traiter_echap_html($regs): string +{ + return callback_test_propre_echappe_html_echappe($regs); +} + +function callback_test_propre_echappe_html_traiter_echap_code($regs): string +{ + return callback_test_propre_echappe_html_echappe($regs); +} + +function callback_test_propre_echappe_html_traiter_echap_cadre($regs): string +{ + return callback_test_propre_echappe_html_echappe($regs); +} + +function callback_test_propre_echappe_html_traiter_echap_frame($regs): string +{ + return callback_test_propre_echappe_html_echappe($regs); +} + +function callback_test_propre_echappe_html_traiter_echap_script($regs): string +{ + return callback_test_propre_echappe_html_echappe($regs); +} + +class EchappeHtmlTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/texte.php', '', true); + } + + /** + * @dataProvider providerPropreEchappeHtml + */ + public function testPropreEchappeHtml($expected, ...$args): void + { + $actual = echappe_html( + $args[0], + $args[1] ?? '', + $args[2] ?? false, + $args[3] ?? '', + __NAMESPACE__ . '\\callback_test_propre_echappe_html_' + ); + $this->assertSame($expected, $actual); + } + + public static function providerPropreEchappeHtml(): array + { + $essais = []; + $marque = '<span class="base64" title="QQ=="></span>'; + $essais['simple imbriqué'] = [ + 'avant 1' . $marque . 'apres 1</code>apres 2', + 'avant 1<code class="php"> avant 2<code>le code</code>apres 1</code>apres 2', + ]; + $essais['complexe imbriqué'] = [<<<CODE_SAMPLE +{{{code class="php"}}} +avant blah +{$marque} +apres blah et avant php +{$marque} +{{{code tout court}}} +{$marque} +{{{Tu vois ?}}} +Voilà , {$marque}</code> + +On peut croire que c'est embétant , faut mettre une div autour pour encadrer , mais cela permet d'orienter geshi en cours de route comme dans [Compte à rebours (revisited)->article6] +CODE_SAMPLE + , <<<CODE_SAMPLE +{{{code class="php"}}} +avant blah +<code class="blah"> +blah in +balh 2 +</code> +apres blah et avant php +<code class="php telecharge"> +<?php +function uncomment(\$source) { +\treturn preg_replace( +\t\t'#(?:/\\*(?:(?R)|.)*\\*/|//.*\$)|(([\\'"])(?:.*)(?<!\\\\)\x02|([^\\'"/]+))#msU', +\t\t"\$1", \$source); +} +?> +</code> +{{{code tout court}}} +<code> +<?php +function uncomment(\$source) { +\treturn preg_replace( +\t\t'#(?:/\\*(?:(?R)|.)*\\*/|//.*\$)|(([\\'"])(?:.*)(?<!\\\\)\x02|([^\\'"/]+))#msU', +\t\t"\$1", \$source); +} +?> +</code> +{{{Tu vois ?}}} +Voilà , <code><code class="xxx">insere tout avec des <br /> , pas de <div class="spip_code"></code></code> + +On peut croire que c'est embétant , faut mettre une div autour pour encadrer , mais cela permet d'orienter geshi en cours de route comme dans [Compte à rebours (revisited)->article6] +CODE_SAMPLE + ]; + $essais['unicode sans rien'] = [ + 'azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-', + 'azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-azerty小さくてもグローバルなケベックの村-', + ]; + $essais['sans rien'] = [ + 'astuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolos', + 'astuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolosastuce & travaux de mode rigolos', + ]; + $essais['code sans imbrication'] = [ + 'avant 1' . $marque . 'apres 2', + 'avant 1<code class="php"> avant 2 code le code code apres 1</code>apres 2', + ]; + $essais['pourriture'] = [<<<CODE_SAMPLE +Le code mis en {$marque} ou en {$marque} peut lui même contenir {$marque} ou {$marque} ... +{$marque} +Je voudrais présenter l'usage du plugin coloration_code qui fournit une extension à geshi : la classe "spip". +Je mets donc : +{$marque} +Ici présenté avec le {$marque} d'origine de spip + +Mais si je mets le même texte dans {$marque} , voilà le résultat: +{$marque} + +Voilà c'est corrigé, [->http://trac.rezo.net/trac/spip-zone/changeset/3823] , mais on s'est aperçu que le problème est le même pour le <code> d'origine de spip. (voir plus bas) + +En fait, l'expression régulière (regexp) utilisée par le plugin pour récupérer les morceaux de code à colorer devrait être récursive ! + +{$marque} est insuffisant. + +Il faut un truc comme: +<div style="color: red;"> +{$marque} +</div> +Les différences: +- la balise de fermeture est recherchée avec \x01 , c'est à dire cadre ou code comme trouvé en début d'espression +- pour l'intérieur (le code en lui-même) on ne cherche pas seulement .* (n'importe quoi) mais (?:((?R))|.)* : le motif complet recherché , soit un <code>...</code> ou cadre imbriqué , ou n'importe quoi (.) . C'est une regexp récursive. +- une amélioration supplémentaire : le paramètre class peut être donné entre simple ou double apostrophes. +- le texte dans le tag après class="xxx" est capté ce qui pourra permettre des extensions futures, comme insérer des attributs supplémentaires au code html fabriqué. + +Essai de code dans code (au lieu de cadre comme tout en haut) + +{$marque} +et le tour est joué +</code> + +Donc comme l'ancien coloration_code, le </code> est mangé et "et le tour est joué" apparait hors-code. +CODE_SAMPLE + , <<<CODE_SAMPLE +Le code mis en <code><code></code> ou en <code><cadre></code> peut lui même contenir <code><code></code> ou <code><cadre></code> ... +<code class="xxx"> +ça 'xiste pô +</code> +Je voudrais présenter l'usage du plugin coloration_code qui fournit une extension à geshi : la classe "spip". +Je mets donc : +<cadre> +Pour insérer du code coloré, il suffit de rajouter {class="xxx"} au tag code de spip: +<code class="php"> +// mon morceau de php +\$variable = "blah"; +// ... +</code> +et le tour est joué +</cadre> +Ici présenté avec le <code><cadre></code> d'origine de spip + +Mais si je mets le même texte dans <code><cadre class="spip"></code> , voilà le résultat: +<cadre class="spip"> +Pour insérer du code coloré, il suffit de rajouter {class="xxx"} au tag code de spip: +<code class="php"> +// mon morceau de php +\$variable = "blah"; +// ... +</code> +et le tour est joué +</cadre> + +Voilà c'est corrigé, [->http://trac.rezo.net/trac/spip-zone/changeset/3823] , mais on s'est aperçu que le problème est le même pour le <code> d'origine de spip. (voir plus bas) + +En fait, l'expression régulière (regexp) utilisée par le plugin pour récupérer les morceaux de code à colorer devrait être récursive ! + +<code> +',<(cadre|code)[[:space:]]+class="(.*)"[[:space:]]*>(.*)</(cadre|code)>,Uims' +</code> est insuffisant. + +Il faut un truc comme: +<div style="color: red;"> +<code> +',<(cadre|code)[[:space:]]+class=("|\\')(.*)\x02([^>])*>((?:((?R))|.)*)</\x01>,Uims' +</code> +</div> +Les différences: +- la balise de fermeture est recherchée avec \x01 , c'est à dire cadre ou code comme trouvé en début d'espression +- pour l'intérieur (le code en lui-même) on ne cherche pas seulement .* (n'importe quoi) mais (?:((?R))|.)* : le motif complet recherché , soit un <code>...</code> ou cadre imbriqué , ou n'importe quoi (.) . C'est une regexp récursive. +- une amélioration supplémentaire : le paramètre class peut être donné entre simple ou double apostrophes. +- le texte dans le tag après class="xxx" est capté ce qui pourra permettre des extensions futures, comme insérer des attributs supplémentaires au code html fabriqué. + +Essai de code dans code (au lieu de cadre comme tout en haut) + +<code> +Pour insérer du code coloré, il suffit de rajouter {class="xxx"} au tag code de spip: +<code class="php"> +// mon morceau de php +\$variable = "blah"; +// ... +</code> +et le tour est joué +</code> + +Donc comme l'ancien coloration_code, le </code> est mangé et "et le tour est joué" apparait hors-code. +CODE_SAMPLE + ]; + return $essais; + } +} diff --git a/tests/tests/Propre/TraiterModelesTest.php b/tests/tests/Propre/TraiterModelesTest.php new file mode 100644 index 0000000000..2ea27e3569 --- /dev/null +++ b/tests/tests/Propre/TraiterModelesTest.php @@ -0,0 +1,50 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Propre; + +use PHPUnit\Framework\TestCase; + +class TraiterModelesTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/modeles.php', '', true); + } + + public function testTraiterModelesDefaut(): void + { + unset($GLOBALS['doublons_documents_inclus']); + + $texte = "Mon texte <doc1> <img2> <emb3> et paf les doublons"; + traiter_modeles($texte); + $this->assertNull($GLOBALS['doublons_documents_inclus'] ?? null); + + + traiter_modeles($texte, ['documents' => ['doc', 'emb', 'img']]); + $this->assertNotEmpty($GLOBALS['doublons_documents_inclus']); + $this->assertEquals([1, 2, 3], $GLOBALS['doublons_documents_inclus']); + + } + + public function testTraiterModelesAlbums(): void + { + unset($GLOBALS['doublons_documents_inclus']); + unset($GLOBALS['doublons_albums_inclus']); + + $texte = "Mon texte <doc1> <img2> <emb3> et paf les doublons"; + + traiter_modeles($texte, ['albums' => ['album']]); + $this->assertNull($GLOBALS['doublons_documents_inclus'] ?? null); + $this->assertNull($GLOBALS['doublons_albums_inclus'] ?? null); + + $texte = "Mon texte <doc1> <img2> <emb3> et paf les doublons avec un album <album4> ?"; + traiter_modeles($texte, ['albums' => ['album']]); + $this->assertNull($GLOBALS['doublons_documents_inclus'] ?? null); + $this->assertNotEmpty($GLOBALS['doublons_albums_inclus']); + $this->assertEquals([4], $GLOBALS['doublons_albums_inclus']); + + } + +} diff --git a/tests/tests/Propre/TraiterRaccourcisTest.php b/tests/tests/Propre/TraiterRaccourcisTest.php new file mode 100644 index 0000000000..67e74e930c --- /dev/null +++ b/tests/tests/Propre/TraiterRaccourcisTest.php @@ -0,0 +1,86 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction traiter_raccourcis du fichier inc/texte.php + */ + +namespace Spip\Core\Tests\Propre; + +use PHPUnit\Framework\TestCase; + +class TraiterRaccourcisTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/texte.php', '', true); + } + + protected function setUp(): void + { + $this->preparePropreTraiterRaccourcis(); + } + + protected function tearDown(): void + { + $this->preparePropreTraiterRaccourcis(true); + } + + public function preparePropreTraiterRaccourcis(bool $revert = false) + { + static $mem = [null, null]; + if ($revert) { + $GLOBALS['toujours_paragrapher'] = $mem[0]; + $GLOBALS['puce'] = $mem[1]; + } else { + $mem = [$GLOBALS['toujours_paragrapher'] ?? null, $GLOBALS['puce'] ?? null]; + // ces tests sont prevus pour la variable de personnalisation : + $GLOBALS['toujours_paragrapher'] = false; + $GLOBALS['puce'] = '-'; + } + } + + /** + * @dataProvider providerPropreTraiterRaccourcis + */ + public function testPropreTraiterRaccourcis($expected, ...$args): void + { + $actual = traiter_raccourcis(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerPropreTraiterRaccourcis(): array + { + return [ + /* + if (!preg_match($c = ",<p\b.*?>titi</p>\n<p\b.*?>toto</p>,", + $b = propre( $a = "titi\n\ntoto"))) + $err[] = htmlentities ("$a -- $b -- $c"); + + if (!preg_match(",<p\b.*?>titi</p>\n<p\b.*?>toto<br /></p>,", + propre("titi\n\n<br />toto<br />"))) + $err[] = 'erreur 2'; + + + if (!strpos(propre("Ligne\n\n<br class=\"n\" />\n\nAutre"), '<br class="n" />')) + $err[] = "erreur le <br class='truc'> n'est pas preserve"; + */ + // trois tests un peu identiques sur <br />... + 'div' => ["<div>titi<br />toto</div>\n<p><br />tata</p>\n", '<div>titi<br />toto</div><br />tata'], + 'span' => ['<span>titi<br />toto</span><br />tata', '<span>titi<br />toto</span><br />tata'], + 'table' => [ + "<table><tr><td>titi<br />toto</td></tr></table>\n<p><br />tata</p>\n", + '<table><tr><td>titi<br />toto</td></tr></table><br />tata', + ], + // melanges de \n et de <br /> + '\n_x1_mixte1' => ["titi\n<br />toto<br />", "titi\n<br />toto<br />"], + '\n_x1_mixte2' => ["titi\n<br />\ntoto<br />", "titi\n<br />\ntoto<br />"], + // des tirets en debut de texte + 'tirets1' => ["— chose\n<br />— truc", "-- chose\n-- truc"], + 'tirets2' => ["- chose\n<br />- truc", "- chose\n- truc"], + // ligne horizontale + 'lignehorizontale' => ['<hr class="spip" />', "\n----\n"], + ]; + } +} diff --git a/tests/tests/Propre/TraiterTableauTest.php b/tests/tests/Propre/TraiterTableauTest.php new file mode 100644 index 0000000000..da8553a9aa --- /dev/null +++ b/tests/tests/Propre/TraiterTableauTest.php @@ -0,0 +1,113 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Propre; + +use PHPUnit\Framework\TestCase; + +class TraiterTableauTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/texte.php', '', true); + } + + /** + * @dataProvider providerPropreTraiterTableau + */ + public function testPropreTraiterTableau($expected, ...$args): void + { + $actual = traiter_raccourcis(...$args); + if (is_array($expected)) { + [$func, $pattern, $result] = $expected; + if ($result) { + $this->assertMatchesRegularExpression($pattern, $actual); + } else { + $this->assertDoesNotMatchRegularExpression($pattern, $actual); + } + } else { + $this->assertSame($expected, $actual); + $this->assertEquals($expected, $actual); + } + } + + public static function providerPropreTraiterTableau(): array + { + return [ + // trois tests un peu identiques sur <br />... + 'caption seul' => [['preg_match', ',<caption>\s*titre de mon tableau\s*</caption>,i', true], + '|| titre de mon tableau|| +|{{Colonne 0}} | {{Colonne 1}} | {{Colonne 2}} | {{Colonne 3}} | {{Colonne 4}} | +| {{Bourg-les-Valence}} | 10,39 | 20,14 | 46,02 | 15,99 | +| {{Valence}} | 16,25 | 23,31 | 49,21 | 13,43 | +| {{Romans}} | 14,09 | 20,54 | 67,85 | 17 | +| {{Montelimar}} | 20,15 | 26,43 | 70,21 | 16,82 | +| {{Bourg-de-Peage}} | 13,22 | 30 | 50 | 14,67 |', + ], + 'caption' => [['preg_match', ',<caption>\s*titre de mon tableau.*</caption>,i', true], + '|| titre de mon tableau | resume de mon tableau || +|{{Colonne 0}} | {{Colonne 1}} | {{Colonne 2}} | {{Colonne 3}} | {{Colonne 4}} | +| {{Bourg-les-Valence}} | 10,39 | 20,14 | 46,02 | 15,99 | +| {{Valence}} | 16,25 | 23,31 | 49,21 | 13,43 | +| {{Romans}} | 14,09 | 20,54 | 67,85 | 17 | +| {{Montelimar}} | 20,15 | 26,43 | 70,21 | 16,82 | +| {{Bourg-de-Peage}} | 13,22 | 30 | 50 | 14,67 |', + ], + 'summary' => [[ + 'preg_match', ',<table[^>]*aria-describedby="([^"]*)"[^>]*>.*<caption>.* id="(\1)"[^>]*>\s*resume de mon tableau.*</caption>,is', true, ], + '|| titre de mon tableau | resume de mon tableau || +|{{Colonne 0}} | {{Colonne 1}} | {{Colonne 2}} | {{Colonne 3}} | {{Colonne 4}} | +| {{Bourg-les-Valence}} | 10,39 | 20,14 | 46,02 | 15,99 | +| {{Valence}} | 16,25 | 23,31 | 49,21 | 13,43 | +| {{Romans}} | 14,09 | 20,54 | 67,85 | 17 | +| {{Montelimar}} | 20,15 | 26,43 | 70,21 | 16,82 | +| {{Bourg-de-Peage}} | 13,22 | 30 | 50 | 14,67 |', + ], + 'thead simple' => [['preg_match', ',<thead>\s*<tr[^>]*>(:?<th[^>]*>.*</th>){5}\s*</tr>\s*</thead>,Uims', true], + '|| titre de mon tableau | resume de mon tableau || +|{{Colonne 0}} | {{Colonne 1}} | {{Colonne 2}} | {{Colonne 3}} | {{Colonne 4}} | +| {{Bourg-les-Valence}} | 10,39 | 20,14 | 46,02 | 15,99 | +| {{Valence}} | 16,25 | 23,31 | 49,21 | 13,43 | +| {{Romans}} | 14,09 | 20,54 | 67,85 | 17 | +| {{Montelimar}} | 20,15 | 26,43 | 70,21 | 16,82 | +| {{Bourg-de-Peage}} | 13,22 | 30 | 50 | 14,67 |', + ], + 'thead avec une colonne vide' => [[ + 'preg_match', ',<thead>\s*<tr[^>]*>(:?<th[^>]*>.*</th>){5}\s*</tr>\s*</thead>,Uims', true, ], + '|| titre de mon tableau | resume de mon tableau || +| | {{Colonne 1}} | {{Colonne 2}} | {{Colonne 3}} | {{Colonne 4}} | +| {{Bourg-les-Valence}} | 10,39 | 20,14 | 46,02 | 15,99 | +| {{Valence}} | 16,25 | 23,31 | 49,21 | 13,43 | +| {{Romans}} | 14,09 | 20,54 | 67,85 | 17 | +| {{Montelimar}} | 20,15 | 26,43 | 70,21 | 16,82 | +| {{Bourg-de-Peage}} | 13,22 | 30 | 50 | 14,67 |', + ], + 'thead avec une colonne vide et un retour ligne' => [[ + 'preg_match', ',<thead>\s*<tr[^>]*>(:?<th[^>]*>.*</th>){5}\s*</tr>\s*</thead>,Uims', true, ], + '|| titre de mon tableau | resume de mon tableau || +| | {{Colonne 1}} | {{Colonne 2}} | {{Colonne 3 +_ avec retour ligne}} | {{Colonne 4}} | +| {{Bourg-les-Valence}} | 10,39 | 20,14 | 46,02 | 15,99 | +| {{Valence}} | 16,25 | 23,31 | 49,21 | 13,43 | +| {{Romans}} | 14,09 | 20,54 | 67,85 | 17 | +| {{Montelimar}} | 20,15 | 26,43 | 70,21 | 16,82 | +| {{Bourg-de-Peage}} | 13,22 | 30 | 50 | 14,67 |', + ], + 'thead errone' => [['preg_match', ',<thead>\s*<tr[^>]*>(:?<th[^>]*>.*</th>){5}\s*</tr>\s*</thead>,Uims', false], + '|| titre de mon tableau | resume de mon tableau || +|{{Colonne 0}} | {Colonne 1}} | {{Colonne 2}} | {{Colonne 3}} | {{Colonne 4}} | +| {{Bourg-les-Valence}} | 10,39 | 20,14 | 46,02 | 15,99 | +| {{Valence}} | 16,25 | 23,31 | 49,21 | 13,43 | +| {{Romans}} | 14,09 | 20,54 | 67,85 | 17 | +| {{Montelimar}} | 20,15 | 26,43 | 70,21 | 16,82 | +| {{Bourg-de-Peage}} | 13,22 | 30 | 50 | 14,67 |', + ], + 'fusion par |<|' => [['preg_match', ',colspan=.*colspan=,is', true], '| {{Bourg-de-Peage}} | 1-2 |<|3-4|<|'], + "fusion |<| avec conservation d'URL dans un raccourci de liens" => [['preg_match', ',colspan=.*->,is', true], + '|test avec fusion dans tous les sens|<| +|test1 |[mon beau lien->http://foo.fr]|', + ], + ]; + } +} diff --git a/tests/tests/Sql/Objets/IdTableObjetTest.php b/tests/tests/Sql/Objets/IdTableObjetTest.php new file mode 100644 index 0000000000..48bf2cff64 --- /dev/null +++ b/tests/tests/Sql/Objets/IdTableObjetTest.php @@ -0,0 +1,108 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction id_table_objet du fichier base/connect_sql.php + */ + +namespace Spip\Core\Tests\Sql\Objets; + +use PHPUnit\Framework\TestCase; + +class IdTableObjetTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('base/connect_sql.php', '', true); + } + + /** + * @dataProvider providerConnectSqlIdTableObjet + */ + public function testConnectSqlIdTableObjet($expected, ...$args): void + { + $actual = id_table_objet(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerConnectSqlIdTableObjet(): array + { + return [[ + 0 => 'id_article', + 1 => 'articles', + ], [ + 0 => 'id_article', + 1 => 'article', + ], [ + 0 => 'id_article', + 1 => 'spip_articles', + ], [ + 0 => 'id_article', + 1 => 'id_article', + ], [ + 0 => 'id_rubrique', + 1 => 'rubriques', + ], [ + 0 => 'id_rubrique', + 1 => 'spip_rubriques', + ], [ + 0 => 'id_rubrique', + 1 => 'id_rubrique', + ], [ + 0 => 'id_mot', + 1 => 'mots', + ], [ + 0 => 'id_mot', + 1 => 'spip_mots', + ], [ + 0 => 'id_mot', + 1 => 'id_mot', + ], [ + 0 => 'id_groupe', + 1 => 'groupes_mots', + ], [ + 0 => 'id_groupe', + 1 => 'spip_groupes_mots', + ], [ + 0 => 'id_groupe', + 1 => 'id_groupe', + ], [ + 0 => 'id_groupe', + 1 => 'groupes_mot', + ], [ + 0 => 'id_syndic', + 1 => 'syndic', + ], [ + 0 => 'id_syndic', + 1 => 'site', + ], [ + 0 => 'id_syndic', + 1 => 'spip_syndic', + ], [ + 0 => 'id_syndic', + 1 => 'id_syndic', + ], [ + 0 => 'id_syndic_article', + 1 => 'syndic_articles', + ], [ + 0 => 'id_syndic_article', + 1 => 'spip_syndic_articles', + ], [ + 0 => 'id_syndic_article', + 1 => 'id_syndic_article', + ], [ + 0 => 'id_syndic_article', + 1 => 'syndic_article', + ], ['id_article', 'article'], ['id_auteur', 'auteur'], ['id_document', 'document'], ['id_document', 'doc'], [ + 'id_document', + 'img', + ], ['id_document', 'img'], ['id_forum', 'forum'], ['id_groupe', 'groupe_mots'], [ + 'id_groupe', + 'groupe_mot', + ], ['id_groupe', 'groupes_mots'], ['id_groupe', 'groupe'], ['id_mot', 'mot'], ['id_rubrique', 'rubrique'], [ + 'id_syndic', + 'syndic', + ], ['id_syndic', 'site'], ['id_syndic_article', 'syndic_article'], ['extension', 'type_document']]; + } +} diff --git a/tests/tests/Sql/Objets/ObjetTypeTest.php b/tests/tests/Sql/Objets/ObjetTypeTest.php new file mode 100644 index 0000000000..0bc553168e --- /dev/null +++ b/tests/tests/Sql/Objets/ObjetTypeTest.php @@ -0,0 +1,117 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction objet_type du fichier base/connect_sql.php + */ + +namespace Spip\Core\Tests\Sql\Objets; + +use PHPUnit\Framework\TestCase; + +class ObjetTypeTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('base/connect_sql.php', '', true); + } + + /** + * @dataProvider providerConnectSqlObjetType + */ + public function testConnectSqlObjetType($expected, ...$args): void + { + $actual = objet_type(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerConnectSqlObjetType(): array + { + return [[ + 0 => 'article', + 1 => 'articles', + ], [ + 0 => 'article', + 1 => 'article', + ], [ + 0 => 'article', + 1 => 'spip_articles', + ], [ + 0 => 'article', + 1 => 'id_article', + ], [ + 0 => 'rubrique', + 1 => 'rubriques', + ], [ + 0 => 'rubrique', + 1 => 'spip_rubriques', + ], [ + 0 => 'rubrique', + 1 => 'id_rubrique', + ], [ + 0 => 'mot', + 1 => 'mots', + ], [ + 0 => 'mot', + 1 => 'spip_mots', + ], [ + 0 => 'mot', + 1 => 'id_mot', + ], [ + 0 => 'groupe_mots', + 1 => 'groupes_mots', + ], [ + 0 => 'groupe_mots', + 1 => 'spip_groupes_mots', + ], [ + 0 => 'groupe_mots', + 1 => 'id_groupe', + ], [ + 0 => 'groupe_mots', + 1 => 'groupes_mot', + ], [ + 0 => 'site', + 1 => 'syndic', + ], [ + 0 => 'site', + 1 => 'site', + ], [ + 0 => 'site', + 1 => 'spip_syndic', + ], [ + 0 => 'site', + 1 => 'id_syndic', + ], [ + 0 => 'syndic_article', + 1 => 'syndic_articles', + ], [ + 0 => 'syndic_article', + 1 => 'spip_syndic_articles', + ], [ + 0 => 'syndic_article', + 1 => 'id_syndic_article', + ], [ + 0 => 'syndic_article', + 1 => 'syndic_article', + ], [ + 0 => 'site', + 1 => 'racine-site', + ], [ + 0 => 'mot', + 1 => 'mot-cle', + ], [ + 0 => 'truc_pas_connu', + 1 => 'truc_pas_connu', + ], [ + 0 => 'truc_pas_connu', + 1 => 'truc_pas_connus', + ], ['article', 'articles'], ['auteur', 'auteurs'], ['document', 'documents'], ['forum', 'forums'], [ + 'forum', + 'forum', + ], ['groupe_mots', 'groupes_mots'], ['mot', 'mots'], [ + 'rubrique', + 'rubriques', + ], ['site', 'syndic'], ['syndic_article', 'syndic_articles'], ['types_document', 'types_documents']]; + } +} diff --git a/tests/tests/Sql/Objets/QueryEchappeTextesTest.php b/tests/tests/Sql/Objets/QueryEchappeTextesTest.php new file mode 100644 index 0000000000..3c5a768095 --- /dev/null +++ b/tests/tests/Sql/Objets/QueryEchappeTextesTest.php @@ -0,0 +1,105 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction query_echappe_textes du fichier base/connect_sql.php + */ + +namespace Spip\Core\Tests\Sql\Objets; + +use PHPUnit\Framework\TestCase; + +class QueryEchappeTextesTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('base/connect_sql.php', '', true); + } + + protected function setUp(): void + { + query_echappe_textes('', 'uniqid'); + } + + /** + * @dataProvider providerConnectSqlQueryEchappeTextes + */ + public function testConnectSqlQueryEchappeTextes($expected, ...$args): void + { + $actual = query_echappe_textes(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerConnectSqlQueryEchappeTextes(): array + { + $md5 = substr(md5('uniqid'), 0, 4); + return [ + [ + 0 => ['%1$s', ["'guillemets simples'"]], + 1 => "'guillemets simples'", + ], + [ + 0 => ['%1$s', ['"guillemets doubles"']], + 1 => '"guillemets doubles"', + ], + [ + 0 => ['%1$s,%2$s', ["'guillemets simples 1/2'", "'guillemets simples 2/2'"]], + 1 => "'guillemets simples 1/2','guillemets simples 2/2'", + ], + [ + 0 => ['%1$s,%2$s', ['"guillemets doubles 1/2"', '"guillemets doubles 2/2"']], + 1 => '"guillemets doubles 1/2","guillemets doubles 2/2"', + ], + [ + 0 => ['%1$s', ["'guillemets simples \x02@#{$md5}#@\x02 avec un echappement'"]], + 1 => "'guillemets simples \\' avec un echappement'", + ], + [ + 0 => ['%1$s', ["\"guillemets doubles \x03@#{$md5}#@\x03 avec un echappement\""]], + 1 => '"guillemets doubles \\" avec un echappement"', + ], + [ + 0 => ['%1$s', ["'guillemets simples \x02@#{$md5}#@\x02\x03@#{$md5}#@\x03 avec deux echappements'"]], + 1 => "'guillemets simples \\'\\\" avec deux echappements'", + ], + [ + 0 => ['%1$s', ["\"guillemets doubles \x02@#{$md5}#@\x02\x03@#{$md5}#@\x03 avec deux echappements\""]], + 1 => "\"guillemets doubles \\'\\\" avec deux echappements\"", + ], + [ + 0 => ['%1$s', ["'guillemet double \" dans guillemets simples'"]], + 1 => "'guillemet double \" dans guillemets simples'", + ], + [ + 0 => ['%1$s', ["\"guillemet simple ' dans guillemets doubles\""]], + 1 => "\"guillemet simple ' dans guillemets doubles\"", + ], + // sortie de sqlitemanager firefox + // (description de table suite a import d'une table au format xml/phpmyadmin v5) + [ + 0 => ['%1$s INTEGER,%2$s VARCHAR', ['"id_objet"', '"objet"']], + 1 => '"id_objet" INTEGER,"objet" VARCHAR', + ], + [ + 0 => [ + 'UPDATE spip_truc SET html=%1$s WHERE id_truc=1', + ["'''0'' style=''margin: 0;padding: 0;width: 100\x04@#{$md5}#@\x04;border: 0;height: auto;lin'"], ], + 1 => "UPDATE spip_truc SET html='''0'' style=''margin: 0;padding: 0;width: 100%;border: 0;height: auto;lin' WHERE id_truc=1", + ], + [ + 0 => [ + 'UPDATE spip_truc SET html=%1$s, texte=%2$s WHERE id_truc=1', + ["'''0'' style=''margin: 0;padding: 0;width: 100\x04@#{$md5}#@\x04;border: 0;height: auto;lin'", "'toto'"], + ], + 1 => "UPDATE spip_truc SET html='''0'' style=''margin: 0;padding: 0;width: 100%;border: 0;height: auto;lin', texte='toto' WHERE id_truc=1", + ], + [ + 0 => [ + 'UPDATE spip_truc SET texte=%1$s, html=%2$s WHERE id_truc=1', + ["''", "'''0'' style=''margin: 0;padding: 0;width: 100\x04@#{$md5}#@\x04;border: 0;height: auto;lin'"], ], + 1 => "UPDATE spip_truc SET texte='', html='''0'' style=''margin: 0;padding: 0;width: 100%;border: 0;height: auto;lin' WHERE id_truc=1", + ], + ]; + } +} diff --git a/tests/tests/Sql/Objets/TableObjetSqlTest.php b/tests/tests/Sql/Objets/TableObjetSqlTest.php new file mode 100644 index 0000000000..f3bbbf7f77 --- /dev/null +++ b/tests/tests/Sql/Objets/TableObjetSqlTest.php @@ -0,0 +1,111 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction table_objet_sql du fichier base/connect_sql.php + */ + +namespace Spip\Core\Tests\Sql\Objets; + +use PHPUnit\Framework\TestCase; + +class TableObjetSqlTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('base/connect_sql.php', '', true); + } + + /** + * @dataProvider providerConnectSqlTableObjetSql + */ + public function testConnectSqlTableObjetSql($expected, ...$args): void + { + $actual = table_objet_sql(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerConnectSqlTableObjetSql(): array + { + return [[ + 0 => 'spip_articles', + 1 => 'articles', + ], [ + 0 => 'spip_articles', + 1 => 'article', + ], [ + 0 => 'spip_articles', + 1 => 'spip_articles', + ], [ + 0 => 'spip_articles', + 1 => 'id_article', + ], [ + 0 => 'spip_rubriques', + 1 => 'rubrique', + ], [ + 0 => 'spip_rubriques', + 1 => 'spip_rubriques', + ], [ + 0 => 'spip_rubriques', + 1 => 'id_rubrique', + ], [ + 0 => 'spip_mots', + 1 => 'mot', + ], [ + 0 => 'spip_mots', + 1 => 'spip_mots', + ], [ + 0 => 'spip_mots', + 1 => 'id_mot', + ], [ + 0 => 'spip_groupes_mots', + 1 => 'groupe_mots', + ], [ + 0 => 'spip_groupes_mots', + 1 => 'spip_groupes_mots', + ], [ + 0 => 'spip_groupes_mots', + 1 => 'id_groupe', + ], [ + 0 => 'spip_groupes_mots', + 1 => 'groupes_mot', + ], [ + 0 => 'spip_syndic', + 1 => 'syndic', + ], [ + 0 => 'spip_syndic', + 1 => 'site', + ], [ + 0 => 'spip_syndic', + 1 => 'spip_syndic', + ], [ + 0 => 'spip_syndic', + 1 => 'id_syndic', + ], [ + 0 => 'spip_syndic_articles', + 1 => 'syndic_article', + ], [ + 0 => 'spip_syndic_articles', + 1 => 'spip_syndic_articles', + ], [ + 0 => 'spip_syndic_articles', + 1 => 'id_syndic_article', + ], [ + 0 => 'spip_syndic_articles', + 1 => 'syndic_article', + ], ['spip_articles', 'article'], ['spip_auteurs', 'auteur'], ['spip_documents', 'document'], [ + 'spip_documents', + 'doc', + ], ['spip_documents', 'img'], ['spip_documents', 'img'], ['spip_forum', 'forum'], [ + 'spip_groupes_mots', + 'groupes_mots', + ], ['spip_groupes_mots', 'groupe_mots'], ['spip_groupes_mots', 'groupe_mot'], [ + 'spip_groupes_mots', + 'groupe', + ], ['spip_mots', 'mot'], ['spip_rubriques', 'rubrique'], ['spip_syndic', 'syndic'], [ + 'spip_syndic', + 'site', + ], ['spip_syndic_articles', 'syndic_article'], ['spip_types_documents', 'type_document']]; + } +} diff --git a/tests/tests/Sql/Objets/TableObjetTest.php b/tests/tests/Sql/Objets/TableObjetTest.php new file mode 100644 index 0000000000..2c5524f624 --- /dev/null +++ b/tests/tests/Sql/Objets/TableObjetTest.php @@ -0,0 +1,108 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction table_objet du fichier base/connect_sql.php + */ + +namespace Spip\Core\Tests\Sql\Objets; + +use PHPUnit\Framework\TestCase; + +class TableObjetTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('base/connect_sql.php', '', true); + } + + /** + * @dataProvider providerConnectSqlTableObjet + */ + public function testConnectSqlTableObjet($expected, ...$args): void + { + $actual = table_objet(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerConnectSqlTableObjet(): array + { + return [[ + 0 => 'articles', + 1 => 'articles', + ], [ + 0 => 'articles', + 1 => 'article', + ], [ + 0 => 'articles', + 1 => 'spip_articles', + ], [ + 0 => 'articles', + 1 => 'id_article', + ], [ + 0 => 'rubriques', + 1 => 'rubrique', + ], [ + 0 => 'rubriques', + 1 => 'spip_rubriques', + ], [ + 0 => 'rubriques', + 1 => 'id_rubrique', + ], [ + 0 => 'mots', + 1 => 'mot', + ], [ + 0 => 'mots', + 1 => 'spip_mots', + ], [ + 0 => 'mots', + 1 => 'id_mot', + ], [ + 0 => 'groupes_mots', + 1 => 'groupe_mots', + ], [ + 0 => 'groupes_mots', + 1 => 'spip_groupes_mots', + ], [ + 0 => 'groupes_mots', + 1 => 'id_groupe', + ], [ + 0 => 'groupes_mots', + 1 => 'groupes_mot', + ], [ + 0 => 'syndic', + 1 => 'syndic', + ], [ + 0 => 'syndic', + 1 => 'site', + ], [ + 0 => 'syndic', + 1 => 'spip_syndic', + ], [ + 0 => 'syndic', + 1 => 'id_syndic', + ], [ + 0 => 'syndic_articles', + 1 => 'syndic_article', + ], [ + 0 => 'syndic_articles', + 1 => 'spip_syndic_articles', + ], [ + 0 => 'syndic_articles', + 1 => 'id_syndic_article', + ], [ + 0 => 'syndic_articles', + 1 => 'syndic_article', + ], ['articles', 'article'], ['auteurs', 'auteur'], ['documents', 'document'], ['documents', 'doc'], [ + 'documents', + 'img', + ], ['documents', 'img'], ['forums', 'forum'], [ + 'groupes_mots', + 'groupe_mots', + ], ['groupes_mots', 'groupe_mot'], ['groupes_mots', 'groupe'], ['mots', 'mot'], ['rubriques', 'rubrique'], [ + 'syndic', + 'syndic', + ], ['syndic', 'site'], ['syndic_articles', 'syndic_article'], ['types_documents', 'type_document']]; + } +} diff --git a/tests/tests/Sql/SqlInMysqlTest.php b/tests/tests/Sql/SqlInMysqlTest.php new file mode 100644 index 0000000000..ada1492a6d --- /dev/null +++ b/tests/tests/Sql/SqlInMysqlTest.php @@ -0,0 +1,200 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Sql; + +use PHPUnit\Framework\TestCase; + +class SqlInMysqlTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('base/abstract_sql.php', '', true); + } + + protected function setUp(): void + { + if ($this->getSqlType() !== 'mysql') { + $this->markTestSkipped('Needs a Mysql database'); + } + } + + /** + * @dataProvider providerMysqlSqliIn + * */ + public function testMysqlSqlIn($expected, ...$args): void + { + $this->assertEquals($expected, sql_in(...$args)); + } + + public static function providerMysqlSqliIn(): array + { + return [ + 0 => + [ + 0 => '(id_rubrique IN (1,2,3))', + 1 => 'id_rubrique', + 2 => '1,2,3', + ], + 1 => + [ + 0 => '(id_rubrique IN (1,2,3))', + 1 => 'id_rubrique', + 2 => + [ + 0 => 1, + 1 => 2, + 2 => 3, + ], + ], + 2 => + [ + 0 => '(id_rubrique NOT IN (1,2,3))', + 1 => 'id_rubrique', + 2 => '1,2,3', + 3 => 'NOT', + ], + 3 => + [ + 0 => '(id_rubrique NOT IN (1,2,3))', + 1 => 'id_rubrique', + 2 => + [ + 0 => 1, + 1 => 2, + 2 => 3, + ], + 3 => 'NOT', + ], + 4 => + [ + 0 => '0=1', + 1 => 'id_rubrique', + 2 => + [], + ], + 5 => + [ + 0 => '(id_rubrique IN (\'\',0,\'Un texte avec des <a href=\"http://spip.net\">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net\',\'Un texte avec des entités &<>"\',\'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;\',\'Un texte avec des entités numériques &<>"\',\'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;\',\'Un texte sans entites &<>\"\\\'\',\'{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>\',\'Un modele <modeleinexistant|lien=[->https://www.spip.net]>\',\'Un texte avec des retour +a la ligne et meme des + +paragraphes\'))', + 1 => 'id_rubrique', + 2 => + [ + 0 => '', + 1 => '0', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 3 => 'Un texte avec des entités &<>"', + 4 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 5 => 'Un texte avec des entités numériques &<>"', + 6 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 7 => 'Un texte sans entites &<>"\'', + 8 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 9 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 10 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + ], + 6 => + [ + 0 => '(id_rubrique IN (0,-1,1,2,3,4,5,6,7,10,20,30,50,100,1000,10000))', + 1 => 'id_rubrique', + 2 => + [ + 0 => 0, + 1 => -1, + 2 => 1, + 3 => 2, + 4 => 3, + 5 => 4, + 6 => 5, + 7 => 6, + 8 => 7, + 9 => 10, + 10 => 20, + 11 => 30, + 12 => 50, + 13 => 100, + 14 => 1000, + 15 => 10000, + ], + ], + 7 => + [ + 0 => '0=1', + 1 => 'id_rubrique', + 2 => + [ + 0 => + [], + 1 => + [ + 0 => '', + 1 => '0', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 3 => 'Un texte avec des entités &<>"', + 4 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 5 => 'Un texte avec des entités numériques &<>"', + 6 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 7 => 'Un texte sans entites &<>"\'', + 8 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 9 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 10 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + 2 => + [ + 0 => 0, + 1 => -1, + 2 => 1, + 3 => 2, + 4 => 3, + 5 => 4, + 6 => 5, + 7 => 6, + 8 => 7, + 9 => 10, + 10 => 20, + 11 => 30, + 12 => 50, + 13 => 100, + 14 => 1000, + 15 => 10000, + ], + 3 => + [ + 0 => true, + 1 => false, + ], + ], + ], + 8 => + [ + 0 => '(id_rubrique IN (2))', + 1 => 'id_rubrique', + 2 => 2, + ], + 9 => + [ + 0 => '(id_rubrique IN (1,0))', + 1 => 'id_rubrique', + 2 => + [ + 0 => true, + 1 => false, + ], + ], + ]; + } + + private function getSqlType(): string + { + return $GLOBALS['connexions'][0]['type'] ?? ''; + } +} diff --git a/tests/tests/Sql/SqlInSqliteTest.php b/tests/tests/Sql/SqlInSqliteTest.php new file mode 100644 index 0000000000..ed4db01921 --- /dev/null +++ b/tests/tests/Sql/SqlInSqliteTest.php @@ -0,0 +1,200 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Sql; + +use PHPUnit\Framework\TestCase; + +class SqlInSqliteTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('base/abstract_sql.php', '', true); + } + + protected function setUp(): void + { + if ($this->getSqlType() !== 'sqlite3') { + $this->markTestSkipped('Needs a Sqlite database'); + } + } + + /** + * @dataProvider providerSqliteSqliIn + */ + public function testSqliteSqlIn($expected, ...$args): void + { + $this->assertEquals($expected, sql_in(...$args)); + } + + public static function providerSqliteSqliIn(): array + { + return [ + 0 => + [ + 0 => '(id_rubrique IN (1,2,3))', + 1 => 'id_rubrique', + 2 => '1,2,3', + ], + 1 => + [ + 0 => '(id_rubrique IN (1,2,3))', + 1 => 'id_rubrique', + 2 => + [ + 0 => 1, + 1 => 2, + 2 => 3, + ], + ], + 2 => + [ + 0 => '(id_rubrique NOT IN (1,2,3))', + 1 => 'id_rubrique', + 2 => '1,2,3', + 3 => 'NOT', + ], + 3 => + [ + 0 => '(id_rubrique NOT IN (1,2,3))', + 1 => 'id_rubrique', + 2 => + [ + 0 => 1, + 1 => 2, + 2 => 3, + ], + 3 => 'NOT', + ], + 4 => + [ + 0 => '0=1', + 1 => 'id_rubrique', + 2 => + [], + ], + 5 => + [ + 0 => '(id_rubrique IN (\'\',0,\'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net\',\'Un texte avec des entités &<>"\',\'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;\',\'Un texte avec des entités numériques &<>"\',\'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;\',\'Un texte sans entites &<>"\'\'\',\'{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>\',\'Un modele <modeleinexistant|lien=[->https://www.spip.net]>\',\'Un texte avec des retour +a la ligne et meme des + +paragraphes\'))', + 1 => 'id_rubrique', + 2 => + [ + 0 => '', + 1 => '0', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 3 => 'Un texte avec des entités &<>"', + 4 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 5 => 'Un texte avec des entités numériques &<>"', + 6 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 7 => 'Un texte sans entites &<>"\'', + 8 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 9 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 10 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + ], + 6 => + [ + 0 => '(id_rubrique IN (0,-1,1,2,3,4,5,6,7,10,20,30,50,100,1000,10000))', + 1 => 'id_rubrique', + 2 => + [ + 0 => 0, + 1 => -1, + 2 => 1, + 3 => 2, + 4 => 3, + 5 => 4, + 6 => 5, + 7 => 6, + 8 => 7, + 9 => 10, + 10 => 20, + 11 => 30, + 12 => 50, + 13 => 100, + 14 => 1000, + 15 => 10000, + ], + ], + 7 => + [ + 0 => '0=1', + 1 => 'id_rubrique', + 2 => + [ + 0 => + [], + 1 => + [ + 0 => '', + 1 => '0', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 3 => 'Un texte avec des entités &<>"', + 4 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 5 => 'Un texte avec des entités numériques &<>"', + 6 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 7 => 'Un texte sans entites &<>"\'', + 8 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 9 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', + 10 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + 2 => + [ + 0 => 0, + 1 => -1, + 2 => 1, + 3 => 2, + 4 => 3, + 5 => 4, + 6 => 5, + 7 => 6, + 8 => 7, + 9 => 10, + 10 => 20, + 11 => 30, + 12 => 50, + 13 => 100, + 14 => 1000, + 15 => 10000, + ], + 3 => + [ + 0 => true, + 1 => false, + ], + ], + ], + 8 => + [ + 0 => '(id_rubrique IN (2))', + 1 => 'id_rubrique', + 2 => 2, + ], + 9 => + [ + 0 => '(id_rubrique IN (1,0))', + 1 => 'id_rubrique', + 2 => + [ + 0 => true, + 1 => false, + ], + ], + ]; + } + + private function getSqlType(): string + { + return $GLOBALS['connexions'][0]['type'] ?? ''; + } +} diff --git a/tests/tests/Squelettes/Balise/AutoriserTest.php b/tests/tests/Squelettes/Balise/AutoriserTest.php new file mode 100644 index 0000000000..00a172ed08 --- /dev/null +++ b/tests/tests/Squelettes/Balise/AutoriserTest.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; + +class AutoriserTest extends SquelettesTestCase +{ + public function testAutoriserSqueletteOkNiet(): void + { + $this->assertOkCode('[(#AUTORISER{ok})ok]'); + $this->assertOkCode('[(#AUTORISER{niet}|sinon{ok})]'); + $this->assertOkCode(' + [(#AUTORISER{niet}|?{Ah ben non !! il faut pas..., + [(#AUTORISER{ok}|?{OK,Allez quoi dis-moi oui!})] + })] + '); + } +} diff --git a/tests/tests/Squelettes/Balise/BaliseDetacheeTest.php b/tests/tests/Squelettes/Balise/BaliseDetacheeTest.php new file mode 100644 index 0000000000..db5c9b32bb --- /dev/null +++ b/tests/tests/Squelettes/Balise/BaliseDetacheeTest.php @@ -0,0 +1,51 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; +use Spip\Core\Testing\Templating; + +class BaliseDetacheeTest extends SquelettesTestCase +{ + public function testNecessiteNomSite(): void + { + $this->assertNotEmptyCode('<BOUCLE_meta(spip_meta){nom=nom_site}>#VALEUR</BOUCLE_meta>'); + } + + /** + * @depends testNecessiteNomSite + */ + public function testBaliseDetacheeInterne(): void + { + $templating = Templating::fromString(); + $expected = $templating->render('<BOUCLE_meta(spip_meta){nom=nom_site}>#VALEUR</BOUCLE_meta>'); + $actual = $templating->render( + '<BOUCLE_meta(spip_meta){nom=nom_site}> + <BOUCLE_meta2(spip_meta){nom=adresse_site}> + #_meta:VALEUR + </BOUCLE_meta2> + </BOUCLE_meta>' + ); + + $this->assertEquals($expected, trim($actual)); + } + + public function testBaliseDetacheeHorsBoucle(): void + { + // en dehors de sa boucle, une balise detachee n'est pas reconnue + $this->assertEmptyCode( + '<BOUCLE_meta(spip_meta){nom=nom_site}></BOUCLE_meta> + <BOUCLE_meta2(spip_meta){nom=version_base}>#_meta:VALEUR</BOUCLE_meta2>' + ); + } + + /** + * @depends testBaliseDetacheeInterne + */ + public function testBaliseDetacheeComplexe(): void + { + $this->assertOkSquelette(__DIR__ . '/data/balise_detachee.html'); + } +} diff --git a/tests/tests/Squelettes/Balise/BaliseGeneriqueTest.php b/tests/tests/Squelettes/Balise/BaliseGeneriqueTest.php new file mode 100644 index 0000000000..823ba7f418 --- /dev/null +++ b/tests/tests/Squelettes/Balise/BaliseGeneriqueTest.php @@ -0,0 +1,118 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; +use Spip\Core\Testing\Templating; + +class BaliseGeneriqueTest extends SquelettesTestCase +{ + public function testBaliseInexistante(): void + { + $this->assertEmptyCode('#JENEXISTEPAS'); + $this->assertEmptyCode('[(#JENEXISTEPAS)]'); + $this->assertEmptyCode('[avant(#JENEXISTEPAS)apres]'); + + // ceux-ci sont plus etonnant mais c'est ce qui se passe effectivement + $this->assertEqualsCode('{rien}', '#JENEXISTEPAS{rien}'); + $this->assertEqualsCode('{rien}', '[(#JENEXISTEPAS{rien})]'); + $this->assertEqualsCode('avant{rien}apres', '[avant(#JENEXISTEPAS{rien})apres]'); + } + + public function testBaliseDeclaree(): void + { + $templating = Templating::fromString([ + 'fonctions' => ' + function balise_JEXISTE_dist($p){ + $p->code = "\'ok\'"; + return $p; + } + ', + ]); + $this->assertOkTemplate($templating, '#JEXISTE'); + $this->assertOkTemplate($templating, '[(#JEXISTE)]'); + } + + public function testBaliseDeclareeAvantApres(): void + { + $templating = Templating::fromString([ + 'fonctions' => ' + function balise_JEXISTE_dist($p){ + $p->code = "\'ok\'"; + return $p; + } + ', + ]); + + $this->assertEqualsTemplate('avantokapres', $templating, '[avant(#JEXISTE)apres]'); + $this->assertEqualsTemplate('avant apres', $templating, '[avant(#JEXISTE|oui)apres]'); + $this->assertEqualsTemplate('', $templating, '[avant(#JEXISTE|non)apres]'); + } + + public function testBaliseDeclareeEtParams(): void + { + $templating = Templating::fromString([ + 'fonctions' => ' + function balise_JEXISTE_dist($p){ + $p->code = "\'ok\'"; + return $p; + } + ', + ]); + + $this->assertOkTemplate($templating, '#JEXISTE{param}'); + $this->assertOkTemplate($templating, '#JEXISTE{param,param}'); + $this->assertOkTemplate($templating, '#JEXISTE{#SELF,#SQUELETTE}'); + $this->assertOkTemplate($templating, '#JEXISTE{#VAL{#SELF}}'); + $this->assertOkTemplate($templating, '[(#JEXISTE{[(#VAL{[(#SELF)]})]})]'); + } + + public function testBaliseDeclareeEtParamsUtiles(): void + { + $templating = Templating::fromString([ + 'fonctions' => ' + function balise_ZEXISTE_dist($p){ + if (!$p1 = interprete_argument_balise(1,$p)) + $p1 = "\'\'"; + $p->code = "affiche_zexiste($p1)"; + return $p; + } + function affiche_zexiste($p1){ + return $p1; + } + ', + ]); + $this->assertEmptyTemplate($templating, '#ZEXISTE'); + $this->assertOkTemplate($templating, '#ZEXISTE{ok}'); + $this->assertEqualsTemplate('avantokapres', $templating, '[avant(#ZEXISTE{ok})apres]'); + $this->assertEqualsTemplate('avant apres', $templating, '[avant(#ZEXISTE{ok}|oui)apres]'); + $this->assertEmptyTemplate($templating, '[avant(#ZEXISTE{ok}|non)apres]'); + } + + public function testBaliseSurchargee(): void + { + $templating = Templating::fromString([ + 'fonctions' => ' + function balise_REXISTE_dist($p){ + $p->code = "\'oups\'"; + return $p; + } + function balise_REXISTE($p){ + if (!$p1 = interprete_argument_balise(1,$p)) { + $p1 = "\'\'"; + } + $p->code = "affiche_rexiste($p1)"; + return $p; + } + function affiche_rexiste($p1){ + return $p1; + } + ', + ]); + + $this->assertEmptyTemplate($templating, '#REXISTE'); + $this->assertOkTemplate($templating, '#REXISTE{ok}'); + } +} diff --git a/tests/tests/Squelettes/Balise/ConfigTest.php b/tests/tests/Squelettes/Balise/ConfigTest.php new file mode 100644 index 0000000000..0177741764 --- /dev/null +++ b/tests/tests/Squelettes/Balise/ConfigTest.php @@ -0,0 +1,244 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; +use Spip\Core\Testing\Templating; + +class ConfigTest extends SquelettesTestCase +{ + public function testConfigNomAbsent(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate($templating, '[(#CONFIG{pasla}|non)ok]'); + } + + public function testConfigNomAbsentAvecDefaut(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate($templating, '[(#CONFIG{pasla,defaut}|=={defaut}|oui)ok]'); + } + + public function testConfigChaine(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate($templating, '[(#CONFIG{chaine}|=={une chaine}|oui)ok]'); + $this->assertOkTemplate($templating, '[(#CONFIG{chaine,defaut}|=={une chaine}|oui)ok]'); + } + + public function testConfigValeurZero(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate($templating, '[(#CONFIG{zero}|=={0}|oui)ok]'); + $this->assertOkTemplate($templating, '[(#CONFIG{zero,defaut}|=={0}|oui)ok]'); + } + + public function testConfigChaineZero(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate($templating, "[(#CONFIG{zeroc}|=={'0'}|oui)ok]"); + $this->assertOkTemplate($templating, "[(#CONFIG{zeroc,defaut}|=={'0'}|oui)ok]"); + } + + public function testArrayAssoc(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate($templating, "[(#CONFIG{assoc,'',''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]"); + $this->assertOkTemplate($templating, "[(#CONFIG{assoc,defaut,''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]"); + } + + public function testArraySerialize(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate( + $templating, + '[(#CONFIG{serie}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' + ); + $this->assertOkTemplate( + $templating, + '[(#CONFIG{serie,defaut}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' + ); + } + + public function testMetaConfigNomAbsent(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate($templating, '[(#CONFIG{/meta/pasla}|non)ok]'); + } + + public function testMetaConfigNomAbsentAvecDefaut(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate($templating, '[(#CONFIG{/meta/pasla,defaut}|=={defaut}|oui)ok]'); + } + + public function testMetaConfigChaine(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate($templating, '[(#CONFIG{/meta/chaine}|=={une chaine}|oui)ok]'); + $this->assertOkTemplate($templating, '[(#CONFIG{/meta/chaine,defaut}|=={une chaine}|oui)ok]'); + } + + public function testMetaConfigValeurZero(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate($templating, '[(#CONFIG{/meta/zero}|=={0}|oui)ok]'); + $this->assertOkTemplate($templating, '[(#CONFIG{/meta/zero,defaut}|=={0}|oui)ok]'); + } + + public function testMetaConfigChaineZero(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate($templating, "[(#CONFIG{/meta/zeroc}|=={'0'}|oui)ok]"); + $this->assertOkTemplate($templating, "[(#CONFIG{/meta/zeroc,defaut}|=={'0'}|oui)ok]"); + } + + public function testMetaArrayAssoc(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate($templating, "[(#CONFIG{/meta/assoc,'',''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]"); + $this->assertOkTemplate( + $templating, + "[(#CONFIG{/meta/assoc,defaut,''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]" + ); + } + + public function testMetaArraySerialize(): void + { + $templating = $this->getTemplating(); + $this->assertOkTemplate( + $templating, + '[(#CONFIG{/meta/serie}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' + ); + $this->assertOkTemplate( + $templating, + '[(#CONFIG{/meta/serie,defaut}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' + ); + } + + public function testAutreTableConfigNomAbsent(): void + { + $templating = $this->getTemplatingOtherTable(); + $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tpasla}|non)ok]'); + } + + public function testAutreTableConfigNomAbsentAvecDefaut(): void + { + $templating = $this->getTemplatingOtherTable(); + $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tpasla,defaut}|=={defaut}|oui)ok]'); + } + + public function testAutreTableConfigChaine(): void + { + $templating = $this->getTemplatingOtherTable(); + $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tchaine}|=={une chaine}|oui)ok]'); + $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tchaine,defaut}|=={une chaine}|oui)ok]'); + } + + public function testAutreTableConfigValeurZero(): void + { + $templating = $this->getTemplatingOtherTable(); + $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tzero}|=={0}|oui)ok]'); + $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tzero,defaut}|=={0}|oui)ok]'); + } + + public function testAutreTableConfigChaineZero(): void + { + $templating = $this->getTemplatingOtherTable(); + $this->assertOkTemplate($templating, "[(#CONFIG{/toto/tzeroc}|=={'0'}|oui)ok]"); + $this->assertOkTemplate($templating, "[(#CONFIG{/toto/tzeroc,defaut}|=={'0'}|oui)ok]"); + } + + public function testAutreTableArrayAssoc(): void + { + $templating = $this->getTemplatingOtherTable(); + $this->assertOkTemplate($templating, "[(#CONFIG{/toto/tassoc,'',''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]"); + $this->assertOkTemplate( + $templating, + "[(#CONFIG{/toto/tassoc,defaut,''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]" + ); + } + + public function testAutreTableArraySerialize(): void + { + $templating = $this->getTemplatingOtherTable(); + $this->assertOkTemplate( + $templating, + '[(#CONFIG{/toto/tserie}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' + ); + $this->assertOkTemplate( + $templating, + '[(#CONFIG{/toto/tserie,defaut}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' + ); + } + + private function getFakeMetaData(): array + { + $assoc = [ + 'one' => 'element 1', + 'two' => 'element 2', + ]; + return [ + 'zero' => 0, + 'zeroc' => '0', + 'chaine' => 'une chaine', + 'assoc' => $assoc, + 'serie' => serialize($assoc), + ]; + } + + private function getFakeMetaDataT(): array + { + $assoc = [ + 'one' => 'element 1', + 'two' => 'element 2', + ]; + return [ + 'tzero' => 0, + 'tzeroc' => '0', + 'tchaine' => 'une chaine', + 'tassoc' => $assoc, + 'tserie' => serialize($assoc), + ]; + } + + private function getTemplating(): Templating + { + $fake = var_export($this->getFakeMetaData(), true); + return Templating::fromString([ + 'fonctions' => " + function test_meta(\$raz = 0) { + static \$meta = []; + if (!\$meta) { + \$meta = \$GLOBALS['meta']; + } + \$GLOBALS['meta'] = {$fake}; + if (\$raz) { + \$GLOBALS['meta'] = \$meta; + } + } + ", + 'avant_code' => '[(#VAL|test_meta)]', + 'apres_code' => '[(#VAL{1}|test_meta)]', + ]); + } + + private function getTemplatingOtherTable(): Templating + { + $fake = var_export($this->getFakeMetaDataT(), true); + return Templating::fromString([ + 'fonctions' => " + function test_meta_toto(\$raz = 0) { + \$GLOBALS['toto'] = {$fake}; + if (\$raz) { + unset(\$GLOBALS['toto']); + } + } + ", + 'avant_code' => '[(#VAL|test_meta_toto)]', + 'apres_code' => '[(#VAL{1}|test_meta_toto)]', + ]); + } +} diff --git a/tests/tests/Squelettes/Balise/ConstTest.php b/tests/tests/Squelettes/Balise/ConstTest.php new file mode 100644 index 0000000000..716ec44e49 --- /dev/null +++ b/tests/tests/Squelettes/Balise/ConstTest.php @@ -0,0 +1,28 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; + +class ConstTest extends SquelettesTestCase +{ + public function testBaliseConstVide(): void + { + $this->assertEmptyCode('#CONST'); + $this->assertEmptyCode("#CONST{''}"); + } + + public function testBaliseConstInconnue(): void + { + $this->assertEmptyCode("#CONST{'une_constante_inconnue'}"); + } + + public function testBaliseConstExistante(): void + { + $this->assertEqualsCode(_DIR_CACHE, "#CONST{'_DIR_CACHE'}"); + $this->assertEqualsCode(_DIR_CACHE, '#CONST{_DIR_CACHE}'); + $this->assertEqualsCode(_DIR_CACHE, '#SET{c,_DIR_CACHE}#CONST{#GET{c}}'); + } +} diff --git a/tests/tests/Squelettes/Balise/EvalTest.php b/tests/tests/Squelettes/Balise/EvalTest.php new file mode 100644 index 0000000000..ea62889aba --- /dev/null +++ b/tests/tests/Squelettes/Balise/EvalTest.php @@ -0,0 +1,19 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; + +class EvalTest extends SquelettesTestCase +{ + public function testBaliseEval(): void + { + $this->assertEmptyCode("#EVAL{''}"); + $this->assertOkCode('#EVAL{"\'ok\'"}'); + $this->assertEqualsCode('1', '#EVAL{1}'); + $this->assertEqualsCode(_DIR_CACHE, '#EVAL{_DIR_CACHE}'); + $this->assertEqualsCode('20', '#EVAL{3*5+5}'); + } +} diff --git a/tests/tests/Squelettes/Balise/ExposeTest.php b/tests/tests/Squelettes/Balise/ExposeTest.php new file mode 100644 index 0000000000..8987ffd823 --- /dev/null +++ b/tests/tests/Squelettes/Balise/ExposeTest.php @@ -0,0 +1,59 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; + +class ExposeTest extends SquelettesTestCase +{ + public static function setUpBeforeClass(): void + { + include_spip('base/abstract_sql'); + } + + public function testExposerRubrique(): void + { + $id_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', [ + 'id_parent=' . sql_quote(0), + 'statut=' . sql_quote('publie'), + ]); + + $id_seconde_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', [ + 'id_parent=' . sql_quote(0), + 'statut=' . sql_quote('publie'), + 'id_rubrique != ' . (int) $id_rubrique, + ]); + + if (! $id_rubrique || ! $id_seconde_rubrique) { + $this->markTestSkipped('Vous devez avoir au moins 2 rubriques racines publiees pour tester #EXPOSE...'); + } + + $this->assertOkCode( + "<BOUCLE_racine(RUBRIQUES){racine}> + [(#EXPOSE{ON,''}|oui)ok] + </BOUCLE_racine>", + [ + 'id_rubrique' => $id_rubrique, + ] + ); + + $this->assertOkCode( + "<BOUCLE_racine(RUBRIQUES){racine}{id_rubrique!=#ENV{id_rubrique}}{0,1}> + [(#EXPOSE{ON,''}|non)ok] + </BOUCLE_racine>", + [ + 'id_rubrique' => $id_rubrique, + ] + ); + } + + /** + * @depends testExposerRubrique + */ + public function testExposerRubriqueInclus(): void + { + $this->assertOkSquelette(__DIR__ . '/data/balise_expose.html'); + } +} diff --git a/tests/tests/Squelettes/Balise/InclureStatiqueTest.php b/tests/tests/Squelettes/Balise/InclureStatiqueTest.php new file mode 100644 index 0000000000..a31f269e28 --- /dev/null +++ b/tests/tests/Squelettes/Balise/InclureStatiqueTest.php @@ -0,0 +1,80 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; +use Spip\Core\Testing\Templating; + +class InclureStatiqueTest extends SquelettesTestCase +{ + public function testInclureInlineNormal(): void + { + $dir = $this->relativePath(__DIR__); + $this->assertEqualsCode('Hello World', '#INCLURE{fond=' . $dir . '/data/texte_hello_world}'); + $this->assertEqualsCode('Hello World', '[(#INCLURE{fond=' . $dir . '/data/texte_hello_world})]'); + } + + public function testInclureDouble(): void + { + $dir = $this->relativePath(__DIR__); + $this->assertEqualsCode( + 'Hello WorldHello World', + '#INCLURE{fond=' . $dir . '/data/texte_hello_world}' + . '#INCLURE{fond=' . $dir . '/data/texte_hello_world}' + ); + $this->assertEqualsCode( + 'Hello WorldHello World', + ' + #INCLURE{fond=' . $dir . '/data/texte_hello_world}' + . '#INCLURE{fond=' . $dir . '/data/texte_hello_world}' + ); + } + + public function testInclureArray(): void + { + $dir = $this->relativePath(__DIR__); + $array = '#LISTE{ + ' . $dir . '/data/texte_hello_world, + ' . $dir . '/data/texte_hello_world, + ' . $dir . '/data/texte_hello_world}'; + $this->assertEqualsCode('Hello WorldHello WorldHello World', "#INCLURE{fond={$array}}"); + } + + public function testInclureOldParam(): void + { + $dir = $this->relativePath(__DIR__); + $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test}{test=Kitty})]'); + $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test}{test=Kitty})]'); + } + + public function testInclureNormalParam(): void + { + $dir = $this->relativePath(__DIR__); + $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test, test=Kitty})]'); + $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test, test=Kitty})]'); + } + + public function testInclureArrayParam(): void + { + $dir = $this->relativePath(__DIR__); + $array = '#LISTE{ + ' . $dir . '/data/balise_env_test, + ' . $dir . '/data/texte_hello_world, + ' . $dir . '/data/balise_env_test}'; + $this->assertEqualsCode('KittyHello WorldKitty', "[(#INCLURE{fond={$array}, test=Kitty})]"); + $this->assertEqualsCode('KittyHello WorldKitty', "[(#INCLURE{fond={$array}, test=Kitty})]"); + } + + /** + * Un inclure manquant doit creer une erreur de compilation pour SPIP qui ne doivent pas s'afficher dans le public si + * visiteur + */ + public function testInclureManquantGenereErreurCompilation(): void + { + $templating = Templating::fromString(); + $infos = $templating->rawRender('#CACHE{0}[(#INCLURE{fond=carabistouille/de/montignac/absente}|non)ok]'); + $this->assertCount(1, $infos['erreurs']); + } +} diff --git a/tests/tests/Squelettes/Balise/InclureTest.php b/tests/tests/Squelettes/Balise/InclureTest.php new file mode 100644 index 0000000000..19c5ca4e91 --- /dev/null +++ b/tests/tests/Squelettes/Balise/InclureTest.php @@ -0,0 +1,80 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; +use Spip\Core\Testing\Templating; + +class InclureTest extends SquelettesTestCase +{ + public function testInclureNormal(): void + { + $dir = $this->relativePath(__DIR__); + $this->assertEqualsCode('Hello World', '<INCLURE{fond=' . $dir . '/data/texte_hello_world}>'); + $this->assertEqualsCode('Hello World', '<INCLURE{fond=' . $dir . '/data/texte_hello_world}/>'); + } + + public function testInclureDouble(): void + { + $dir = $this->relativePath(__DIR__); + $this->assertEqualsCode( + 'Hello WorldHello World', + '<INCLURE{fond=' . $dir . '/data/texte_hello_world}>' + . '<INCLURE{fond=' . $dir . '/data/texte_hello_world}>' + ); + $this->assertEqualsCode( + 'Hello WorldHello World', + ' + <INCLURE{fond=' . $dir . '/data/texte_hello_world}>' + . '<INCLURE{fond=' . $dir . '/data/texte_hello_world}>' + ); + } + + public function testInclureArray(): void + { + $dir = $this->relativePath(__DIR__); + $array = '#LISTE{ + ' . $dir . '/data/texte_hello_world, + ' . $dir . '/data/texte_hello_world, + ' . $dir . '/data/texte_hello_world}'; + $this->assertEqualsCode('Hello WorldHello WorldHello World', "<INCLURE{fond={$array}}>"); + } + + public function testInclureOldParam(): void + { + $dir = $this->relativePath(__DIR__); + $this->assertEqualsCode('Kitty', '<INCLURE{fond=' . $dir . '/data/balise_env_test}{test=Kitty}>'); + $this->assertEqualsCode('Kitty', '<INCLURE{fond=' . $dir . '/data/balise_env_test}{test=Kitty}/>'); + } + + public function testInclureNormalParam(): void + { + $dir = $this->relativePath(__DIR__); + $this->assertEqualsCode('Kitty', '<INCLURE{fond=' . $dir . '/data/balise_env_test, test=Kitty}>'); + $this->assertEqualsCode('Kitty', '<INCLURE{fond=' . $dir . '/data/balise_env_test, test=Kitty}/>'); + } + + public function testInclureArrayParam(): void + { + $dir = $this->relativePath(__DIR__); + $array = '#LISTE{ + ' . $dir . '/data/balise_env_test, + ' . $dir . '/data/texte_hello_world, + ' . $dir . '/data/balise_env_test}'; + $this->assertEqualsCode('KittyHello WorldKitty', "<INCLURE{fond={$array}, test=Kitty}>"); + $this->assertEqualsCode('KittyHello WorldKitty', "<INCLURE{fond={$array}, test=Kitty}/>"); + } + + /** + * Un inclure manquant doit creer une erreur de compilation pour SPIP qui ne doivent pas s'afficher dans le public si + * visiteur + */ + public function testInclureManquantGenereErreurCompilation(): void + { + $templating = Templating::fromString(); + $infos = $templating->rawRender('<INCLURE{fond=carabistouille/de/tripoli/absente}/>ok'); + $this->assertCount(1, $infos['erreurs']); + } +} diff --git a/tests/tests/Squelettes/Balise/IntroductionTest.php b/tests/tests/Squelettes/Balise/IntroductionTest.php new file mode 100644 index 0000000000..36c7ef4a1e --- /dev/null +++ b/tests/tests/Squelettes/Balise/IntroductionTest.php @@ -0,0 +1,89 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; +use Spip\Core\Testing\Templating; + +class IntroductionTest extends SquelettesTestCase +{ + protected function getIdArticleLong() : int + { + include_spip('base/abstract_sql'); + $id_article = sql_getfetsel('id_article', + 'spip_articles', + "descriptif='' AND LENGTH(CONCAT(chapo, texte)) > 520 AND texte!='' AND LENGTH(chapo) > 100", + '', + 'id_article', + '0,1' + ); + return intval($id_article); + } + + public function testArticleLongExiste(): void + { + $templating = Templating::fromString(); + $id_article = $this->getIdArticleLong(); + $code = "<BOUCLE_a(ARTICLES){id_article}{tout}>OK</BOUCLE_a>NA<//B_a>"; + $result = $templating->render($code, ['id_article' => $id_article]); + if ($this->isNA($result)) { + $this->markTestSkipped($result); + } + + $this->assertOK($result); + } + + /** + * @depends testArticleLongExiste + */ + public function testCoupeIntroduction(): void + { + $templating = Templating::fromString(); + $id_article = $this->getIdArticleLong(); + $code = "<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION</BOUCLE_a>"; + $result = $templating->render($code, ['id_article' => $id_article]); + $suite = ' (...)'; + $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); + } + + /** + * @depends testArticleLongExiste + */ + public function testCoupeIntroductionSuite(): void + { + $templating = Templating::fromString(); + $id_article = $this->getIdArticleLong(); + $code = "<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION{…}</BOUCLE_a>"; + $result = $templating->render($code, ['id_article' => $id_article]); + $suite = '…'; + $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); + + $code = "<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION{#ENV{suite}}</BOUCLE_a>"; + $result = $templating->render($code, [ + 'id_article' => $id_article, + 'suite' => $suite, + ]); + $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); + } + + /** + * @depends testCoupeIntroduction + */ + public function testCoupeIntroductionConstante(): void + { + $id_article = $this->getIdArticleLong(); + $templating = Templating::fromString([ + 'fonctions' => " + if (!defined('_INTRODUCTION_SUITE')) { + define('_INTRODUCTION_SUITE', '!!!'); + } + ", + ]); + $code = "#CACHE{0}<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION</BOUCLE_a>"; + $result = $templating->render($code, ['id_article' => $id_article]); + $suite = _INTRODUCTION_SUITE; + $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); + } +} diff --git a/tests/tests/Squelettes/Balise/LesauteursTest.php b/tests/tests/Squelettes/Balise/LesauteursTest.php new file mode 100644 index 0000000000..0f470a255e --- /dev/null +++ b/tests/tests/Squelettes/Balise/LesauteursTest.php @@ -0,0 +1,28 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; +use Spip\Core\Testing\Templating; + +class LesauteursTest extends SquelettesTestCase +{ + public function testLesAuteursRenvoieQqc(): void + { + $templating = Templating::fromString(); + $result = $templating->render( + "<BOUCLE_a(ARTICLES){id_auteur>0}{0,1}> + [(#LESAUTEURS|?{OK,'LESAUTEURS a echoue'})] + </BOUCLE_a> + NA Ce test ne fonctionne que s'il existe un article ayant un auteur ! + <//B_a>" + ); + if ($this->isNa($result)) { + $this->markTestSkipped($result); + } + + $this->assertOk($result); + } +} diff --git a/tests/tests/Squelettes/Balise/MimeTypeTest.php b/tests/tests/Squelettes/Balise/MimeTypeTest.php new file mode 100644 index 0000000000..e08185f2c9 --- /dev/null +++ b/tests/tests/Squelettes/Balise/MimeTypeTest.php @@ -0,0 +1,31 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; +use Spip\Core\Testing\Templating; + +/** + * FIXME: Déplacer dans le plugin Medias + */ +class MimeTypeTest extends SquelettesTestCase +{ + public function testMimeTypeDocumentJpg() + { + $templating = Templating::fromString(); + $result = $templating->render( + "<BOUCLE_d(DOCUMENTS){extension IN jpg}{0,1}> + [(#MIME_TYPE|match{^image/jpeg$}|?{OK, erreur mime_type : #MIME_TYPE})] + </BOUCLE_d> + NA Ce test ne fonctionne que s'il y a au moins un document jpg dans le site ! + <//B_d>" + ); + if ($this->isNa($result)) { + $this->markTestSkipped($result); + } + + $this->assertOkCode($result); + } +} diff --git a/tests/tests/Squelettes/Balise/NotesTest.php b/tests/tests/Squelettes/Balise/NotesTest.php new file mode 100644 index 0000000000..21a469c5a5 --- /dev/null +++ b/tests/tests/Squelettes/Balise/NotesTest.php @@ -0,0 +1,57 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; + +class NotesTest extends SquelettesTestCase +{ + + protected function setUp(): void + { + $this->viderNotes(); + } + + + public function testNotesEnVrac(): void + { + $this->assertOkSquelette(__DIR__ . '/data/notes.html'); + } + + /** + * Ce bloc est en premier, et contient des notes separees par un MODELE; il ne doit pas "sauter" de compteur_notes + * (nb2-2) + */ + public function testNoteNonSupprimeeSiBaliseModele(): void + { + $this->assertOkCode( + "[(#VAL{\[\[note1\]\]<img1>\[\[note2\]\]'} + |propre + |match{'nb.-1'} + |?{#VAL{'Le compteur_notes a change a cause du modele. Résultat: '#NOTES}, OK})]" + ); + } + + /** + * Ce bloc teste le bug introduit en http://trac.rezo.net/trac/spip/changeset/8847 et corrige en + * http://trac.rezo.net/trac/spip/changeset/8872 + */ + public function testNoteNonSupprimeeSiInclureInline(): void + { + $dir = $this->relativePath(__DIR__); + $this->assertOkCode(" + [(#VAL{'\[\[Ma note\]\]'}|propre|?)] + [(#INCLURE{fond={$dir}/data/inclure_vide})] + [(#NOTES|match{Ma note}|?{'OK','Une note mangee par INCLURE'})] + "); + } + + private function viderNotes(): void + { + // attention a cette globale qui pourrait changer dans le temps + $notes = charger_fonction('notes', 'inc'); + $notes('', 'reset_all'); + } +} diff --git a/tests/tests/Squelettes/Balise/SelfTest.php b/tests/tests/Squelettes/Balise/SelfTest.php new file mode 100644 index 0000000000..258597a4ba --- /dev/null +++ b/tests/tests/Squelettes/Balise/SelfTest.php @@ -0,0 +1,16 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; + +class SelfTest extends SquelettesTestCase +{ + public function testBaliseSelf(): void + { + $this->assertEqualsCode('./', '#SELF'); + $this->markTestIncomplete('More tests needed, but requires SPIP evolution with RequestInterface or so'); + } +} diff --git a/tests/tests/Squelettes/Balise/SessionTest.php b/tests/tests/Squelettes/Balise/SessionTest.php new file mode 100644 index 0000000000..1c808982c3 --- /dev/null +++ b/tests/tests/Squelettes/Balise/SessionTest.php @@ -0,0 +1,39 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; + +class SessionTest extends SquelettesTestCase +{ + public static function setUpBeforeClass(): void + { + include_spip('inc/session'); + spip_tests_loger_webmestre(); + } + + public static function tearDownAfterClass(): void + { + spip_tests_deloger_webmestre(); + } + + public function testVisiteurSession(): void + { + $id_auteur = session_get('id_auteur'); + $this->assertEqualsCode("$id_auteur", '[(#SESSION{id_auteur})]'); + } + + public function testSessionSet(): void + { + session_set('bonbon', null); + $this->assertEqualsCode('1----', '1--#HTTP_HEADER{Content-type: text/html}[(#SESSION{bonbon})]--'); + $this->assertEqualsCode('2----', '2--#HTTP_HEADER{Content-type: text/html}[(#SESSION_SET{bonbon,caramel})]--'); + $this->assertEqualsCode('3--caramel--', '3--#HTTP_HEADER{Content-type: text/html}[(#SESSION{bonbon})]--'); + $this->assertEqualsCode('4----', '4--#HTTP_HEADER{Content-type: text/html}[(#SESSION_SET{bonbon,miel})]--'); + $this->assertEqualsCode('5--miel--', '5--#HTTP_HEADER{Content-type: text/html}[(#SESSION{bonbon})]--'); + $this->assertEqualsCode('6----', '6--#HTTP_HEADER{Content-type: text/html}[(#SESSION_SET{bonbon,#NULL})]--'); + $this->assertEqualsCode('7----', '7--#HTTP_HEADER{Content-type: text/html}[(#SESSION{bonbon})]--'); + } +} diff --git a/tests/tests/Squelettes/Balise/ValTest.php b/tests/tests/Squelettes/Balise/ValTest.php new file mode 100644 index 0000000000..2259263642 --- /dev/null +++ b/tests/tests/Squelettes/Balise/ValTest.php @@ -0,0 +1,19 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Balise; + +use Spip\Core\Testing\SquelettesTestCase; + +class ValTest extends SquelettesTestCase +{ + public function testBaliseVal(): void + { + $this->assertEmptyCode('#VAL'); + $this->assertEmptyCode('#VAL{}'); + $this->assertEmptyCode("#VAL{''}"); + $this->assertOkCode('#VAL{ok}'); + $this->assertEqualsCode('1', '#VAL{1}'); + } +} diff --git a/tests/tests/Squelettes/Balise/data/balise_detachee.html b/tests/tests/Squelettes/Balise/data/balise_detachee.html new file mode 100644 index 0000000000..a0ed41f102 --- /dev/null +++ b/tests/tests/Squelettes/Balise/data/balise_detachee.html @@ -0,0 +1,33 @@ +[(#REM) + + Teste la balise #_boucle:ID_ARTICLE + +] + +#CACHE{0} +<BOUCLE_a(ARTICLES){0,1}{doublons}> +#SET{ida,#ID_ARTICLE} +</BOUCLE_a> + +<BOUCLE_b(ARTICLES){0,1}{doublons}> +#SET{idb,#ID_ARTICLE} + + <BOUCLE_c(ARTICLES){0,1}{doublons}> + #SET{idc,#ID_ARTICLE} + #SET{idac,#_a:ID_ARTICLE} [(#REM) ici #_a:ID_ARTICLE n'est pas cense etre defini ] + #SET{idbc,#_b:ID_ARTICLE} + </BOUCLE_c> + NA Il faut au moins 3 articles publiés ! + <//B_c> + +</BOUCLE_b> +NA Il faut au moins 3 articles publiés ! +<//B_b> + +[(#GET{ida}|=={#GET{idac}}|?{ + bug 1, + [(#GET{idb}|=={#GET{idbc}}|?{ + OK, + bug 2 + })] +})] diff --git a/tests/tests/Squelettes/Balise/data/balise_env_test.html b/tests/tests/Squelettes/Balise/data/balise_env_test.html new file mode 100644 index 0000000000..379056bace --- /dev/null +++ b/tests/tests/Squelettes/Balise/data/balise_env_test.html @@ -0,0 +1 @@ +#ENV{test} diff --git a/tests/tests/Squelettes/Balise/data/balise_expose.html b/tests/tests/Squelettes/Balise/data/balise_expose.html new file mode 100644 index 0000000000..6f78bf480a --- /dev/null +++ b/tests/tests/Squelettes/Balise/data/balise_expose.html @@ -0,0 +1,16 @@ +<BOUCLE_select(RUBRIQUES){0,1}> + +<BOUCLE_rubrique2(RUBRIQUES){id_rubrique}> +#SET{expose,#INCLURE{fond=#DOSSIER_SQUELETTE/balise_expose_dans_inclusion, id_rubrique}|trim} +</BOUCLE_rubrique2> + +<BOUCLE_rubrique3(RUBRIQUES){id_rubrique!=#ID_RUBRIQUE}{id_secteur!=#ID_SECTEUR}{0,1}> +#SET{expose,#GET{expose}|concat{#INCLURE{fond=#DOSSIER_SQUELETTE/balise_expose_dans_inclusion, id_rubrique}|trim} } +</BOUCLE_rubrique3> +NA Ce test exige l'existence d'au moins deux rubriques publiees (non parentes) +<//B_rubrique3> + +[(#GET{expose}|=={ONOFF}|?{OK,ERREUR:#GET{expose}})] +</BOUCLE_select> +NA il faut une rubrique +<//B_select> diff --git a/tests/tests/Squelettes/Balise/data/balise_expose_dans_inclusion.html b/tests/tests/Squelettes/Balise/data/balise_expose_dans_inclusion.html new file mode 100644 index 0000000000..8a561e891c --- /dev/null +++ b/tests/tests/Squelettes/Balise/data/balise_expose_dans_inclusion.html @@ -0,0 +1,3 @@ +<BOUCLE_balise_expose_inclue(RUBRIQUES){0,1}> +#EXPOSE{ON,OFF} +</BOUCLE_balise_expose_inclue> diff --git a/tests/tests/Squelettes/Balise/data/inclure_vide.html b/tests/tests/Squelettes/Balise/data/inclure_vide.html new file mode 100644 index 0000000000..b28b04f643 --- /dev/null +++ b/tests/tests/Squelettes/Balise/data/inclure_vide.html @@ -0,0 +1,3 @@ + + + diff --git a/tests/tests/Squelettes/Balise/data/note_inclue_affichee.html b/tests/tests/Squelettes/Balise/data/note_inclue_affichee.html new file mode 100644 index 0000000000..589c6dc44b --- /dev/null +++ b/tests/tests/Squelettes/Balise/data/note_inclue_affichee.html @@ -0,0 +1,2 @@ +#SET{test1,#VAL{'a\[\[b\]\]'}|propre} +#NOTES diff --git a/tests/tests/Squelettes/Balise/data/note_inclue_nonaffichee.html b/tests/tests/Squelettes/Balise/data/note_inclue_nonaffichee.html new file mode 100644 index 0000000000..793df939d7 --- /dev/null +++ b/tests/tests/Squelettes/Balise/data/note_inclue_nonaffichee.html @@ -0,0 +1,2 @@ +#SET{test1,#VAL{'a\[\[b\]\]'}|propre} +RAS diff --git a/tests/tests/Squelettes/Balise/data/notes.html b/tests/tests/Squelettes/Balise/data/notes.html new file mode 100644 index 0000000000..af3d781993 --- /dev/null +++ b/tests/tests/Squelettes/Balise/data/notes.html @@ -0,0 +1,78 @@ +[(#REM) + + tester # NOTES et ses particularismes + + + Il manque le test sur un < INCLURE > a cache plus court qui est calcule alors que l'appelant ne l'est pas + cas qui foire jusqu'a ce jour (7/02/2010) car lorsque seul l'incure dynamique est calcule, le marqueur de note + est a zero. + Solution possible a creuser : appeler en fin de calcul un filtre qui genere le php (en debut de skel) + qui restaure l'etat de la pile des notes : ainsi lors de l'evaluation dynamique, les notes sont synchro + +] +#SET{err,''} + +[(#REM) une note simple ] +[(#SET{appelnote,#VAL{<p>a<span class="spip_note_ref"> \[<a href="#nb1" class="spip_note" rel="appendix" title="b" id="nh1">1</a>\]</span></p>}})] +[(#SET{lanote,#VAL{<div id="nb1"> +<p><span class="spip_note_ref">\[<a href="#nh1" class="spip_note" title="<:info_notes:> 1" rev="appendix">1</a>\] </span>b</p> +</div>}})] +#SET{test1,#VAL{'a\[\[b\]\]'}|propre} +[(#GET{test1}|=={#GET{appelnote}}|?{'',#SET{err,'erreur appel note simple'}})] +#SET{notes,#NOTES} +[(#GET{notes}|=={#GET{lanote}}|?{'',#SET{err,#VAL{'erreur note simple :'}|concat{#GET{notes},' vs ',#GET{lanote}}}})] + + +[(#REM) une deuxieme note simple qui doit etre numerotee differement de la premiere deja affichee] +#SET{test2,#VAL{'a\[\[b\]\]'}|propre} +#SET{notes2,#NOTES} +[(#GET{test1}|=={#GET{test2}}|?{#SET{err,'Le compteur de note n'a pas ete incremente au meme niveau'}})] + +[(#REM) une note simple affichee dans une inclusion qui doit etre numerotee differement des deux premieres] +#SET{notes3,#INCLURE{fond=#DOSSIER_SQUELETTE/note_inclue_affichee}} +[(#GET{notes3}|=={#GET{notes}}|?{#SET{err,'Le compteur de note n'a pas ete incremente dans l'inclusion'}})] +[(#GET{notes3}|=={#GET{notes2}}|?{#SET{err,'Le compteur de note n'a pas ete incremente dans l'inclusion2'}})] + +[(#REM) verifier que la note simple apres inclusion est bien numerotee encore differemment] +#SET{test4,#VAL{'a\[\[b\]\]'}|propre} +#SET{notes4,#NOTES} +[(#GET{notes4}|=={#GET{notes}}|?{#SET{err,'Le compteur de note n'a pas ete incremente apres l'inclusion'}})] +[(#GET{notes4}|=={#GET{notes2}}|?{#SET{err,'Le compteur de note n'a pas ete incremente apres l'inclusion2'}})] +[(#GET{notes4}|=={#GET{notes3}}|?{#SET{err,'Le compteur de note n'a pas ete incremente apres l'inclusion3'}})] + +[(#REM) une note simple ajoutee dans une inclusion mais non affichee qui doit etre purgee avant retour ici ] +[(#INCLURE{fond=#DOSSIER_SQUELETTE/note_inclue_nonaffichee}|vide)] +#SET{notes5,#NOTES} +[(#GET{notes5}|oui)#SET{err,'La note inclue n'a pas ete purgee'}] + + +[(#REM) une note appelee explicitement ] +[(#VAL{'a\[\[<b>c\]\]'}|propre|?)] +[(#NOTES|supprimer_tags|match{^.b. \s*c$}|?{'',#SET{err,'erreur note <b>'}})] + +[(#REM) une note appelee explicitement <a>] +[(#VAL{'eh\[\[<a>oh\]\]'}|propre|?)] +[(#NOTES|PtoBR|match{.<a.*>a</a>. </span>\s*oh$}|?{'',#SET{err,'erreur note <a>'}})] + +[(#REM) une note appelee explicitement <a> avec un lien dedans] +[(#VAL{'ki\[\[<a><a href="#test">uh</a>\]\]'}|propre|?)] +[(#NOTES|PtoBR|match{.<a.*>a</a>. }|?{'',#SET{err,'erreur note <a> avec lien'}})] + +[(#REM) une note appelee explicitement vide ] +[(#VAL{'a\[\[<>d\]\]'}|propre|?)] +[(#NOTES|supprimer_tags|match{^d$}|?{'',#SET{err,'erreur note <d>'}})] + +[(#REM) une note appelee explicitement avec une espace au debut ] +[(#VAL{'a\[\[ <e>f\]\]'}|propre|?)] +[(#NOTES|supprimer_tags|match{^.e. \s*f$}|?{'',#SET{err,'erreur note <e>'}})] + +[(#REM) une note appelee avec une construction html equilibree ] +[(#VAL{'g\[\[ <b>h</b>\]\]'}|propre|?)] +[(#NOTES|supprimer_tags|match{^.1. \s*h$}|?{'',#SET{err,'erreur note <g>'}})] + +[(#REM) une note appelee avec un caractere sensible ] +[(#VAL{'j\[\[ <*>k\]\]'}|propre|?)] +[(#NOTES|PtoBR|match{.<a.*>\*</a>. </span>k$}|?{'',#SET{err,'erreur note <j>'}})] + + +[(#GET{err}|sinon{OK})] diff --git a/tests/tests/Squelettes/Balise/data/texte_hello_world.html b/tests/tests/Squelettes/Balise/data/texte_hello_world.html new file mode 100644 index 0000000000..557db03de9 --- /dev/null +++ b/tests/tests/Squelettes/Balise/data/texte_hello_world.html @@ -0,0 +1 @@ +Hello World diff --git a/tests/tests/Squelettes/Boucle/BoucleGeneriqueTest.php b/tests/tests/Squelettes/Boucle/BoucleGeneriqueTest.php new file mode 100644 index 0000000000..d435b059fe --- /dev/null +++ b/tests/tests/Squelettes/Boucle/BoucleGeneriqueTest.php @@ -0,0 +1,55 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Boucle; + +use Spip\Core\Testing\SquelettesTestCase; + +class BoucleGeneriqueTest extends SquelettesTestCase +{ + public function testBoucleMetaSimple(): void + { + $this->assertNotEmptyCode('<BOUCLE_meta(spip_meta)>#NOM</BOUCLE_meta>'); + $this->assertOkCode('ok<BOUCLE_meta(spip_meta)> </BOUCLE_meta>'); + $this->assertOkCode('<BOUCLE_meta(spip_meta)> </BOUCLE_meta>ok'); + } + + public function testBoucleMetaSimpleRaccourcisFinBoucle(): void + { + $this->assertOkCode('<BOUCLE_meta(spip_meta) />ok'); + } + + public function testBoucleMetaSimpleAvantApres(): void + { + $this->assertOkCode('<B_meta>ok<BOUCLE_meta(spip_meta)> </BOUCLE_meta>'); + $this->assertOkCode('<BOUCLE_meta(spip_meta)> </BOUCLE_meta>ok</B_meta>'); + } + + public function testBoucleMetaSimpleSinon(): void + { + $this->assertNotOkCode('<BOUCLE_meta(spip_meta)> </BOUCLE_meta>ok<//B_meta>'); + $this->assertOkCode('<BOUCLE_meta(spip_meta)> </BOUCLE_meta>ok</B_meta>non<//B_meta>'); + + $this->assertOkCode('<BOUCLE_meta(spip_meta)></BOUCLE_meta>ok<//B_meta>'); + $this->assertOkCode('<BOUCLE_meta(spip_meta)></BOUCLE_meta>non</B_meta>ok<//B_meta>'); + + $this->assertOkCode('<BOUCLE_meta(spip_meta) />ok<//B_meta>'); + $this->assertOkCode('<BOUCLE_meta(spip_meta) />non</B_meta>ok<//B_meta>'); + } + + public function testBoucleMetaSimpleCritere(): void + { + $this->assertEqualsCode($GLOBALS['meta']['nom_site'], '<BOUCLE_meta(spip_meta){nom=nom_site}>#VALEUR</BOUCLE_meta>'); + $this->assertEmptyCode('<BOUCLE_meta(spip_meta){nom=gristinapolitainsic}>#VALEUR</BOUCLE_meta>'); + $this->assertOkCode('<BOUCLE_meta(spip_meta){nom=gristinapolitainsic}>#VALEUR</BOUCLE_meta>ok<//B_meta>'); + } + + /** + * @link http://trac.rezo.net/trac/spip/ticket/1931 + */ + public function testBoucleVide(): void + { + $this->assertOkSquelette(__DIR__ . '/data/boucle_vide.html'); + } +} diff --git a/tests/tests/Squelettes/Boucle/BoucleRecursiveTest.php b/tests/tests/Squelettes/Boucle/BoucleRecursiveTest.php new file mode 100644 index 0000000000..5e84d21f63 --- /dev/null +++ b/tests/tests/Squelettes/Boucle/BoucleRecursiveTest.php @@ -0,0 +1,18 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Boucle; + +use Spip\Core\Testing\SquelettesTestCase; + +class BoucleRecursiveTest extends SquelettesTestCase +{ + /** + * @link http://trac.rezo.net/trac/spip/ticket/764 + */ + public function testBoucleRecursiveSet(): void + { + $this->assertOkSquelette(__DIR__ . '/data/bug764.html'); + } +} diff --git a/tests/tests/Squelettes/Boucle/HierarchieTest.php b/tests/tests/Squelettes/Boucle/HierarchieTest.php new file mode 100644 index 0000000000..0d9b45c058 --- /dev/null +++ b/tests/tests/Squelettes/Boucle/HierarchieTest.php @@ -0,0 +1,40 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Boucle; + +use Spip\Core\Testing\SquelettesTestCase; + +class HierarchieTest extends SquelettesTestCase +{ + public function testBoucleHierarchie() + { + $this->assertOkCode(" + <BOUCLE_a(RUBRIQUES){0,50}> + <BOUCLE_secteur(HIERARCHIE){0,1}>[(#ID_RUBRIQUE|=={#_a:ID_SECTEUR}|?{'', + erreur secteur: attendu #_a:ID_SECTEUR ; resultat #ID_RUBRIQUE<br />})] + </BOUCLE_secteur> + <BOUCLE_parent(HIERARCHIE){n-1,1}>[(#ID_RUBRIQUE|=={#_a:ID_PARENT}|?{'', + erreur parent: attendu #_a:ID_PARENT ; resultat #ID_RUBRIQUE<br />})] + </BOUCLE_parent> + </BOUCLE_a> + OK + "); + } + + public function testBoucleHierarchieTout() + { + $this->assertOkCode(" + <BOUCLE_a(RUBRIQUES){tout}{0,50}> + <BOUCLE_secteur(HIERARCHIE){statut==.*}{0,1}>[(#ID_RUBRIQUE|=={#_a:ID_SECTEUR}|?{'', + erreur secteur: attendu #_a:ID_SECTEUR ; resultat #ID_RUBRIQUE<br />})] + </BOUCLE_secteur> + <BOUCLE_parent(HIERARCHIE){statut==.*}{n-1,1}>[(#ID_RUBRIQUE|=={#_a:ID_PARENT}|?{'', + erreur parent: attendu #_a:ID_PARENT ; resultat #ID_RUBRIQUE<br />})] + </BOUCLE_parent> + </BOUCLE_a> + OK + "); + } +} diff --git a/tests/tests/Squelettes/Boucle/data/boucle_vide.html b/tests/tests/Squelettes/Boucle/data/boucle_vide.html new file mode 100644 index 0000000000..fa877fde6f --- /dev/null +++ b/tests/tests/Squelettes/Boucle/data/boucle_vide.html @@ -0,0 +1,6 @@ +[(#REM) + http://trac.rezo.net/trac/spip/ticket/1931 +]<BOUCLE_a(ARTICLES){1,n}> </BOUCLE_a> +OK</B_a> +OK<//B_a> +#FILTRE{trim} diff --git a/tests/tests/Squelettes/Boucle/data/bug764.html b/tests/tests/Squelettes/Boucle/data/bug764.html new file mode 100644 index 0000000000..36ca7abfd0 --- /dev/null +++ b/tests/tests/Squelettes/Boucle/data/bug764.html @@ -0,0 +1,18 @@ +[(#REM) + + \#SET et boucle recursive + https://git.spip.net/spip/spip/issues/764 + +] + +OK [(#REM) en cas d'echec, le compilo plante ] + +#CACHE{0} +<BOUCLE_secteurs(RUBRIQUES) {0,1}> + <B_Rubriques> + #SET{'niveau','0'} + <BOUCLE_Rubriques(RUBRIQUES) {id_parent} {par titre}> + <BOUCLE_Sous_Rubriques(BOUCLE_Rubriques)></BOUCLE_Sous_Rubriques> + </BOUCLE_Rubriques> + </B_Rubriques> +</BOUCLE_secteurs> diff --git a/tests/tests/Squelettes/Critere/DoublonsTest.php b/tests/tests/Squelettes/Critere/DoublonsTest.php new file mode 100644 index 0000000000..57e332e57c --- /dev/null +++ b/tests/tests/Squelettes/Critere/DoublonsTest.php @@ -0,0 +1,72 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Critere; + +use Spip\Core\Testing\SquelettesTestCase; +use Spip\Core\Testing\Templating; + +class DoublonsTest extends SquelettesTestCase +{ + public function testCritereDoublons(): void + { + $this->assertOkCode( + ' + <BOUCLE_a(ARTICLES){statut=.*}{doublons}></BOUCLE_a> + <BOUCLE_b(ARTICLES){statut=.*}{tout}{doublons}{0,1}>Erreur doublons articles</BOUCLE_b> + ok<//B_b> + ' + ); + $this->assertOkCode( + ' + <BOUCLE_a(ARTICLES){doublons}></BOUCLE_a> + <BOUCLE_b(ARTICLES){doublons}{0,1}>Erreur doublons articles</BOUCLE_b> + ok<//B_b> + ' + ); + } + + public function testCritereDoublonsMultiplesBoucles(): void + { + $this->assertOkSquelette(__DIR__ . '/data/doublons.html'); + } + + public function testDoublonsAuteurs(): void + { + $templating = Templating::fromString(); + $n = $templating->render('<BOUCLE_a(AUTEURS)>#COMPTEUR_BOUCLE</BOUCLE_a>'); + + if ($n <= 1) { + $this->markTestSkipped('Il faut au moins 2 auteurs ayant publie sur le site !'); + } + + $this->assertOkCode(' + <BOUCLE_a(AUTEURS){doublons}></BOUCLE_a> + <BOUCLE_b(AUTEURS){doublons}{0,1}>Erreur doublons Auteurs</BOUCLE_b>OK<//B_b> + '); + } + + /** + * @depends testDoublonsAuteurs + */ + public function testDoublonsNommesAuteurs(): void + { + $this->assertOkCode(' + <BOUCLE_a(AUTEURS){doublons polisson}></BOUCLE_a> + <BOUCLE_b(AUTEURS){doublons polisson}{0,1}>Erreur doublons Auteurs</BOUCLE_b>OK<//B_b> + '); + $this->assertOkCode(' + <BOUCLE_a(AUTEURS){1/2}{doublons kakis}></BOUCLE_a> + <BOUCLE_b(AUTEURS){2/2}{doublons kokos}></BOUCLE_b> + <BOUCLE_c(AUTEURS){doublons kakis}{0,1}>ok</BOUCLE_c>Erreur doubles doublons Auteurs<//B_c> + '); + $this->assertOkCode(' + <BOUCLE_a(AUTEURS){1/2}{doublons kakis}></BOUCLE_a> + <BOUCLE_b(AUTEURS){2/2}{doublons kokos}></BOUCLE_b> + <BOUCLE_c(AUTEURS){doublons kakis}{0,1}> </BOUCLE_c>Erreur doubles doublons Auteurs<//B_c> + <BOUCLE_d(AUTEURS){doublons kokos}{0,1}> </BOUCLE_d>Erreur doubles doublons Auteurs<//B_d> + <BOUCLE_e(AUTEURS){doublons kakis}{doublons kokos}{0,1}>Erreur doubles doublons Auteurs</BOUCLE_e>OK<//B_e> + '); + } +} diff --git a/tests/tests/Squelettes/Critere/data/doublons.html b/tests/tests/Squelettes/Critere/data/doublons.html new file mode 100644 index 0000000000..87edf41d1d --- /dev/null +++ b/tests/tests/Squelettes/Critere/data/doublons.html @@ -0,0 +1,22 @@ + +<BOUCLE_a(ARTICLES){doublons}></BOUCLE_a> +<BOUCLE_b(ARTICLES){doublons}{0,1}>erreur doublons articles</BOUCLE_b> + +<BOUCLE_a2(RUBRIQUES){doublons}></BOUCLE_a2> +<BOUCLE_b2(RUBRIQUES){doublons}{0,1}>erreur doublons rubriques</BOUCLE_b2> + +<BOUCLE_a3(DOCUMENTS){doublons}{id_document<100}></BOUCLE_a3> +<BOUCLE_b3(DOCUMENTS){doublons}{id_document<100}{0,1}>erreur doublons documents</BOUCLE_b3> + +<BOUCLE_a4(FORUMS){doublons}{id_forum<100}></BOUCLE_a4> +<BOUCLE_b4(FORUMS){doublons}{id_forum<100}{0,1}>erreur doublons forums</BOUCLE_b4> + + OK + +<//B_b4> + +<//B_b3> + +<//B_b2> + +<//B_b> diff --git a/tests/tests/Squelettes/Filtre/IntroductionTest.php b/tests/tests/Squelettes/Filtre/IntroductionTest.php new file mode 100644 index 0000000000..f68134e078 --- /dev/null +++ b/tests/tests/Squelettes/Filtre/IntroductionTest.php @@ -0,0 +1,79 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Filtre; + +use Spip\Core\Testing\SquelettesTestCase; + +class IntroductionTest extends SquelettesTestCase +{ + public static function setUpBeforeClass(): void + { + include_spip('inc/filtres'); + include_spip('public/composer'); + } + + public function testPresenceFiltre(): void + { + $introduction = $this->getFilterIntroduction(); + if ($introduction !== 'filtre_introduction_dist') { + $this->markTestIncomplete(sprintf("Careful: filter %s is not 'filtre_introduction_dist'", $introduction)); + } + + $this->assertEquals('<p>ok</p>', propre('ok')); + $this->assertEquals('<p>ok</p>', $introduction('ok', '', 100, '')); + } + + /** + * la description seule ressort avec propre() sans passer par couper() or couper() enleve les balises <p> et consoeur, + * il faut en tenir compte dans la coupe du texte, meme si le texte est plus petit + */ + public function testDescriptifRetourneSiPresent(): void + { + $introduction = $this->getFilterIntroduction(); + $this->assertEquals( + propre('description petite'), + $introduction('description petite', 'description plus longue', 100, '') + ); + } + + /** + * couper en plus... + */ + public function testTexteNonCoupeSiPetit(): void + { + $introduction = $this->getFilterIntroduction(); + $this->assertEquals( + paragrapher(couper(propre('description plus longue'), 100), true), + $introduction('', 'description plus longue', 100, '') + ); + } + + public function testTexteCoupe(): void + { + $introduction = $this->getFilterIntroduction(); + $this->assertEquals( + paragrapher(couper(propre('description plus longue'), 10), true), + $introduction('', 'description plus longue', 10, '') + ); + $this->assertNotEquals( + paragrapher(couper(propre('description plus longue'), 20), true), + $introduction('', 'description plus longue', 10, '') + ); + } + + public function testTexteAvecBaliseIntro(): void + { + $introduction = $this->getFilterIntroduction(); + $this->assertEquals( + paragrapher(couper(propre('plus'), 100), true), + $introduction('', 'description <intro>plus</intro> longue', 100, '') + ); + } + + private function getFilterIntroduction(): string + { + return chercher_filtre('introduction'); + } +} diff --git a/tests/tests/Squelettes/Filtre/LogiquesTest.php b/tests/tests/Squelettes/Filtre/LogiquesTest.php new file mode 100644 index 0000000000..536841d466 --- /dev/null +++ b/tests/tests/Squelettes/Filtre/LogiquesTest.php @@ -0,0 +1,86 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Squelettes\Filtre; + +use Spip\Core\Testing\SquelettesTestCase; + +class LogiquesTest extends SquelettesTestCase +{ + public function testOui(): void + { + $this->assertNotOkCode('[(#VAL|oui)ok]'); + $this->assertOkCode('[(#VAL{1}|oui)ok]'); + $this->assertOkCode("[(#VAL{' '}|oui)ok]"); + } + + public function testYes(): void + { + $this->assertNotOkCode('[(#VAL|yes)ok]'); + $this->assertOkCode('[(#VAL{1}|yes)ok]'); + $this->assertOkCode("[(#VAL{' '}|yes)ok]"); + } + + public function testNon(): void + { + $this->assertOkCode('[(#VAL|non)ok]'); + $this->assertNotOkCode('[(#VAL{1}|non)ok]'); + $this->assertNotOkCode("[(#VAL{' '}|non)ok]"); + } + + public function testNot(): void + { + $this->assertOkCode('[(#VAL|not)ok]'); + $this->assertNotOkCode('[(#VAL{1}|not)ok]'); + $this->assertNotOkCode("[(#VAL{' '}|not)ok]"); + } + + public function testEt(): void + { + $this->assertOkCode('[(#VAL{1}|et{#VAL{1}})ok]'); + $this->assertOkCode('[(#VAL{0}|et{#VAL{0}}|non)ok]'); + $this->assertOkCode('[(#VAL{1}|et{#VAL{0}}|non)ok]'); + $this->assertOkCode('[(#VAL{0}|et{#VAL{1}}|non)ok]'); + } + + public function testAnd(): void + { + $this->assertOkCode('[(#VAL{1}|and{#VAL{1}})ok]'); + $this->assertOkCode('[(#VAL{0}|and{#VAL{0}}|non)ok]'); + $this->assertOkCode('[(#VAL{1}|and{#VAL{0}}|non)ok]'); + $this->assertOkCode('[(#VAL{0}|and{#VAL{1}}|non)ok]'); + } + + public function testOu(): void + { + $this->assertOkCode('[(#VAL{1}|ou{#VAL{1}})ok]'); + $this->assertOkCode('[(#VAL{0}|ou{#VAL{0}}|non)ok]'); + $this->assertOkCode('[(#VAL{1}|ou{#VAL{0}})ok]'); + $this->assertOkCode('[(#VAL{0}|ou{#VAL{1}})ok]'); + } + + public function testOr(): void + { + $this->assertOkCode('[(#VAL{1}|or{#VAL{1}})ok]'); + $this->assertOkCode('[(#VAL{0}|or{#VAL{0}}|non)ok]'); + $this->assertOkCode('[(#VAL{1}|or{#VAL{0}})ok]'); + $this->assertOkCode('[(#VAL{0}|or{#VAL{1}})ok]'); + } + + public function testXou(): void + { + $this->assertOkCode('[(#VAL{1}|xou{#VAL{1}}|non)ok]'); + $this->assertOkCode('[(#VAL{0}|xou{#VAL{0}}|non)ok]'); + $this->assertOkCode('[(#VAL{1}|xou{#VAL{0}})ok]'); + $this->assertOkCode('[(#VAL{0}|xou{#VAL{1}})ok]'); + } + + public function testXor(): void + { + $this->assertOkCode('[(#VAL{1}|xor{#VAL{1}}|non)ok]'); + $this->assertOkCode('[(#VAL{0}|xor{#VAL{0}}|non)ok]'); + $this->assertOkCode('[(#VAL{1}|xor{#VAL{0}})ok]'); + $this->assertOkCode('[(#VAL{0}|xor{#VAL{1}})ok]'); + } +} diff --git a/tests/tests/Testing/SquelettesTestCaseTest.php b/tests/tests/Testing/SquelettesTestCaseTest.php new file mode 100644 index 0000000000..4bba7c6ee5 --- /dev/null +++ b/tests/tests/Testing/SquelettesTestCaseTest.php @@ -0,0 +1,59 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Testing; + +use PHPUnit\Framework\AssertionFailedError; +use Spip\Core\Testing\SquelettesTestCase; + +class SquelettesTestCaseTest extends SquelettesTestCase +{ + public function testAssertOk(): void + { + $this->assertOk('ok'); + $this->assertOk('Ok'); + $this->assertOk('OK'); + $this->assertOk('OK NOK NA'); + } + + public function testAssertOkExceptionNok(): void + { + $this->expectException(AssertionFailedError::class); + $this->assertOk('NOK'); + } + + public function testAssertOkExceptionNa(): void + { + $this->expectException(AssertionFailedError::class); + $this->assertOk('NA'); + } + + public function testAssertNotOk() + { + $this->assertNotOk('nOK'); + $this->assertNotOk('NOK'); + $this->assertNotOk('Nok'); + $this->assertNotOk('Nok OK NA'); + } + + public function testAssertNotOkExceptionOk(): void + { + $this->expectException(AssertionFailedError::class); + $this->assertNotOk('OK'); + } + + public function testAssertNotOkExceptionNa(): void + { + $this->expectException(AssertionFailedError::class); + $this->assertOk('Na'); + } + + public function testIsNa(): void + { + $this->assertTrue($this->isNa(' NA texte')); + $this->assertTrue($this->isNa('na texte')); + $this->assertfalse($this->isNa('texte NA')); + $this->assertfalse($this->isNa('texte')); + } +} diff --git a/tests/tests/Testing/TemplateTest.php b/tests/tests/Testing/TemplateTest.php new file mode 100644 index 0000000000..53bd799356 --- /dev/null +++ b/tests/tests/Testing/TemplateTest.php @@ -0,0 +1,24 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Testing; + +use Spip\Core\Testing\SquelettesTestCase; +use Spip\Core\Testing\Template; + +class TemplateTest extends SquelettesTestCase +{ + public function testNativeRecupererFond(): void + { + $dir = $this->relativePath(__DIR__); + $this->assertEquals('Hello World', recuperer_fond($dir . '/data/texte_hello_world')); + } + + public function testRenderer(): void + { + $dir = $this->relativePath(__DIR__); + $template = new Template($dir . '/data/texte_hello_world'); + $this->assertEquals('Hello World', $template->render()); + } +} diff --git a/tests/tests/Testing/TemplatingTest.php b/tests/tests/Testing/TemplatingTest.php new file mode 100644 index 0000000000..3d4cec01a6 --- /dev/null +++ b/tests/tests/Testing/TemplatingTest.php @@ -0,0 +1,161 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Testing; + +use Spip\Core\Testing\Exception\TemplateNotFoundException; +use Spip\Core\Testing\SquelettesTestCase; +use Spip\Core\Testing\Template\Loader\ChainLoader; +use Spip\Core\Testing\Template\Loader\FileLoader; +use Spip\Core\Testing\Template\Loader\StringLoader; +use Spip\Core\Testing\Templating; + +class TemplatingTest extends SquelettesTestCase +{ + public function testFileLoader(): void + { + $loader = new FileLoader(); + $templating = new Templating($loader); + $this->assertInstanceOf(FileLoader::class, $templating->getLoader()); + $this->assertEquals($loader, $templating->getLoader()); + + $file = __DIR__ . '/data/texte_hello_world.html'; + $expected = trim(file_get_contents($file)); + + // Indirect render + $template = $templating->load($file); + $actual = $template->render(); + $this->assertEquals($expected, $actual); + + // Quick render + $actual = $templating->render($file); + $this->assertEquals($expected, $actual); + + // Assert render + $this->assertEqualsTemplate($expected, $templating, $file); + } + + public function testFileLoaderException(): void + { + $templating = new Templating(new FileLoader()); + $file = __DIR__ . '/data/inexistant_file.html'; + $this->expectException(TemplateNotFoundException::class); + $templating->render($file); + } + + public function testStringLoader(): void + { + $templating = Templating::fromString(); + $expected = 'Hello World'; + $actual = $templating->render($expected); + $this->assertEquals($expected, $actual); + } + + public function testChainLoader(): void + { + $template = new Templating(new ChainLoader([new FileLoader(), new StringLoader()])); + + $file = __DIR__ . '/data/texte_hello_world.html'; + $expected = trim(file_get_contents($file)); + $actual = $template->render($file); + $this->assertEquals($expected, $actual); + + $string = 'Not a file'; + $actual = $template->render($string); + $this->assertEquals($string, $actual); + } + + public function testCodeRenderAvecFonctionEtApresCode(): void + { + $loader = new StringLoader([ + 'fonctions' => " + function so_smile(): string { + return ' So Smile'; + } + ", + 'apres_code' => '[(#VAL|so_smile)]', + ]); + $templating = new Templating($loader); + $this->assertEquals('Hello World So Smile', $templating->render('Hello World')); + + $templating = Templating::fromString([ + 'fonctions' => " + function so_smile(): string { + return ' So Smile'; + } + ", + 'apres_code' => '[(#VAL|so_smile)]', + ]); + $this->assertEquals('Hello World So Smile', $templating->render('Hello World')); + } + + public function testCodeRenderAvecFonctionPrecedenteNonPresente(): void + { + $template = Templating::fromString(); + $this->assertNotEquals('Hello World So Smile', $template->render('Hello World')); + $this->assertEquals('Hello World', $template->render('Hello World')); + $this->assertNotEquals('Hello Kitty So Smile', $template->render('Hello Kitty')); + $this->assertEquals('Hello Kitty', $template->render('Hello Kitty')); + } + + public function testCodeRender(): void + { + $this->assertEqualsCode('Hello World', 'Hello World'); + } + + public function testCodeRenderAvecFonctionVide(): void + { + // pas de fichier de fonctions + $this->assertOkCode("[(#SQUELETTE|replace{'.html','_fonctions.php'}|find_in_path|non)ok]"); + + // fichier de fonction + $templating = Templating::fromString([ + 'fonctions' => " + function so_smile(): string { + return ' So Smile'; + } + ", + ]); + $this->assertOk($templating->render("[(#SQUELETTE|replace{'.html','_fonctions.php'}|find_in_path|oui)ok]")); + + // pas de fichier de fonctions + $templating = Templating::fromString(); + $this->assertNotOk($templating->render("[(#SQUELETTE|replace{'.html','_fonctions.php'}|find_in_path|oui)ok]")); + } + + public function testCodeRenderAvantApres(): void + { + $templating = Templating::fromString([ + 'avant_code' => 'Nice ', + 'apres_code' => ' So Beautiful', + ]); + $this->assertEquals('Nice Hello World So Beautiful', $templating->render('Hello World')); + } + + public function testCodeRawRenderInfos(): void + { + $templating = Templating::fromString(); + $infos = $templating->rawRender('#SELF'); + $this->assertTrue(is_array($infos)); + $this->assertTrue(isset($infos['squelette'])); + $this->assertTrue(isset($infos['fond'])); + } + + public function testCodeRawRenderInfosErreurCompilationFiltreAbsent(): void + { + $templating = Templating::fromString(); + + $infos = $templating->rawRender('#CACHE{0}[(#SELF|ce_filtre_nexiste_pas)]'); + $this->assertTrue(is_array($infos['erreurs'])); + $this->assertCount(1, $infos['erreurs']); + } + + public function testCodeRawRenderInfosErreurCompilationAbsentsDansNouvelleDemandeCorrecte(): void + { + $templating = Templating::fromString(); + + $infos = $templating->rawRender('#CACHE{0}Aucun Probleme ici'); + $this->assertCount(0, $infos['erreurs']); + } +} diff --git a/tests/tests/Testing/data/balise_env_test.html b/tests/tests/Testing/data/balise_env_test.html new file mode 100644 index 0000000000..379056bace --- /dev/null +++ b/tests/tests/Testing/data/balise_env_test.html @@ -0,0 +1 @@ +#ENV{test} diff --git a/tests/tests/Testing/data/texte_hello_world.html b/tests/tests/Testing/data/texte_hello_world.html new file mode 100644 index 0000000000..557db03de9 --- /dev/null +++ b/tests/tests/Testing/data/texte_hello_world.html @@ -0,0 +1 @@ +Hello World diff --git a/tests/tests/Texte/CouperTest.php b/tests/tests/Texte/CouperTest.php new file mode 100644 index 0000000000..e375573e06 --- /dev/null +++ b/tests/tests/Texte/CouperTest.php @@ -0,0 +1,114 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction couper du fichier inc/texte_mini.php + */ + +namespace Spip\Core\Tests\Texte; + +use PHPUnit\Framework\TestCase; + +class CouperTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/texte_mini.php', '', true); + find_in_path('inc/filtres.php', '', true); + } + + /** + * @dataProvider providerCouper + */ + public function testCouper($length_expected, $exact, ...$args): void + { + $actual = couper(...$args); + $length_actual = spip_strlen(filtrer_entites($actual)); + if ($exact) + $this->assertEquals($length_expected, $length_actual); + else + $this->assertLessThanOrEqual($length_expected, $length_actual); + } + + public static function providerCouper(): array + { + find_in_path('inc/charsets.php', '', true); + find_in_path('inc/filtres.php', '', true); + + // Phrases de test et éventuel texte de suite. + $data = [ + 'txt1' => [ + 'Une phrase pour tester le filtre |couper bla bli blu', + ], + 'txt1suite' => [ + 'Une phrase pour tester le filtre |couper bla bli blu', + ' (etc.)', + ], + 'txt2' => [ + 'Tést àvéc plêïn d’àççènts bla bli blu', + ], + 'txt2suite' => [ + 'Tést àvéc plêïn d’àççènts bla bli blu', + ' (etc.)', + ], + 'txt3' => [ + 'Supercalifragilisticexpialidocious', + ], + 'txt3suite' => [ + 'Supercalifragilisticexpialidocious', + ' (etc.)', + ], + 'txt4' => [ + "Un test du filtre |couper\n\navec deux paragraphes", + ], + 'txt4suite' => [ + "Un test du filtre |couper\n\navec deux paragraphes", + ' (etc.)', + ], + 'txt5' => [ + "<p>Un test du filtre |couper</p><p>avec deux paragraphes</p>", + ], + 'txt5suite' => [ + "<p>Un test du filtre |couper</p><p>avec deux paragraphes</p>", + ' (etc.)', + ], + 'txt6' => [ + "Articlé \"illustré\" : imagés ’céntrées’ avèc un titre long voir très long mais vraiment très long avec dés àçènts", + ], + 'txt6suite' => [ + "Articlé \"illustré\" : imagés ’céntrées’ avèc un titre long voir très long mais vraiment très long avec dés àçènts", + ' (etc.)', + ], + 'txt7' => [ + "Article : avec des espaces insecable ; challenge ?", + ], + 'txt7suite' => [ + "Article : avec des espaces insecable ; challenge ?", + ' (etc.)', + ], + ]; + // Pour chaque phrase de test, itérer sur toutes les longueurs de coupe + // possibles. + $tests = []; + foreach ($data as $i => &$args) { + $texte = $args[0]; + $suite = $args[1] ?? null; + $taille_texte = spip_strlen($texte); + // si la phrase contient du html on aura jamais la longueur exacte d'origine après une coupe + $exact_si_pluslong = (strlen($texte) === strlen(strip_tags($texte))); + for ($taille = 1; $taille <= $taille_texte + 10; $taille++) { + if ($taille < $taille_texte) { + $tests["{$i}_L$taille"] = [ + $taille, false, $texte, $taille, $suite + ]; + } else { + $tests["{$i}_L{$taille}"] = [ + $taille_texte, $exact_si_pluslong, $texte, $taille, $suite + ]; + } + } + } + return $tests; + } +} diff --git a/tests/tests/Texte/EchapperHtmlSuspectTest.php b/tests/tests/Texte/EchapperHtmlSuspectTest.php new file mode 100644 index 0000000000..5083f66d96 --- /dev/null +++ b/tests/tests/Texte/EchapperHtmlSuspectTest.php @@ -0,0 +1,78 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction propre du fichier inc/texte.php + */ + +namespace Spip\Core\Tests\Texte; + +use PHPUnit\Framework\TestCase; + +class EchapperHtmlSuspectTest extends TestCase { + + static $filtrer_javascript; + static $lang; + + + public static function setUpBeforeClass(): void { + find_in_path('inc/texte.php', '', true); + static::$filtrer_javascript = $GLOBALS['filtrer_javascript'] ?? null; + $GLOBALS['filtrer_javascript'] = -1; + // ce test est en en + static::$lang = $GLOBALS['spip_lang']; + changer_langue('en'); + } + + public static function tearDownAfterClass(): void { + $GLOBALS['filtrer_javascript'] = static::$filtrer_javascript; + $GLOBALS['spip_lang'] = static::$lang; + } + + /** + * @dataProvider providerIsHtmlSafe + */ + public function testIsHtmlSafe($expected, ...$args): void { + $actual = is_html_safe(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerIsHtmlSafe(): array { + return [ + 'relOK' => [ + true, + 'Voir aussi la page du taxon ️<a class="nom_scientifique" href="http://www.itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value=183813" rel="noreferrer">Acinonyx jubatus</a>. Wikipedia (descriptif rapide).' + ], + 'relInconnu' => [ + false, + 'Voir aussi la page du taxon ️<a class="nom_scientifique" href="http://www.itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value=183813" rel="relinconnu">Acinonyx jubatus</a>. Wikipedia (descriptif rapide).' + ], + 'span_lang_fr' => [ + true, + '<span lang="fr">Créer des sélections d’objets ayant un prix</span>', + ], + 'span_lang_fr_simples_quotes' => [ + true, + '<span lang=\'fr\'>Créer des sélections d’objets ayant un prix</span>', + ], + 'entite_unicode' => [ + true, + '<span lang=\'fr\'>Créer des sélections d’objets ayant un prix</span>', + ], + 'multi_safe' => [ + true, + '<multi>[fr]Salut[en]Hey[de]Hallo</multi>', + ], + 'multi_malicious' => [ + false, + '<multi><script type="text/javascript">alert()</script></multi>', + ], + 'idiome' => [ + true, + '<:spip:bonjour:> Toto', + ], + ]; + } + +} diff --git a/tests/tests/Texte/InterdireScriptLaxisteTest.php b/tests/tests/Texte/InterdireScriptLaxisteTest.php new file mode 100644 index 0000000000..9862fd0984 --- /dev/null +++ b/tests/tests/Texte/InterdireScriptLaxisteTest.php @@ -0,0 +1,59 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction interdire_script du fichier inc/texte.php + */ + +namespace Spip\Core\Tests\Texte; + +use PHPUnit\Framework\TestCase; + +class InterdireScriptLaxisteTest extends TestCase +{ + protected static $save_filtrer_javascript; + public static function setUpBeforeClass(): void + { + self::$save_filtrer_javascript = $GLOBALS['filtrer_javascript']; + find_in_path('inc/texte.php', '', true); + } + + public static function tearDownAfterClass(): void + { + $GLOBALS['filtrer_javascript'] = self::$save_filtrer_javascript; + } + + protected function setUp(): void + { + $GLOBALS['filtrer_javascript'] = 1; + } + + /** + * @dataProvider providerTexteInterdireScriptLaxiste + */ + public function testTexteInterdireScriptLaxiste($expected, ...$args): void + { + $actual = interdire_scripts(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerTexteInterdireScriptLaxiste(): array + { + return [[ + "<script type='text/javascript' src='toto.js'></script>", "<script type='text/javascript' src='toto.js'></script>", ], + [ + "<script type='text/javascript' src='spip.php?page=toto'></script>", + "<script type='text/javascript' src='spip.php?page=toto'></script>", + ], + ["<script type='text/javascript'>var php=5;</script>", "<script type='text/javascript'>var php=5;</script>"], + [ + "<script language='javascript' src='spip.php?page=toto'></script>", + "<script language='javascript' src='spip.php?page=toto'></script>", + ], + ["<script language='php'>die();</script>", "<script language='php'>die();</script>"], + ['<script language=php>die();</script>', '<script language=php>die();</script>'], + ['<script language = php >die();</script>', '<script language = php >die();</script>'], + ]; + } +} diff --git a/tests/tests/Texte/InterdireScriptParanoTest.php b/tests/tests/Texte/InterdireScriptParanoTest.php new file mode 100644 index 0000000000..716be86c7a --- /dev/null +++ b/tests/tests/Texte/InterdireScriptParanoTest.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction interdire_script du fichier inc/texte.php + */ + +namespace Spip\Core\Tests\Texte; + +use PHPUnit\Framework\TestCase; + +class InterdireScriptParanoTest extends TestCase +{ + protected static $save_filtrer_javascript; + public static function setUpBeforeClass(): void + { + self::$save_filtrer_javascript = $GLOBALS['filtrer_javascript']; + find_in_path('inc/texte.php', '', true); + } + + public static function tearDownAfterClass(): void + { + $GLOBALS['filtrer_javascript'] = self::$save_filtrer_javascript; + } + + protected function setUp(): void + { + $GLOBALS['filtrer_javascript'] = -1; + } + + /** + * @dataProvider providerTexteInterdireScriptParano + */ + public function testTexteInterdireScriptParano($expected, ...$args): void + { + $actual = interdire_scripts(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerTexteInterdireScriptParano(): array + { + return [[ + "<code class=\"echappe-js\"><script type='text/javascript' src='toto.js'></script></code>", "<script type='text/javascript' src='toto.js'></script>", ], + [ + "<code class=\"echappe-js\"><script type='text/javascript' src='spip.php?page=toto'></script></code>", + "<script type='text/javascript' src='spip.php?page=toto'></script>", + ], + [ + "<code class=\"echappe-js\"><script type='text/javascript'>var php=5;</script></code>", + "<script type='text/javascript'>var php=5;</script>", + ], + [ + "<code class=\"echappe-js\"><script language='javascript' src='spip.php?page=toto'></script></code>", + "<script language='javascript' src='spip.php?page=toto'></script>", + ], + ["<script language='php'>die();</script>", "<script language='php'>die();</script>"], + ['<script language=php>die();</script>', '<script language=php>die();</script>'], + ['<script language = php >die();</script>', '<script language = php >die();</script>'], + ]; + } +} diff --git a/tests/tests/Texte/PropreTest.php b/tests/tests/Texte/PropreTest.php new file mode 100644 index 0000000000..b3e4a7db6a --- /dev/null +++ b/tests/tests/Texte/PropreTest.php @@ -0,0 +1,96 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction propre du fichier inc/texte.php + */ + +namespace Spip\Core\Tests\Texte; + +use PHPUnit\Framework\TestCase; + +class PropreTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/texte.php', '', true); + } + + protected function setUp(): void + { + $GLOBALS['meta']['type_urls'] = 'page'; + $GLOBALS['type_urls'] = 'page'; + changer_langue('fr'); + // ce test est en fr + $GLOBALS['toujours_paragrapher'] = true; + foreach (['puce', 'puce_rtl', 'puce_prive', 'puce_prive_rtl'] as $puce) { + unset($GLOBALS[$puce]); + } + definir_puce(); + // initialiser les plugins qui changent les intertitre (Z), et les restaurer juste apres + $mem = [$GLOBALS['debut_intertitre'] ?? null, $GLOBALS['spip_raccourcis_typo'] ?? null]; + propre('rien du tout'); + [$GLOBALS['debut_intertitre'], $GLOBALS['spip_raccourcis_typo']] = $mem; + } + + /** + * @dataProvider providerTextePropre + */ + public function testTextePropre($expected, ...$args): void + { + $actual = propre(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerTextePropre(): array + { + return [ + 'vide' => [ + 0 => '', + 1 => '', + ], + 'null' => [ + 0 => '', + 1 => null, + ], + 'array' => [ + 0 => '', + 1 => [], + ], + 'chaine_zero' => [ + 0 => '<p>0</p>', + 1 => '0', + ], + 'nombre_zero' => [ + 0 => '<p>0</p>', + 1 => 0, + ], + 'string_1' => [ + 0 => '<p>Un texte avec des <a href="http://spip.net">liens</a> <a href="spip.php?article1" class="spip_in">Article 1</a> <a href="http://www.spip.net" class="spip_out" rel="external">spip</a> <a href="http://www.spip.net" class="spip_url spip_out auto" rel="nofollow external">http://www.spip.net</a></p>', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + ], + 'string_2' => [ + 0 => '<p>Un texte avec des entités &<>"</p>', + 1 => 'Un texte avec des entités &<>"', + ], + 'string_3' => [ + 0 => '<p>Un texte sans entites &<>"’</p>', + 1 => 'Un texte sans entites &<>"\'', + ], + 'string_4' => [ + 0 => '<h2 class="spip">Des raccourcis</h2> +<p> <i>italique</i> <strong>gras</strong> <code class="spip_code spip_code_inline" dir="ltr">du code</code></p>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + ], + 'string_5' => [ + 0 => '<p>Un modele <tt><modeleinexistant|lien=[->http://www.spip.net]></tt></p>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + ], + 'string_6' => [ + 0 => '<p><span class="spip-puce ltr"><b>–</b></span> propre</p>', + 1 => '- propre', + ], + ]; + } +} diff --git a/tests/tests/Texte/TypoTest.php b/tests/tests/Texte/TypoTest.php new file mode 100644 index 0000000000..0782b03d8b --- /dev/null +++ b/tests/tests/Texte/TypoTest.php @@ -0,0 +1,142 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction propre du fichier inc/texte.php + */ + +namespace Spip\Core\Tests\Texte; + +use PHPUnit\Framework\TestCase; + +class TypoTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('inc/texte.php', '', true); + } + + protected function setUp(): void + { + $GLOBALS['meta']['type_urls'] = 'page'; + $GLOBALS['type_urls'] = 'page'; + // ce test est en fr + changer_langue('fr'); + } + + /** + * @dataProvider providerTexteTypo + */ + public function testTexteTypo($expected, ...$args): void + { + $actual = typo(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerTexteTypo(): array + { + return [ + 0 => + [ + 0 => 'Quelle question !', + 1 => 'Quelle question!', + ], + 1 => + [ + 0 => '', + 1 => '', + 2 => true, + ], + 2 => + [ + 0 => '', + 1 => '', + 2 => false, + ], + 3 => + [ + 0 => '0', + 1 => '0', + 2 => true, + ], + 4 => + [ + 0 => '0', + 1 => '0', + 2 => false, + ], + 5 => + [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => true, + ], + 6 => + [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => false, + ], + 7 => + [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + 2 => true, + ], + 8 => + [ + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + 2 => false, + ], + 9 => + [ + 0 => 'Un texte sans entites &<>"’', + 1 => 'Un texte sans entites &<>"\'', + 2 => true, + ], + 10 => + [ + 0 => 'Un texte sans entites &<>"’', + 1 => 'Un texte sans entites &<>"\'', + 2 => false, + ], + 11 => + [ + 0 => "{{{Des raccourcis}}} {italique} {{gras}} <code class=\"spip_code spip_code_inline\" dir=\"ltr\">du code</code>", + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => true, + ], + 12 => + [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => false, + ], + 13 => + [ + 0 => 'Un modele <tt><modeleinexistant|lien=[->http://www.spip.net]></tt>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => true, + ], + 14 => + [ + 0 => 'Un modele <tt><modeleinexistant|lien=[->http://www.spip.net]></tt>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => false, + ], + 15 => + [ + 0 => 'Chat !!', + 1 => 'Chat!!' + ], + // et pas apres "(" -- http://trac.rezo.net/trac/spip/changeset/10177 + 'r10177' => + [ + 0 => '(!)', + 1 => '(!)' + ], + ]; + } +} diff --git a/tests/tests/Typographie/FrTest.php b/tests/tests/Typographie/FrTest.php new file mode 100644 index 0000000000..0f9f09f1c7 --- /dev/null +++ b/tests/tests/Typographie/FrTest.php @@ -0,0 +1,189 @@ +<?php + +declare(strict_types=1); + +/***************************************************************************\ + * SPIP, Système de publication pour l'internet * + * * + * Copyright © avec tendresse depuis 2001 * + * Arnaud Martin, Antoine Pitrou, Philippe Rivière, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribué sous licence GNU/GPL. * + * Pour plus de détails voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +namespace Spip\Core\Tests\Typographie; + +use PHPUnit\Framework\TestCase; + +class FrTest extends TestCase +{ + protected static $lang = 'fr'; + + protected static $root = 'ecrire/'; + + protected static $fnTypographie = 'typographie_fr_dist'; + + public static function setUpBeforeClass(): void + { + include_spip('inc/texte'); + changer_langue(static::$lang); + include_spip(static::$root . 'typographie/' . static::$lang); + } + + public static function providerBase() + { + $list = [ + 'bonjour' => 'bonjour', + 'bonjour ' => 'bonjour ', + 'bonjour à toutes et tous' => 'bonjour à toutes et tous', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + /** + * @dataProvider providerBase + */ + public function testBase($source, $expected) + { + $typographie = static::$fnTypographie; + $this->assertEquals($expected, $typographie($source)); + } + + public static function providerAddsSpaceOnPonctuation() + { + $list = [ + 'bonjour:' => 'bonjour :', + 'bonjour;' => 'bonjour ;', + 'bonjour!' => 'bonjour !', + 'bonjour?' => 'bonjour ?', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + /** + * @dataProvider providerAddsSpaceOnPonctuation + */ + public function testAddsSpaceOnPonctuation($source, $expected) + { + $typographie = static::$fnTypographie; + $this->assertEquals($expected, $typographie($source)); + } + + public static function providerChangeSpaceToNonBreakingSpaceOnPonctuation() + { + $list = [ + 'bonjour :' => 'bonjour :', + 'bonjour ;' => 'bonjour ;', + 'bonjour !' => 'bonjour !', + 'bonjour ?' => 'bonjour ?', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + /** + * @dataProvider providerChangeSpaceToNonBreakingSpaceOnPonctuation + */ + public function testChangeSpaceToNonBreakingSpaceOnPonctuation($source, $expected) + { + $typographie = static::$fnTypographie; + $this->assertEquals($expected, $typographie($source)); + } + + public static function providerChangeTildeToNonBreakingSpace() + { + $list = [ + 'bonjour~toi' => 'bonjour toi', + 'bonjour~le~monde' => 'bonjour le monde', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + /** + * @dataProvider providerChangeTildeToNonBreakingSpace + */ + public function testChangeTildeToNonBreakingSpace($source, $expected) + { + $typographie = static::$fnTypographie; + $this->assertEquals($expected, $typographie($source)); + } + + public static function providerChangeTildeToNonBreakingSpaceOnPonctuation() + { + $list = [ + 'bonjour~:' => 'bonjour :', + 'bonjour~;' => 'bonjour ;', + 'bonjour~!' => 'bonjour !', + 'bonjour~?' => 'bonjour ?', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + /** + * @dataProvider providerChangeTildeToNonBreakingSpaceOnPonctuation + */ + public function testChangeTildeToNonBreakingSpaceOnPonctuation($source, $expected) + { + $typographie = static::$fnTypographie; + $this->assertEquals($expected, $typographie($source)); + } + + public static function providerKeepNonBreakingSpaceEntity() + { + $list = [ + 'bonjour toi' => 'bonjour toi', + 'bonjour toi !' => 'bonjour toi !', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + /** + * @dataProvider providerKeepNonBreakingSpaceEntity + */ + public function testKeepNonBreakingSpaceEntity($source, $expected) + { + $typographie = static::$fnTypographie; + $this->assertEquals($expected, $typographie($source)); + } + + public static function providerKeepNonBreakingSpaceUtf() + { + $list = [ + 'bonjour toi' => 'bonjour toi', + 'bonjour toi !' => 'bonjour toi !', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + /** + * @dataProvider providerKeepNonBreakingSpaceUtf + */ + public function testKeepNonBreakingSpaceUtf($source, $expected) + { + $typographie = static::$fnTypographie; + // TODO + $this->markTestSkipped('NIY'); + $this->assertEquals($expected, $typographie($source)); + } + + public static function providerKeepDoubleTwoPoints() + { + $list = [ + 'bonjour::' => 'bonjour::', + '::1/128' => '::1/128', + 'ff00::/8' => 'ff00::/8', + ]; + return array_map(null, array_keys($list), array_values($list)); + } + + /** + * @dataProvider providerKeepDoubleTwoPoints + */ + public function testKeepDoubleTwoPoints($source, $expected) + { + $typographie = static::$fnTypographie; + // TODO + $this->markTestSkipped('NIY'); + $this->assertEquals($expected, $typographie($source)); + } +} diff --git a/tests/tests/Typographie/FrTextwheelTest.php b/tests/tests/Typographie/FrTextwheelTest.php new file mode 100644 index 0000000000..902785cb52 --- /dev/null +++ b/tests/tests/Typographie/FrTextwheelTest.php @@ -0,0 +1,24 @@ +<?php + +declare(strict_types=1); + +/***************************************************************************\ + * SPIP, Système de publication pour l'internet * + * * + * Copyright © avec tendresse depuis 2001 * + * Arnaud Martin, Antoine Pitrou, Philippe Rivière, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribué sous licence GNU/GPL. * + * Pour plus de détails voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +namespace Spip\Core\Tests\Typographie; + +class FrTextwheelTest extends FrTest +{ + protected static $lang = 'fr'; + + protected static $root = ''; + + protected static $fnTypographie = 'typographie_fr'; +} diff --git a/tests/tests/Typographie/NotesTest.php b/tests/tests/Typographie/NotesTest.php new file mode 100644 index 0000000000..d315293418 --- /dev/null +++ b/tests/tests/Typographie/NotesTest.php @@ -0,0 +1,132 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Core\Tests\Typographie; + +use PHPUnit\Framework\TestCase; + +class NotesTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + include_spip('public/composer'); + include_spip('inc/notes'); + } + + protected function setUp(): void + { + $this->viderNotes(); + } + + public function testNoteSimple(): void + { + $expected = "<p>a<span class=\"spip_note_ref\"> [<a href=\"#nb1\" class=\"spip_note\" rel=\"appendix\" title=\"b\" id=\"nh1\">1</a>]</span></p>"; + $this->assertEquals($expected, propre('a[[b]]')); + + $expected = "<div id=\"nb1\">\n<p><span class=\"spip_note_ref\">[<a href=\"#nh1\" class=\"spip_note\" title=\"" . _T('info_notes') . " 1\" rev=\"appendix\">1</a>] </span>b</p>\n</div>"; + $this->assertEquals($expected, calculer_notes()); + } + + public function testNoteSeule(): void + { + $texte = propre('[[Note en bas de page]]'); + // id de la note en pied de page + $this->assertMatchesRegularExpression('/#nb1/', $texte); + // classe sur le lien vers le pied + $this->assertMatchesRegularExpression('/spip_note/', $texte); + // id du lien pour remonter ici + $this->assertMatchesRegularExpression('/nh1/', $texte); + + // calculer les notes + $note = calculer_notes(); + $this->assertMatchesRegularExpression('/nb1/', $note); + $this->assertMatchesRegularExpression('/#nh1/', $note); + $this->assertMatchesRegularExpression('/Note en bas de page/', $note); + + } + + public function testNoteSeuleEtTexte(): void + { + $texte = propre('Texte avant [[Note en bas de page]] texte apres'); + $this->assertMatchesRegularExpression('/#nb1/', $texte); + $this->assertMatchesRegularExpression('/nh1/', $texte); + $this->assertMatchesRegularExpression('/spip_note/', $texte); + $this->assertMatchesRegularExpression('/Texte avant/', $texte); + $this->assertMatchesRegularExpression('/texte apres/', $texte); + $note = calculer_notes(); + $this->assertMatchesRegularExpression('/nb1/', $note); + $this->assertMatchesRegularExpression('/#nh1/', $note); + $this->assertMatchesRegularExpression('/Note en bas de page/', $note); + } + + public function testNoteDoubleEtTexte(): void + { + $texte = propre('Texte avant [[Note en bas de page]] texte apres [[Seconde note en bas de page]]'); + $this->assertMatchesRegularExpression('/#nb1/', $texte); + $this->assertMatchesRegularExpression('/#nb2/', $texte); + $this->assertMatchesRegularExpression('/texte apres/', $texte); + $note = calculer_notes(); + $this->assertMatchesRegularExpression('/Note en bas de page/', $note); + $this->assertMatchesRegularExpression('/Seconde note en bas de page/', $note); + } + + /** + * En ne vidant pas les notes les identifiant des renvois changent + */ + public function testNoteDoubleDeuxFoisEtDeuxCalculs(): void + { + $texte = propre('Texte avant [[Note en bas de page]] texte apres [[Seconde note en bas de page]]'); + $note = calculer_notes(); + $texte2 = propre('Autre avant [[Pinguin en bas de page]] autre apres [[Marmotte en bas de page]]'); + $note2 = calculer_notes(); + + $this->assertMatchesRegularExpression('/#nb1/', $texte); + $this->assertMatchesRegularExpression('/#nb2/', $texte); + $this->assertMatchesRegularExpression('/#nb2-1/', $texte2); + $this->assertMatchesRegularExpression('/#nb2-2/', $texte2); + + $this->assertMatchesRegularExpression('/Note en bas de page/', $note); + $this->assertMatchesRegularExpression('/Seconde note en bas de page/', $note); + $this->assertMatchesRegularExpression('/Pinguin en bas de page/', $note2); + $this->assertMatchesRegularExpression('/Marmotte en bas de page/', $note2); + } + + /** + * En ne vidant pas les notes les identifiant des renvois changent + */ + public function testNoteDoubleDeuxFoisEtUnCalcul(): void + { + $texte = propre('Texte avant [[Note en bas de page]] texte apres [[Seconde note en bas de page]]'); + $texte2 = propre('Autre avant [[Pinguin en bas de page]] autre apres [[Marmotte en bas de page]]'); + $note = calculer_notes(); + + $this->assertMatchesRegularExpression('/#nb1/', $texte); + $this->assertMatchesRegularExpression('/#nb2/', $texte); + $this->assertMatchesRegularExpression('/#nb3/', $texte2); + $this->assertMatchesRegularExpression('/#nb4/', $texte2); + + $this->assertMatchesRegularExpression('/Note en bas de page/', $note); + $this->assertMatchesRegularExpression('/Seconde note en bas de page/', $note); + $this->assertMatchesRegularExpression('/Pinguin en bas de page/', $note); + $this->assertMatchesRegularExpression('/Marmotte en bas de page/', $note); + } + + public function testNoteDoubleCoupeParModele(): void + { + $texte = propre('Texte avant [[Note en bas de page]] <img1> [[Seconde note en bas de page]]'); + $this->assertMatchesRegularExpression('/#nb1/', $texte); + $this->assertMatchesRegularExpression('/#nb2/', $texte); + + $note = calculer_notes(); + $this->assertMatchesRegularExpression('/Note en bas de page/', $note); + $this->assertMatchesRegularExpression('/Seconde note en bas de page/', $note); + } + + private function viderNotes(): void + { + // attention a cette globale qui pourrait changer dans le temps + $notes = charger_fonction('notes', 'inc'); + $notes('', 'reset_all'); + } +} diff --git a/tests/tests/Utils/ParametreUrlTest.php b/tests/tests/Utils/ParametreUrlTest.php new file mode 100644 index 0000000000..b536aa880f --- /dev/null +++ b/tests/tests/Utils/ParametreUrlTest.php @@ -0,0 +1,260 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction parametre_url du fichier ./inc/utils.php + */ + +namespace Spip\Core\Tests\Utils; + +use PHPUnit\Framework\TestCase; + +class ParametreUrlTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/utils.php', '', true); + } + + /** + * @dataProvider providerUtilsParametreUrl + */ + public function testUtilsParametreUrl($expected, ...$args): void + { + $actual = parametre_url(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerUtilsParametreUrl(): array + { + return [ + 0 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj&no_val&ajout=valajout', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'ajout', + 3 => 'valajout', + ], + 1 => [ + 0 => '/ecrire/?exec=exec&no_val', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'id_obj', + 3 => '', + ], + 2 => [ + 0 => '/ecrire/?exec=exec&id_obj=changobj&no_val', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'id_obj', + 3 => 'changobj', + ], + 3 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj&no_val=yes_val', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'no_val', + 3 => 'yes_val', + ], + 4 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'no_val', + 3 => '', + ], + 5 => [ + 0 => '/ecrire/?exec=exec&no_val', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'id_obj', + 3 => '', + 4 => '&', + ], + 6 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'no_val', + 3 => '', + 4 => '&', + ], + 7 => [ + 0 => 'id_objv', + 1 => '/ecrire/?exec=exec&id_obj=id_objv&no_val', + 2 => 'id_obj', + ], + 8 => [ + 0 => '', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'no_val', + ], + 9 => [ + 0 => null, + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'toto', + ], + 10 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj&no_val&id1=valeur&id2=valeur&id3=valeur', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'id1|id2|id3', + 3 => 'valeur', + ], + 11 => [ + 0 => '/ecrire/?exec=exec&id_obj=valeur&no_val&id2=valeur&id3=valeur', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'id_obj|id2|id3', + 3 => 'valeur', + ], + 12 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj&no_val=valeur&id1=valeur&id3=valeur', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'id1|no_val|id3', + 3 => 'valeur', + ], + 13 => [ + 0 => null, + 1 => '/ecrire/?exec=exec&id_obj=id_objv&no_val', + 2 => 'id_obj|no_val', + ], + 14 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'tab', + 3 => [], + ], + 15 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj&no_val&tab[]=0&tab[]=-1&tab[]=1&tab[]=2&tab[]=3&tab[]=4&tab[]=5&tab[]=6&tab[]=7&tab[]=10&tab[]=20&tab[]=30&tab[]=50&tab[]=100&tab[]=1000&tab[]=10000', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'tab', + 3 => [ + 0 => 0, + 1 => -1, + 2 => 1, + 3 => 2, + 4 => 3, + 5 => 4, + 6 => 5, + 7 => 6, + 8 => 7, + 9 => 10, + 10 => 20, + 11 => 30, + 12 => 50, + 13 => 100, + 14 => 1000, + 15 => 10000, + ], + ], + 16 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj&no_val&tab[]=1&tab[]=', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'tab', + 3 => [ + 0 => true, + 1 => false, + ], + ], + 17 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj&no_val&tab[]=Array&tab[]=Array&tab[]=Array&tab[]=Array', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'tab', + 3 => [ + 0 => [], + 1 => [ + 0 => '', + 1 => '0', + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 3 => 'Un texte avec des entités &<>"', + 4 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 5 => 'Un texte avec des entités numériques &<>"', + 6 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 7 => 'Un texte sans entites &<>"\'', + 8 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 9 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 10 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ], + 2 => [ + 0 => 0, + 1 => -1, + 2 => 1, + 3 => 2, + 4 => 3, + 5 => 4, + 6 => 5, + 7 => 6, + 8 => 7, + 9 => 10, + 10 => 20, + 11 => 30, + 12 => 50, + 13 => 100, + 14 => 1000, + 15 => 10000, + ], + 3 => [ + 0 => true, + 1 => false, + ], + ], + ], + 18 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'tab[]', + 3 => [], + ], + 19 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj&no_val&tab[]=0&tab[]=-1&tab[]=1&tab[]=2&tab[]=3&tab[]=4&tab[]=5&tab[]=6&tab[]=7&tab[]=10&tab[]=20&tab[]=30&tab[]=50&tab[]=100&tab[]=1000&tab[]=10000', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'tab[]', + 3 => [ + 0 => 0, + 1 => -1, + 2 => 1, + 3 => 2, + 4 => 3, + 5 => 4, + 6 => 5, + 7 => 6, + 8 => 7, + 9 => 10, + 10 => 20, + 11 => 30, + 12 => 50, + 13 => 100, + 14 => 1000, + 15 => 10000, + ], + ], + 20 => [ + 0 => '/ecrire/?exec=exec&id_obj=id_obj&no_val&tab[]=1&tab[]=', + 1 => '/ecrire/?exec=exec&id_obj=id_obj&no_val', + 2 => 'tab[]', + 3 => [ + 0 => true, + 1 => false, + ], + ], + 21 => [ + 0 => 'http://domaine/spip.php?t[]=0&t[]=2', + 1 => 'http://domaine/spip.php?t[]=1', + 2 => 't', + 3 => [0, 2], + ], + 22 => [ + 0 => 'http://domaine/spip.php?t[]=0&t[]=2', + 1 => 'http://domaine/spip.php?t[]=1', + 2 => 't[]', + 3 => [0, 2], + ], + 23 => [ + 0 => ['1', '2'], + 1 => 'http://domaine/spip.php?t[]=1&t[]=2', + 2 => 't', + ], + 24 => [ + 0 => ['1', '2'], + 1 => 'http://domaine/spip.php?t[]=1&t[]=2', + 2 => 't[]', + ], + ]; + } +} diff --git a/tests/tests/Utils/TesterUrlAbsolueTest.php b/tests/tests/Utils/TesterUrlAbsolueTest.php new file mode 100644 index 0000000000..31e905cc20 --- /dev/null +++ b/tests/tests/Utils/TesterUrlAbsolueTest.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction tester_url_absolue du fichier ./inc/utils.php + */ + +namespace Spip\Core\Tests\Utils; + +use PHPUnit\Framework\TestCase; + +class TesterUrlAbsolueTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/utils.php', '', true); + } + + /** + * @dataProvider providerUtilsTesterUrlAbsolue + */ + public function testUtilsTesterUrlAbsolue($expected, ...$args): void + { + $actual = tester_url_absolue(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerUtilsTesterUrlAbsolue(): array + { + return [ + 0 => [ + 0 => true, + 1 => 'http://www.spip.net/', + ], + 1 => [ + 0 => true, + 1 => 'https://www.spip.net/', + ], + 2 => [ + 0 => true, + 1 => 'http://www.spip.net/sousrep/fr/', + ], + 3 => [ + 0 => true, + 1 => 'ftp://www.spip.net/', + ], + 4 => [ + 0 => true, + 1 => '//www.spip.net/', + ], + 5 => [ + 0 => false, + 1 => '/spip/?page=sommaire', + ], + 6 => [ + 0 => false, + 1 => 'spip/?page=sommaire', + ], + ]; + } +} diff --git a/tests/tests/Utils/UrlDeTest.php b/tests/tests/Utils/UrlDeTest.php new file mode 100644 index 0000000000..63e3249a5f --- /dev/null +++ b/tests/tests/Utils/UrlDeTest.php @@ -0,0 +1,118 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de la fonction url_de_ du fichier ./inc/utils.php + */ + +namespace Spip\Core\Tests\Utils; + +use PHPUnit\Framework\TestCase; + +class UrlDeTest extends TestCase +{ + public static function setUpBeforeClass(): void + { + find_in_path('./inc/utils.php', '', true); + } + + /** + * @dataProvider providerUtilsUrlDe + */ + public function testUtilsUrlDe($expected, ...$args): void + { + $actual = url_de_(...$args); + $this->assertSame($expected, $actual); + } + + public static function providerUtilsUrlDe(): array + { + return [ + 0 => [ + 0 => 'http://www.example.org/', + 1 => 'http', + 2 => 'www.example.org', + 3 => '', + 4 => 0, + ], + 1 => [ + 0 => 'http://www.example.org/', + 1 => 'http', + 2 => 'www.example.org', + 3 => '/spip.php', + 4 => 0, + ], + 2 => [ + 0 => 'http://www.example.org/', + 1 => 'http', + 2 => 'www.example.org', + 3 => '/spip.php?page=demo', + 4 => 0, + ], + 3 => [ + 0 => 'http://www.example.org/sousrep/', + 1 => 'http', + 2 => 'www.example.org', + 3 => '/sousrep/spip.php?page=demo', + 4 => 0, + ], + 4 => [ + 0 => 'http://www.example.org/sousrep/url/arbo/', + 1 => 'http', + 2 => 'www.example.org', + 3 => '/sousrep/url/arbo/page.html', + 4 => 0, + ], + 5 => [ + 0 => 'http://www.example.org/sousrep/url/', + 1 => 'http', + 2 => 'www.example.org', + 3 => '/sousrep/url/arbo/page.html', + 4 => 1, + ], + 6 => [ + 0 => 'http://www.example.org/sousrep/', + 1 => 'http', + 2 => 'www.example.org', + 3 => '/sousrep/url/arbo/page.html', + 4 => 2, + ], + 7 => [ + 0 => 'http://www.example.org/', + 1 => 'http', + 2 => 'www.example.org', + 3 => '/sousrep/url/arbo/page.html', + 4 => 3, + ], + 8 => [ + 0 => 'http://www.example.org/', + 1 => 'http', + 2 => 'www.example.org', + 3 => '/sousrep/url/arbo/page.html', + 4 => 4, + ], + 9 => [ + 0 => 'http://www.example.org/', + 1 => 'http', + 2 => 'www.example.org', + 3 => 'http://www.example.org/sousrep/url/arbo/page.html', + 4 => 3, + ], + 10 => [ + 0 => 'http://www.example.org/', + 1 => 'http', + 2 => 'www.example.org', + 3 => '/?param=http://domain.tld/autre/piege/tordu', + 4 => 3, + ], + 11 => [ + 0 => 'http:///', + 1 => 'http', + 2 => '', + 3 => '', + 4 => 0, + ], + ]; + } +} diff --git a/tests/tests/bootstrap.php b/tests/tests/bootstrap.php new file mode 100644 index 0000000000..269f8b589f --- /dev/null +++ b/tests/tests/bootstrap.php @@ -0,0 +1,66 @@ +<?php + +declare(strict_types=1); + +/* + * Ce fichier s'appelle depuis un test PHPUnit + * Il permet de démarrer SPIP + * + */ + +// let's go spip +if (! defined('_SPIP_TEST_INC')) { + define('_SPIP_TEST_INC', dirname(__FILE__, 2)); +} + +// si rien defini on va dans le public + +if (! defined('_SPIP_TEST_CHDIR')) { + define('_SPIP_TEST_CHDIR', dirname(_SPIP_TEST_INC)); +} + +if (! defined('_DIR_TESTS')) { + define('_DIR_TESTS', substr(_SPIP_TEST_INC, strlen(_SPIP_TEST_CHDIR) + 1) . '/'); +} + +// chdir pour charger SPIP +chdir(_SPIP_TEST_CHDIR); + +require_once _SPIP_TEST_CHDIR . '/ecrire/inc_version.php'; + +// pour notice sur recuperer_fond() +if (! isset($GLOBALS['spip_lang'])) { + include_spip('inc/lang'); + utiliser_langue_visiteur(); +} + +$GLOBALS['taille_des_logs'] = 1024; +$GLOBALS['delais'] = 0; + +// pas admin ? passe ton chemin (ce script est un vilain trou de securite) +if (! _IS_CLI) { + die("Ce test n'est executable qu'en cli"); +} + +// afficher toutes les erreurs +@ini_set('display_errors', 'On'); +@error_reporting(E_ALL); + +function spip_tests_loger_webmestre() +{ + // il faut charger une session webmestre + include_spip('base/abstract_sql'); + $webmestre = sql_fetsel('*', 'spip_auteurs', "statut='0minirezo' AND webmestre='oui'", '', 'id_auteur', '0,1'); + include_spip('inc/auth'); + auth_loger($webmestre); +} + +function spip_tests_deloger_webmestre() { + if (!empty($GLOBALS['visiteur_session']['id_auteur'])) { + supprimer_sessions($GLOBALS['visiteur_session']['id_auteur'], false); + } + $GLOBALS['visiteur_session'] = []; +} + +// inclure les bootstrap.php de chaque suite +include_once __DIR__ . '/bootstrap_plugins.php'; diff --git a/tests/tests/legacy/css/tests.css b/tests/tests/legacy/css/tests.css new file mode 100644 index 0000000000..23e4804046 --- /dev/null +++ b/tests/tests/legacy/css/tests.css @@ -0,0 +1,66 @@ +body { + font-family: Lucida,Verdana,sans-serif; + background-color: #eeeeee; + font-size:small; +} + +h1 { + background-color:#0066BB; + color:white; + font-size:large; + padding:15px; +} +h1 a { + color:white; +} + +dt { + background-color: #aaa; + color: white; + padding: 4px; + font-size:medium; +} +dt a { + color:white; +} + +dd, dd a { + line-height: 1.25em; + background-color: white; + color: #333; + text-decoration: none; +} + +dd.ok, dd.ok a { + color: green; +} +dd.na, dd.na a { + color: orange; +} +dd.erreur, dd.erreur a { + color: red; +} + +dl.ok dt { + background-color: green; +} +dl.erreur dt { + background-color: orange; +} + +div.result { + background-color: white; + color: black; + font-size: small; + border: dotted 1px; + padding: 2px; +} + +#count { + padding: 3px; + border: dotted 1px; + background-color: white; + float:right; + text-align:right; + position: absolute; top:4px; right:4px; +} diff --git a/tests/tests/legacy/js/jquery-3.2.js b/tests/tests/legacy/js/jquery-3.2.js new file mode 100644 index 0000000000..d2d8ca4790 --- /dev/null +++ b/tests/tests/legacy/js/jquery-3.2.js @@ -0,0 +1,10253 @@ +/*! + * jQuery JavaScript Library v3.2.1 + * https://jquery.com/ + * + * Includes Sizzle.js + * https://sizzlejs.com/ + * + * Copyright JS Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2017-03-20T18:59Z + */ +( function( global, factory ) { + + "use strict"; + + if ( typeof module === "object" && typeof module.exports === "object" ) { + + // For CommonJS and CommonJS-like environments where a proper `window` + // is present, execute the factory and get jQuery. + // For environments that do not have a `window` with a `document` + // (such as Node.js), expose a factory as module.exports. + // This accentuates the need for the creation of a real `window`. + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info. + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 +// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode +// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common +// enough that all such attempts are guarded in a try block. +"use strict"; + +var arr = []; + +var document = window.document; + +var getProto = Object.getPrototypeOf; + +var slice = arr.slice; + +var concat = arr.concat; + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var fnToString = hasOwn.toString; + +var ObjectFunctionString = fnToString.call( Object ); + +var support = {}; + + + + function DOMEval( code, doc ) { + doc = doc || document; + + var script = doc.createElement( "script" ); + + script.text = code; + doc.head.appendChild( script ).parentNode.removeChild( script ); + } +/* global Symbol */ +// Defining this global in .eslintrc.json would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module + + + +var + version = "3.2.1", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Support: Android <=4.0 only + // Make sure we trim BOM and NBSP + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; + +jQuery.fn = jQuery.prototype = { + + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + + // Return all the elements in a clean array + if ( num == null ) { + return slice.call( this ); + } + + // Return just the one element from the set + return num < 0 ? this[ num + this.length ] : this[ num ]; + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + each: function( callback ) { + return jQuery.each( this, callback ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map( this, function( elem, i ) { + return callback.call( elem, i, elem ); + } ) ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[ 0 ] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + + // Only deal with non-null/undefined values + if ( ( options = arguments[ i ] ) != null ) { + + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject( copy ) || + ( copyIsArray = Array.isArray( copy ) ) ) ) { + + if ( copyIsArray ) { + copyIsArray = false; + clone = src && Array.isArray( src ) ? src : []; + + } else { + clone = src && jQuery.isPlainObject( src ) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend( { + + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + isFunction: function( obj ) { + return jQuery.type( obj ) === "function"; + }, + + isWindow: function( obj ) { + return obj != null && obj === obj.window; + }, + + isNumeric: function( obj ) { + + // As of jQuery 3.0, isNumeric is limited to + // strings and numbers (primitives or objects) + // that can be coerced to finite numbers (gh-2662) + var type = jQuery.type( obj ); + return ( type === "number" || type === "string" ) && + + // parseFloat NaNs numeric-cast false positives ("") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + !isNaN( obj - parseFloat( obj ) ); + }, + + isPlainObject: function( obj ) { + var proto, Ctor; + + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { + return false; + } + + proto = getProto( obj ); + + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; + } + + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + }, + + isEmptyObject: function( obj ) { + + /* eslint-disable no-unused-vars */ + // See https://github.com/eslint/eslint/issues/6125 + var name; + + for ( name in obj ) { + return false; + } + return true; + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android <=2.3 only (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; + }, + + // Evaluates a script in a global context + globalEval: function( code ) { + DOMEval( code ); + }, + + // Convert dashed to camelCase; used by the css and data modules + // Support: IE <=9 - 11, Edge 12 - 13 + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + each: function( obj, callback ) { + var length, i = 0; + + if ( isArrayLike( obj ) ) { + length = obj.length; + for ( ; i < length; i++ ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } else { + for ( i in obj ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } + + return obj; + }, + + // Support: Android <=4.0 only + trim: function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArrayLike( Object( arr ) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var length, value, + i = 0, + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArrayLike( elems ) ) { + length = elems.length; + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: Date.now, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +} ); + +if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; +} + +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), +function( i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +} ); + +function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v2.3.3 + * https://sizzlejs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2016-08-08 + */ +(function( window ) { + +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + 1 * new Date(), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf as it's faster than native + // https://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { + var i = 0, + len = list.length; + for ( ; i < len; i++ ) { + if ( list[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + + // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + identifier + ")" ), + "CLASS": new RegExp( "^\\.(" + identifier + ")" ), + "TAG": new RegExp( "^(" + identifier + "|[*])" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + + // CSS escapes + // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // CSS string/identifier serialization + // https://drafts.csswg.org/cssom/#common-serializing-idioms + rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, + fcssescape = function( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + } + + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); + }, + + disabledAncestor = addCombinator( + function( elem ) { + return elem.disabled === true && ("form" in elem || "label" in elem); + }, + { dir: "parentNode", next: "legend" } + ); + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var m, i, elem, nid, match, groups, newSelector, + newContext = context && context.ownerDocument, + + // nodeType defaults to 9, since context defaults to document + nodeType = context ? context.nodeType : 9; + + results = results || []; + + // Return early from calls with invalid selector or context + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + + return results; + } + + // Try to shortcut find operations (as opposed to filters) in HTML documents + if ( !seed ) { + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + context = context || document; + + if ( documentIsHTML ) { + + // If the selector is sufficiently simple, try using a "get*By*" DOM method + // (excepting DocumentFragment context, where the methods don't exist) + if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { + + // ID selector + if ( (m = match[1]) ) { + + // Document context + if ( nodeType === 9 ) { + if ( (elem = context.getElementById( m )) ) { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + + // Element context + } else { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( newContext && (elem = newContext.getElementById( m )) && + contains( context, elem ) && + elem.id === m ) { + + results.push( elem ); + return results; + } + } + + // Type selector + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Class selector + } else if ( (m = match[3]) && support.getElementsByClassName && + context.getElementsByClassName ) { + + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // Take advantage of querySelectorAll + if ( support.qsa && + !compilerCache[ selector + " " ] && + (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + + if ( nodeType !== 1 ) { + newContext = context; + newSelector = selector; + + // qSA looks outside Element context, which is not what we want + // Thanks to Andrew Dupont for this workaround technique + // Support: IE <=8 + // Exclude object elements + } else if ( context.nodeName.toLowerCase() !== "object" ) { + + // Capture the context ID, setting it first if necessary + if ( (nid = context.getAttribute( "id" )) ) { + nid = nid.replace( rcssescape, fcssescape ); + } else { + context.setAttribute( "id", (nid = expando) ); + } + + // Prefix every selector in the list + groups = tokenize( selector ); + i = groups.length; + while ( i-- ) { + groups[i] = "#" + nid + " " + toSelector( groups[i] ); + } + newSelector = groups.join( "," ); + + // Expand context for sibling selectors + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || + context; + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch ( qsaError ) { + } finally { + if ( nid === expando ) { + context.removeAttribute( "id" ); + } + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {function(string, object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created element and returns a boolean result + */ +function assert( fn ) { + var el = document.createElement("fieldset"); + + try { + return !!fn( el ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( el.parentNode ) { + el.parentNode.removeChild( el ); + } + // release memory in IE + el = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = arr.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + a.sourceIndex - b.sourceIndex; + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for :enabled/:disabled + * @param {Boolean} disabled true for :disabled; false for :enabled + */ +function createDisabledPseudo( disabled ) { + + // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable + return function( elem ) { + + // Only certain elements can match :enabled or :disabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled + if ( "form" in elem ) { + + // Check for inherited disabledness on relevant non-disabled elements: + // * listed form-associated elements in a disabled fieldset + // https://html.spec.whatwg.org/multipage/forms.html#category-listed + // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled + // * option elements in a disabled optgroup + // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled + // All such elements have a "form" property. + if ( elem.parentNode && elem.disabled === false ) { + + // Option elements defer to a parent optgroup if present + if ( "label" in elem ) { + if ( "label" in elem.parentNode ) { + return elem.parentNode.disabled === disabled; + } else { + return elem.disabled === disabled; + } + } + + // Support: IE 6 - 11 + // Use the isDisabled shortcut property to check for disabled fieldset ancestors + return elem.isDisabled === disabled || + + // Where there is no isDisabled, check manually + /* jshint -W018 */ + elem.isDisabled !== !disabled && + disabledAncestor( elem ) === disabled; + } + + return elem.disabled === disabled; + + // Try to winnow out elements that can't be disabled before trusting the disabled property. + // Some victims get caught in our net (label, legend, menu, track), but it shouldn't + // even exist on them, let alone have a boolean value. + } else if ( "label" in elem ) { + return elem.disabled === disabled; + } + + // Remaining elements are neither :enabled nor :disabled + return false; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== "undefined" && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes + * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var hasCompare, subWindow, + doc = node ? node.ownerDocument || node : preferredDoc; + + // Return early if doc is invalid or already selected + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Update global variables + document = doc; + docElem = document.documentElement; + documentIsHTML = !isXML( document ); + + // Support: IE 9-11, Edge + // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) + if ( preferredDoc !== document && + (subWindow = document.defaultView) && subWindow.top !== subWindow ) { + + // Support: IE 11, Edge + if ( subWindow.addEventListener ) { + subWindow.addEventListener( "unload", unloadHandler, false ); + + // Support: IE 9 - 10 only + } else if ( subWindow.attachEvent ) { + subWindow.attachEvent( "onunload", unloadHandler ); + } + } + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties + // (excepting IE8 booleans) + support.attributes = assert(function( el ) { + el.className = "i"; + return !el.getAttribute("className"); + }); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( el ) { + el.appendChild( document.createComment("") ); + return !el.getElementsByTagName("*").length; + }); + + // Support: IE<9 + support.getElementsByClassName = rnative.test( document.getElementsByClassName ); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programmatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert(function( el ) { + docElem.appendChild( el ).id = expando; + return !document.getElementsByName || !document.getElementsByName( expando ).length; + }); + + // ID filter and find + if ( support.getById ) { + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var elem = context.getElementById( id ); + return elem ? [ elem ] : []; + } + }; + } else { + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== "undefined" && + elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + + // Support: IE 6 - 7 only + // getElementById is not reliable as a find shortcut + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var node, i, elems, + elem = context.getElementById( id ); + + if ( elem ) { + + // Verify the id attribute + node = elem.getAttributeNode("id"); + if ( node && node.value === id ) { + return [ elem ]; + } + + // Fall back on getElementsByName + elems = context.getElementsByName( id ); + i = 0; + while ( (elem = elems[i++]) ) { + node = elem.getAttributeNode("id"); + if ( node && node.value === id ) { + return [ elem ]; + } + } + } + + return []; + } + }; + } + + // Tag + Expr.find["TAG"] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( tag ); + + // DocumentFragment nodes don't have gEBTN + } else if ( support.qsa ) { + return context.querySelectorAll( tag ); + } + } : + + function( tag, context ) { + var elem, + tmp = [], + i = 0, + // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See https://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( el ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // https://bugs.jquery.com/ticket/12359 + docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + + "<select id='" + expando + "-\r\\' msallowcapture=''>" + + "<option selected=''></option></select>"; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( el.querySelectorAll("[msallowcapture^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !el.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ + if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push("~="); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !el.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + + // Support: Safari 8+, iOS 8+ + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibling-combinator selector` fails + if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push(".#.+[+~]"); + } + }); + + assert(function( el ) { + el.innerHTML = "<a href='' disabled='disabled'></a>" + + "<select disabled='disabled'><option/></select>"; + + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = document.createElement("input"); + input.setAttribute( "type", "hidden" ); + el.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( el.querySelectorAll("[name=d]").length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( el.querySelectorAll(":enabled").length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Support: IE9-11+ + // IE's :disabled selector does not pick up the children of disabled fieldsets + docElem.appendChild( el ).disabled = true; + if ( el.querySelectorAll(":disabled").length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + el.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( el ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( el, "*" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( el, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully self-exclusive + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + return a === document ? -1 : + b === document ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return document; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + if ( support.matchesSelector && documentIsHTML && + !compilerCache[ expr + " " ] && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch (e) {} + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null; +}; + +Sizzle.escape = function( sel ) { + return (sel + "").replace( rcssescape, fcssescape ); +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + while ( (node = elem[i++]) ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[6] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[3] ) { + match[2] = match[4] || match[5] || ""; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, uniqueCache, outerCache, node, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType, + diff = false; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? + node.nodeName.toLowerCase() === name : + node.nodeType === 1 ) { + + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + + // Seek `elem` from a previously-cached index + + // ...in a gzip-friendly way + node = parent; + outerCache = node[ expando ] || (node[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + (outerCache[ node.uniqueID ] = {}); + + cache = uniqueCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex && cache[ 2 ]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + } else { + // Use previously-cached element index if available + if ( useCache ) { + // ...in a gzip-friendly way + node = elem; + outerCache = node[ expando ] || (node[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + (outerCache[ node.uniqueID ] = {}); + + cache = uniqueCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex; + } + + // xml :nth-child(...) + // or :nth-last-child(...) or :nth(-last)?-of-type(...) + if ( diff === false ) { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? + node.nodeName.toLowerCase() === name : + node.nodeType === 1 ) && + ++diff ) { + + // Cache the index of each encountered element + if ( useCache ) { + outerCache = node[ expando ] || (node[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + (outerCache[ node.uniqueID ] = {}); + + uniqueCache[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + // Don't keep the element (issue #299) + input[0] = null; + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + text = text.replace( runescape, funescape ); + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": createDisabledPseudo( false ), + "disabled": createDisabledPseudo( true ), + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( (tokens = []) ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +}; + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + skip = combinator.next, + key = skip || dir, + checkNonElements = base && key === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + return false; + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, uniqueCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); + + if ( skip && skip === elem.nodeName.toLowerCase() ) { + elem = elem[ dir ] || elem; + } else if ( (oldCache = uniqueCache[ key ]) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); + } else { + // Reuse newcache so results back-propagate to previous elements + uniqueCache[ key ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { + return true; + } + } + } + } + } + return false; + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + // Avoid hanging onto element (issue #299) + checkContext = null; + return ret; + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), + len = elems.length; + + if ( outermost ) { + outermostContext = context === document || context || outermost; + } + + // Add elements passing elementMatchers directly to results + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + if ( !context && elem.ownerDocument !== document ) { + setDocument( elem ); + xml = !documentIsHTML; + } + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context || document, xml) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // `i` is now the count of elements visited above, and adding it to `matchedCount` + // makes the latter nonnegative. + matchedCount += i; + + // Apply set filters to unmatched elements + // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` + // equals `i`), unless we didn't visit _any_ elements in the above loop because we have + // no element matchers and no seed. + // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that + // case, which will result in a "00" `matchedCount` that differs from `i` but is also + // numerically zero. + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; +}; + +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { + var i, tokens, token, type, find, + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( (selector = compiled.selector || selector) ); + + results = results || []; + + // Try to minimize operations if there is only one selector in the list and no seed + // (the latter of which guarantees us context) + if ( match.length === 1 ) { + + // Reduce context if the leading compound selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + !context || rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +}; + +// One-time assignments + +// Sort stability +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; + +// Support: Chrome 14-35+ +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert(function( el ) { + // Should return 1, but returns 4 (following) + return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; +}); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( el ) { + el.innerHTML = "<a href='#'></a>"; + return el.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( el ) { + el.innerHTML = "<input/>"; + el.firstChild.setAttribute( "value", "" ); + return el.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert(function( el ) { + return el.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; + } + }); +} + +return Sizzle; + +})( window ); + + + +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; + +// Deprecated +jQuery.expr[ ":" ] = jQuery.expr.pseudos; +jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; +jQuery.escapeSelector = Sizzle.escape; + + + + +var dir = function( elem, dir, until ) { + var matched = [], + truncate = until !== undefined; + + while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { + if ( elem.nodeType === 1 ) { + if ( truncate && jQuery( elem ).is( until ) ) { + break; + } + matched.push( elem ); + } + } + return matched; +}; + + +var siblings = function( n, elem ) { + var matched = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + matched.push( n ); + } + } + + return matched; +}; + + +var rneedsContext = jQuery.expr.match.needsContext; + + + +function nodeName( elem, name ) { + + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + +}; +var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); + + + +var risSimple = /^.[^:#\[\.,]*$/; + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + return !!qualifier.call( elem, i, elem ) !== not; + } ); + } + + // Single element + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + } ); + } + + // Arraylike of elements (jQuery, arguments, Array) + if ( typeof qualifier !== "string" ) { + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not; + } ); + } + + // Simple selector that can be filtered directly, removing non-Elements + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + // Complex selector, compare the two sets, removing non-Elements + qualifier = jQuery.filter( qualifier, elements ); + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; + } ); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + if ( elems.length === 1 && elem.nodeType === 1 ) { + return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; + } + + return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + } ) ); +}; + +jQuery.fn.extend( { + find: function( selector ) { + var i, ret, + len = this.length, + self = this; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter( function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + } ) ); + } + + ret = this.pushStack( [] ); + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + return len > 1 ? jQuery.uniqueSort( ret ) : ret; + }, + filter: function( selector ) { + return this.pushStack( winnow( this, selector || [], false ) ); + }, + not: function( selector ) { + return this.pushStack( winnow( this, selector || [], true ) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +} ); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // A simple way to check for HTML strings + // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + // Shortcut simple #id case for speed + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, + + init = jQuery.fn.init = function( selector, context, root ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Method init() accepts an alternate rootjQuery + // so migrate can support jQuery.sub (gh-2101) + root = root || rootjQuery; + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector[ 0 ] === "<" && + selector[ selector.length - 1 ] === ">" && + selector.length >= 3 ) { + + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && ( match[ 1 ] || !context ) ) { + + // HANDLE: $(html) -> $(array) + if ( match[ 1 ] ) { + context = context instanceof jQuery ? context[ 0 ] : context; + + // Option to run scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[ 1 ], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[ 2 ] ); + + if ( elem ) { + + // Inject the element directly into the jQuery object + this[ 0 ] = elem; + this.length = 1; + } + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || root ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this[ 0 ] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return root.ready !== undefined ? + root.ready( selector ) : + + // Execute immediately if ready is not present + selector( jQuery ); + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + + // Methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend( { + has: function( target ) { + var targets = jQuery( target, this ), + l = targets.length; + + return this.filter( function() { + var i = 0; + for ( ; i < l; i++ ) { + if ( jQuery.contains( this, targets[ i ] ) ) { + return true; + } + } + } ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + targets = typeof selectors !== "string" && jQuery( selectors ); + + // Positional selectors never match, since there's no _selection_ context + if ( !rneedsContext.test( selectors ) ) { + for ( ; i < l; i++ ) { + for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { + + // Always skip document fragments + if ( cur.nodeType < 11 && ( targets ? + targets.index( cur ) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector( cur, selectors ) ) ) { + + matched.push( cur ); + break; + } + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); + }, + + // Determine the position of an element within the set + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; + } + + // Index in selector + if ( typeof elem === "string" ) { + return indexOf.call( jQuery( elem ), this[ 0 ] ); + } + + // Locate the position of the desired element + return indexOf.call( this, + + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[ 0 ] : elem + ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.uniqueSort( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter( selector ) + ); + } +} ); + +function sibling( cur, dir ) { + while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} + return cur; +} + +jQuery.each( { + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return siblings( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return siblings( elem.firstChild ); + }, + contents: function( elem ) { + if ( nodeName( elem, "iframe" ) ) { + return elem.contentDocument; + } + + // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only + // Treat the template element as a regular one in browsers that + // don't support it. + if ( nodeName( elem, "template" ) ) { + elem = elem.content || elem; + } + + return jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var matched = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + matched = jQuery.filter( selector, matched ); + } + + if ( this.length > 1 ) { + + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + jQuery.uniqueSort( matched ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + matched.reverse(); + } + } + + return this.pushStack( matched ); + }; +} ); +var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); + + + +// Convert String-formatted options into Object-formatted ones +function createOptions( options ) { + var object = {}; + jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { + object[ flag ] = true; + } ); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + createOptions( options ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + + // Last fire value for non-forgettable lists + memory, + + // Flag to know if list was already fired + fired, + + // Flag to prevent firing + locked, + + // Actual callback list + list = [], + + // Queue of execution data for repeatable lists + queue = [], + + // Index of currently firing callback (modified by add/remove as needed) + firingIndex = -1, + + // Fire callbacks + fire = function() { + + // Enforce single-firing + locked = locked || options.once; + + // Execute callbacks for all pending executions, + // respecting firingIndex overrides and runtime changes + fired = firing = true; + for ( ; queue.length; firingIndex = -1 ) { + memory = queue.shift(); + while ( ++firingIndex < list.length ) { + + // Run callback and check for early termination + if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && + options.stopOnFalse ) { + + // Jump to end and forget the data so .add doesn't re-fire + firingIndex = list.length; + memory = false; + } + } + } + + // Forget the data if we're done with it + if ( !options.memory ) { + memory = false; + } + + firing = false; + + // Clean up if we're done firing for good + if ( locked ) { + + // Keep an empty list if we have data for future add calls + if ( memory ) { + list = []; + + // Otherwise, this object is spent + } else { + list = ""; + } + } + }, + + // Actual Callbacks object + self = { + + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + + // If we have memory from a past run, we should fire after adding + if ( memory && !firing ) { + firingIndex = list.length - 1; + queue.push( memory ); + } + + ( function add( args ) { + jQuery.each( args, function( _, arg ) { + if ( jQuery.isFunction( arg ) ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { + + // Inspect recursively + add( arg ); + } + } ); + } )( arguments ); + + if ( memory && !firing ) { + fire(); + } + } + return this; + }, + + // Remove a callback from the list + remove: function() { + jQuery.each( arguments, function( _, arg ) { + var index; + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + + // Handle firing indexes + if ( index <= firingIndex ) { + firingIndex--; + } + } + } ); + return this; + }, + + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? + jQuery.inArray( fn, list ) > -1 : + list.length > 0; + }, + + // Remove all callbacks from the list + empty: function() { + if ( list ) { + list = []; + } + return this; + }, + + // Disable .fire and .add + // Abort any current/pending executions + // Clear all callbacks and values + disable: function() { + locked = queue = []; + list = memory = ""; + return this; + }, + disabled: function() { + return !list; + }, + + // Disable .fire + // Also disable .add unless we have memory (since it would have no effect) + // Abort any pending executions + lock: function() { + locked = queue = []; + if ( !memory && !firing ) { + list = memory = ""; + } + return this; + }, + locked: function() { + return !!locked; + }, + + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( !locked ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + queue.push( args ); + if ( !firing ) { + fire(); + } + } + return this; + }, + + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + +function Identity( v ) { + return v; +} +function Thrower( ex ) { + throw ex; +} + +function adoptValue( value, resolve, reject, noValue ) { + var method; + + try { + + // Check for promise aspect first to privilege synchronous behavior + if ( value && jQuery.isFunction( ( method = value.promise ) ) ) { + method.call( value ).done( resolve ).fail( reject ); + + // Other thenables + } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) { + method.call( value, resolve, reject ); + + // Other non-thenables + } else { + + // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: + // * false: [ value ].slice( 0 ) => resolve( value ) + // * true: [ value ].slice( 1 ) => resolve() + resolve.apply( undefined, [ value ].slice( noValue ) ); + } + + // For Promises/A+, convert exceptions into rejections + // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in + // Deferred#then to conditionally suppress rejection. + } catch ( value ) { + + // Support: Android 4.0 only + // Strict mode functions invoked without .call/.apply get global-object context + reject.apply( undefined, [ value ] ); + } +} + +jQuery.extend( { + + Deferred: function( func ) { + var tuples = [ + + // action, add listener, callbacks, + // ... .then handlers, argument index, [final state] + [ "notify", "progress", jQuery.Callbacks( "memory" ), + jQuery.Callbacks( "memory" ), 2 ], + [ "resolve", "done", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 0, "resolved" ], + [ "reject", "fail", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 1, "rejected" ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + "catch": function( fn ) { + return promise.then( null, fn ); + }, + + // Keep pipe for back-compat + pipe: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + + return jQuery.Deferred( function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + + // Map tuples (progress, done, fail) to arguments (done, fail, progress) + var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; + + // deferred.progress(function() { bind to newDefer or newDefer.notify }) + // deferred.done(function() { bind to newDefer or newDefer.resolve }) + // deferred.fail(function() { bind to newDefer or newDefer.reject }) + deferred[ tuple[ 1 ] ]( function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .progress( newDefer.notify ) + .done( newDefer.resolve ) + .fail( newDefer.reject ); + } else { + newDefer[ tuple[ 0 ] + "With" ]( + this, + fn ? [ returned ] : arguments + ); + } + } ); + } ); + fns = null; + } ).promise(); + }, + then: function( onFulfilled, onRejected, onProgress ) { + var maxDepth = 0; + function resolve( depth, deferred, handler, special ) { + return function() { + var that = this, + args = arguments, + mightThrow = function() { + var returned, then; + + // Support: Promises/A+ section 2.3.3.3.3 + // https://promisesaplus.com/#point-59 + // Ignore double-resolution attempts + if ( depth < maxDepth ) { + return; + } + + returned = handler.apply( that, args ); + + // Support: Promises/A+ section 2.3.1 + // https://promisesaplus.com/#point-48 + if ( returned === deferred.promise() ) { + throw new TypeError( "Thenable self-resolution" ); + } + + // Support: Promises/A+ sections 2.3.3.1, 3.5 + // https://promisesaplus.com/#point-54 + // https://promisesaplus.com/#point-75 + // Retrieve `then` only once + then = returned && + + // Support: Promises/A+ section 2.3.4 + // https://promisesaplus.com/#point-64 + // Only check objects and functions for thenability + ( typeof returned === "object" || + typeof returned === "function" ) && + returned.then; + + // Handle a returned thenable + if ( jQuery.isFunction( then ) ) { + + // Special processors (notify) just wait for resolution + if ( special ) { + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ) + ); + + // Normal processors (resolve) also hook into progress + } else { + + // ...and disregard older resolution values + maxDepth++; + + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ), + resolve( maxDepth, deferred, Identity, + deferred.notifyWith ) + ); + } + + // Handle all other returned values + } else { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Identity ) { + that = undefined; + args = [ returned ]; + } + + // Process the value(s) + // Default process is resolve + ( special || deferred.resolveWith )( that, args ); + } + }, + + // Only normal processors (resolve) catch and reject exceptions + process = special ? + mightThrow : + function() { + try { + mightThrow(); + } catch ( e ) { + + if ( jQuery.Deferred.exceptionHook ) { + jQuery.Deferred.exceptionHook( e, + process.stackTrace ); + } + + // Support: Promises/A+ section 2.3.3.3.4.1 + // https://promisesaplus.com/#point-61 + // Ignore post-resolution exceptions + if ( depth + 1 >= maxDepth ) { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Thrower ) { + that = undefined; + args = [ e ]; + } + + deferred.rejectWith( that, args ); + } + } + }; + + // Support: Promises/A+ section 2.3.3.3.1 + // https://promisesaplus.com/#point-57 + // Re-resolve promises immediately to dodge false rejection from + // subsequent errors + if ( depth ) { + process(); + } else { + + // Call an optional hook to record the stack, in case of exception + // since it's otherwise lost when execution goes async + if ( jQuery.Deferred.getStackHook ) { + process.stackTrace = jQuery.Deferred.getStackHook(); + } + window.setTimeout( process ); + } + }; + } + + return jQuery.Deferred( function( newDefer ) { + + // progress_handlers.add( ... ) + tuples[ 0 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onProgress ) ? + onProgress : + Identity, + newDefer.notifyWith + ) + ); + + // fulfilled_handlers.add( ... ) + tuples[ 1 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onFulfilled ) ? + onFulfilled : + Identity + ) + ); + + // rejected_handlers.add( ... ) + tuples[ 2 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onRejected ) ? + onRejected : + Thrower + ) + ); + } ).promise(); + }, + + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 5 ]; + + // promise.progress = list.add + // promise.done = list.add + // promise.fail = list.add + promise[ tuple[ 1 ] ] = list.add; + + // Handle state + if ( stateString ) { + list.add( + function() { + + // state = "resolved" (i.e., fulfilled) + // state = "rejected" + state = stateString; + }, + + // rejected_callbacks.disable + // fulfilled_callbacks.disable + tuples[ 3 - i ][ 2 ].disable, + + // progress_callbacks.lock + tuples[ 0 ][ 2 ].lock + ); + } + + // progress_handlers.fire + // fulfilled_handlers.fire + // rejected_handlers.fire + list.add( tuple[ 3 ].fire ); + + // deferred.notify = function() { deferred.notifyWith(...) } + // deferred.resolve = function() { deferred.resolveWith(...) } + // deferred.reject = function() { deferred.rejectWith(...) } + deferred[ tuple[ 0 ] ] = function() { + deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); + return this; + }; + + // deferred.notifyWith = list.fireWith + // deferred.resolveWith = list.fireWith + // deferred.rejectWith = list.fireWith + deferred[ tuple[ 0 ] + "With" ] = list.fireWith; + } ); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( singleValue ) { + var + + // count of uncompleted subordinates + remaining = arguments.length, + + // count of unprocessed arguments + i = remaining, + + // subordinate fulfillment data + resolveContexts = Array( i ), + resolveValues = slice.call( arguments ), + + // the master Deferred + master = jQuery.Deferred(), + + // subordinate callback factory + updateFunc = function( i ) { + return function( value ) { + resolveContexts[ i ] = this; + resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( !( --remaining ) ) { + master.resolveWith( resolveContexts, resolveValues ); + } + }; + }; + + // Single- and empty arguments are adopted like Promise.resolve + if ( remaining <= 1 ) { + adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, + !remaining ); + + // Use .then() to unwrap secondary thenables (cf. gh-3000) + if ( master.state() === "pending" || + jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { + + return master.then(); + } + } + + // Multiple arguments are aggregated like Promise.all array elements + while ( i-- ) { + adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); + } + + return master.promise(); + } +} ); + + +// These usually indicate a programmer mistake during development, +// warn about them ASAP rather than swallowing them by default. +var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; + +jQuery.Deferred.exceptionHook = function( error, stack ) { + + // Support: IE 8 - 9 only + // Console exists when dev tools are open, which can happen at any time + if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { + window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); + } +}; + + + + +jQuery.readyException = function( error ) { + window.setTimeout( function() { + throw error; + } ); +}; + + + + +// The deferred used on DOM ready +var readyList = jQuery.Deferred(); + +jQuery.fn.ready = function( fn ) { + + readyList + .then( fn ) + + // Wrap jQuery.readyException in a function so that the lookup + // happens at the time of error handling instead of callback + // registration. + .catch( function( error ) { + jQuery.readyException( error ); + } ); + + return this; +}; + +jQuery.extend( { + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + } +} ); + +jQuery.ready.then = readyList.then; + +// The ready event handler and self cleanup method +function completed() { + document.removeEventListener( "DOMContentLoaded", completed ); + window.removeEventListener( "load", completed ); + jQuery.ready(); +} + +// Catch cases where $(document).ready() is called +// after the browser event has already occurred. +// Support: IE <=9 - 10 only +// Older IE sometimes signals "interactive" too soon +if ( document.readyState === "complete" || + ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { + + // Handle it asynchronously to allow scripts the opportunity to delay ready + window.setTimeout( jQuery.ready ); + +} else { + + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed ); +} + + + + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + len = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + access( elems, fn, i, key[ i ], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < len; i++ ) { + fn( + elems[ i ], key, raw ? + value : + value.call( elems[ i ], i, fn( elems[ i ], key ) ) + ); + } + } + } + + if ( chainable ) { + return elems; + } + + // Gets + if ( bulk ) { + return fn.call( elems ); + } + + return len ? fn( elems[ 0 ], key ) : emptyGet; +}; +var acceptData = function( owner ) { + + // Accepts only: + // - Node + // - Node.ELEMENT_NODE + // - Node.DOCUMENT_NODE + // - Object + // - Any + return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); +}; + + + + +function Data() { + this.expando = jQuery.expando + Data.uid++; +} + +Data.uid = 1; + +Data.prototype = { + + cache: function( owner ) { + + // Check if the owner object already has a cache + var value = owner[ this.expando ]; + + // If not, create one + if ( !value ) { + value = {}; + + // We can accept data for non-element nodes in modern browsers, + // but we should not, see #8335. + // Always return an empty object. + if ( acceptData( owner ) ) { + + // If it is a node unlikely to be stringify-ed or looped over + // use plain assignment + if ( owner.nodeType ) { + owner[ this.expando ] = value; + + // Otherwise secure it in a non-enumerable property + // configurable must be true to allow the property to be + // deleted when data is removed + } else { + Object.defineProperty( owner, this.expando, { + value: value, + configurable: true + } ); + } + } + } + + return value; + }, + set: function( owner, data, value ) { + var prop, + cache = this.cache( owner ); + + // Handle: [ owner, key, value ] args + // Always use camelCase key (gh-2257) + if ( typeof data === "string" ) { + cache[ jQuery.camelCase( data ) ] = value; + + // Handle: [ owner, { properties } ] args + } else { + + // Copy the properties one-by-one to the cache object + for ( prop in data ) { + cache[ jQuery.camelCase( prop ) ] = data[ prop ]; + } + } + return cache; + }, + get: function( owner, key ) { + return key === undefined ? + this.cache( owner ) : + + // Always use camelCase key (gh-2257) + owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ]; + }, + access: function( owner, key, value ) { + + // In cases where either: + // + // 1. No key was specified + // 2. A string key was specified, but no value provided + // + // Take the "read" path and allow the get method to determine + // which value to return, respectively either: + // + // 1. The entire cache object + // 2. The data stored at the key + // + if ( key === undefined || + ( ( key && typeof key === "string" ) && value === undefined ) ) { + + return this.get( owner, key ); + } + + // When the key is not a string, or both a key and value + // are specified, set or extend (existing objects) with either: + // + // 1. An object of properties + // 2. A key and value + // + this.set( owner, key, value ); + + // Since the "set" path can have two possible entry points + // return the expected data based on which path was taken[*] + return value !== undefined ? value : key; + }, + remove: function( owner, key ) { + var i, + cache = owner[ this.expando ]; + + if ( cache === undefined ) { + return; + } + + if ( key !== undefined ) { + + // Support array or space separated string of keys + if ( Array.isArray( key ) ) { + + // If key is an array of keys... + // We always set camelCase keys, so remove that. + key = key.map( jQuery.camelCase ); + } else { + key = jQuery.camelCase( key ); + + // If a key with the spaces exists, use it. + // Otherwise, create an array by matching non-whitespace + key = key in cache ? + [ key ] : + ( key.match( rnothtmlwhite ) || [] ); + } + + i = key.length; + + while ( i-- ) { + delete cache[ key[ i ] ]; + } + } + + // Remove the expando if there's no more data + if ( key === undefined || jQuery.isEmptyObject( cache ) ) { + + // Support: Chrome <=35 - 45 + // Webkit & Blink performance suffers when deleting properties + // from DOM nodes, so set to undefined instead + // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) + if ( owner.nodeType ) { + owner[ this.expando ] = undefined; + } else { + delete owner[ this.expando ]; + } + } + }, + hasData: function( owner ) { + var cache = owner[ this.expando ]; + return cache !== undefined && !jQuery.isEmptyObject( cache ); + } +}; +var dataPriv = new Data(); + +var dataUser = new Data(); + + + +// Implementation Summary +// +// 1. Enforce API surface and semantic compatibility with 1.9.x branch +// 2. Improve the module's maintainability by reducing the storage +// paths to a single mechanism. +// 3. Use the same single mechanism to support "private" and "user" data. +// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) +// 5. Avoid exposing implementation details on user objects (eg. expando properties) +// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 + +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /[A-Z]/g; + +function getData( data ) { + if ( data === "true" ) { + return true; + } + + if ( data === "false" ) { + return false; + } + + if ( data === "null" ) { + return null; + } + + // Only convert to a number if it doesn't change the string + if ( data === +data + "" ) { + return +data; + } + + if ( rbrace.test( data ) ) { + return JSON.parse( data ); + } + + return data; +} + +function dataAttr( elem, key, data ) { + var name; + + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = getData( data ); + } catch ( e ) {} + + // Make sure we set the data so it isn't changed later + dataUser.set( elem, key, data ); + } else { + data = undefined; + } + } + return data; +} + +jQuery.extend( { + hasData: function( elem ) { + return dataUser.hasData( elem ) || dataPriv.hasData( elem ); + }, + + data: function( elem, name, data ) { + return dataUser.access( elem, name, data ); + }, + + removeData: function( elem, name ) { + dataUser.remove( elem, name ); + }, + + // TODO: Now that all calls to _data and _removeData have been replaced + // with direct calls to dataPriv methods, these can be deprecated. + _data: function( elem, name, data ) { + return dataPriv.access( elem, name, data ); + }, + + _removeData: function( elem, name ) { + dataPriv.remove( elem, name ); + } +} ); + +jQuery.fn.extend( { + data: function( key, value ) { + var i, name, data, + elem = this[ 0 ], + attrs = elem && elem.attributes; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = dataUser.get( elem ); + + if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { + i = attrs.length; + while ( i-- ) { + + // Support: IE 11 only + // The attrs elements can be null (#14894) + if ( attrs[ i ] ) { + name = attrs[ i ].name; + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.slice( 5 ) ); + dataAttr( elem, name, data[ name ] ); + } + } + } + dataPriv.set( elem, "hasDataAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each( function() { + dataUser.set( this, key ); + } ); + } + + return access( this, function( value ) { + var data; + + // The calling jQuery object (element matches) is not empty + // (and therefore has an element appears at this[ 0 ]) and the + // `value` parameter was not undefined. An empty jQuery object + // will result in `undefined` for elem = this[ 0 ] which will + // throw an exception if an attempt to read a data cache is made. + if ( elem && value === undefined ) { + + // Attempt to get data from the cache + // The key will always be camelCased in Data + data = dataUser.get( elem, key ); + if ( data !== undefined ) { + return data; + } + + // Attempt to "discover" the data in + // HTML5 custom data-* attrs + data = dataAttr( elem, key ); + if ( data !== undefined ) { + return data; + } + + // We tried really hard, but the data doesn't exist. + return; + } + + // Set the data... + this.each( function() { + + // We always store the camelCased key + dataUser.set( this, key, value ); + } ); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each( function() { + dataUser.remove( this, key ); + } ); + } +} ); + + +jQuery.extend( { + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = dataPriv.get( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || Array.isArray( data ) ) { + queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // Clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // Not public - generate a queueHooks object, or return the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { + empty: jQuery.Callbacks( "once memory" ).add( function() { + dataPriv.remove( elem, [ type + "queue", key ] ); + } ) + } ); + } +} ); + +jQuery.fn.extend( { + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[ 0 ], type ); + } + + return data === undefined ? + this : + this.each( function() { + var queue = jQuery.queue( this, type, data ); + + // Ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + } ); + }, + dequeue: function( type ) { + return this.each( function() { + jQuery.dequeue( this, type ); + } ); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while ( i-- ) { + tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +} ); +var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; + +var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); + + +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +var isHiddenWithinTree = function( elem, el ) { + + // isHiddenWithinTree might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + + // Inline style trumps all + return elem.style.display === "none" || + elem.style.display === "" && + + // Otherwise, check computed style + // Support: Firefox <=43 - 45 + // Disconnected elements can have computed display: none, so first confirm that elem is + // in the document. + jQuery.contains( elem.ownerDocument, elem ) && + + jQuery.css( elem, "display" ) === "none"; + }; + +var swap = function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; +}; + + + + +function adjustCSS( elem, prop, valueParts, tween ) { + var adjusted, + scale = 1, + maxIterations = 20, + currentValue = tween ? + function() { + return tween.cur(); + } : + function() { + return jQuery.css( elem, prop, "" ); + }, + initial = currentValue(), + unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), + + // Starting value computation is required for potential unit mismatches + initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && + rcssNum.exec( jQuery.css( elem, prop ) ); + + if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { + + // Trust units reported by jQuery.css + unit = unit || initialInUnit[ 3 ]; + + // Make sure we update the tween properties later on + valueParts = valueParts || []; + + // Iteratively approximate from a nonzero starting point + initialInUnit = +initial || 1; + + do { + + // If previous iteration zeroed out, double until we get *something*. + // Use string for doubling so we don't accidentally see scale as unchanged below + scale = scale || ".5"; + + // Adjust and apply + initialInUnit = initialInUnit / scale; + jQuery.style( elem, prop, initialInUnit + unit ); + + // Update scale, tolerating zero or NaN from tween.cur() + // Break the loop if scale is unchanged or perfect, or if we've just had enough. + } while ( + scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations + ); + } + + if ( valueParts ) { + initialInUnit = +initialInUnit || +initial || 0; + + // Apply relative offset (+=/-=) if specified + adjusted = valueParts[ 1 ] ? + initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : + +valueParts[ 2 ]; + if ( tween ) { + tween.unit = unit; + tween.start = initialInUnit; + tween.end = adjusted; + } + } + return adjusted; +} + + +var defaultDisplayMap = {}; + +function getDefaultDisplay( elem ) { + var temp, + doc = elem.ownerDocument, + nodeName = elem.nodeName, + display = defaultDisplayMap[ nodeName ]; + + if ( display ) { + return display; + } + + temp = doc.body.appendChild( doc.createElement( nodeName ) ); + display = jQuery.css( temp, "display" ); + + temp.parentNode.removeChild( temp ); + + if ( display === "none" ) { + display = "block"; + } + defaultDisplayMap[ nodeName ] = display; + + return display; +} + +function showHide( elements, show ) { + var display, elem, + values = [], + index = 0, + length = elements.length; + + // Determine new display value for elements that need to change + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + display = elem.style.display; + if ( show ) { + + // Since we force visibility upon cascade-hidden elements, an immediate (and slow) + // check is required in this first loop unless we have a nonempty display value (either + // inline or about-to-be-restored) + if ( display === "none" ) { + values[ index ] = dataPriv.get( elem, "display" ) || null; + if ( !values[ index ] ) { + elem.style.display = ""; + } + } + if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { + values[ index ] = getDefaultDisplay( elem ); + } + } else { + if ( display !== "none" ) { + values[ index ] = "none"; + + // Remember what we're overwriting + dataPriv.set( elem, "display", display ); + } + } + } + + // Set the display of the elements in a second loop to avoid constant reflow + for ( index = 0; index < length; index++ ) { + if ( values[ index ] != null ) { + elements[ index ].style.display = values[ index ]; + } + } + + return elements; +} + +jQuery.fn.extend( { + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + if ( typeof state === "boolean" ) { + return state ? this.show() : this.hide(); + } + + return this.each( function() { + if ( isHiddenWithinTree( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + } ); + } +} ); +var rcheckableType = ( /^(?:checkbox|radio)$/i ); + +var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); + +var rscriptType = ( /^$|\/(?:java|ecma)script/i ); + + + +// We have to close these tags to support XHTML (#13200) +var wrapMap = { + + // Support: IE <=9 only + option: [ 1, "<select multiple='multiple'>", "</select>" ], + + // XHTML parsers do not magically insert elements in the + // same way that tag soup parsers do. So we cannot shorten + // this by omitting <tbody> or other required elements. + thead: [ 1, "<table>", "</table>" ], + col: [ 2, "<table><colgroup>", "</colgroup></table>" ], + tr: [ 2, "<table><tbody>", "</tbody></table>" ], + td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], + + _default: [ 0, "", "" ] +}; + +// Support: IE <=9 only +wrapMap.optgroup = wrapMap.option; + +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + + +function getAll( context, tag ) { + + // Support: IE <=9 - 11 only + // Use typeof to avoid zero-argument method invocation on host objects (#15151) + var ret; + + if ( typeof context.getElementsByTagName !== "undefined" ) { + ret = context.getElementsByTagName( tag || "*" ); + + } else if ( typeof context.querySelectorAll !== "undefined" ) { + ret = context.querySelectorAll( tag || "*" ); + + } else { + ret = []; + } + + if ( tag === undefined || tag && nodeName( context, tag ) ) { + return jQuery.merge( [ context ], ret ); + } + + return ret; +} + + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + dataPriv.set( + elems[ i ], + "globalEval", + !refElements || dataPriv.get( refElements[ i ], "globalEval" ) + ); + } +} + + +var rhtml = /<|&#?\w+;/; + +function buildFragment( elems, context, scripts, selection, ignored ) { + var elem, tmp, tag, wrap, contains, j, + fragment = context.createDocumentFragment(), + nodes = [], + i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; + + // Descend through wrappers to the right content + j = wrap[ 0 ]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, tmp.childNodes ); + + // Remember the top-level container + tmp = fragment.firstChild; + + // Ensure the created nodes are orphaned (#12392) + tmp.textContent = ""; + } + } + } + + // Remove wrapper from fragment + fragment.textContent = ""; + + i = 0; + while ( ( elem = nodes[ i++ ] ) ) { + + // Skip elements already in the context collection (trac-4087) + if ( selection && jQuery.inArray( elem, selection ) > -1 ) { + if ( ignored ) { + ignored.push( elem ); + } + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( fragment.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( ( elem = tmp[ j++ ] ) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + return fragment; +} + + +( function() { + var fragment = document.createDocumentFragment(), + div = fragment.appendChild( document.createElement( "div" ) ), + input = document.createElement( "input" ); + + // Support: Android 4.0 - 4.3 only + // Check state lost if the name is set (#11217) + // Support: Windows Web Apps (WWA) + // `name` and `type` must use .setAttribute for WWA (#14901) + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + + // Support: Android <=4.1 only + // Older WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE <=11 only + // Make sure textarea (and checkbox) defaultValue is properly cloned + div.innerHTML = "<textarea>x</textarea>"; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; +} )(); +var documentElement = document.documentElement; + + + +var + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +// Support: IE <=9 only +// See #13393 for more info +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +function on( elem, types, selector, data, fn, one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + on( elem, type, selector, data, types[ type ], one ); + } + return elem; + } + + if ( data == null && fn == null ) { + + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return elem; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return elem.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + } ); +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + + var handleObjIn, eventHandle, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.get( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Ensure that invalid selectors throw exceptions at attach time + // Evaluate against documentElement in case elem is a non-element node (e.g., document) + if ( selector ) { + jQuery.find.matchesSelector( documentElement, selector ); + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !( events = elemData.events ) ) { + events = elemData.events = {}; + } + if ( !( eventHandle = elemData.handle ) ) { + eventHandle = elemData.handle = function( e ) { + + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? + jQuery.event.dispatch.apply( elem, arguments ) : undefined; + }; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend( { + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join( "." ) + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !( handlers = events[ type ] ) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener if the special events handler returns false + if ( !special.setup || + special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var j, origCount, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); + + if ( !elemData || !( events = elemData.events ) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[ 2 ] && + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || + selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || + special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove data and the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + dataPriv.remove( elem, "handle events" ); + } + }, + + dispatch: function( nativeEvent ) { + + // Make a writable jQuery.Event from the native event object + var event = jQuery.event.fix( nativeEvent ); + + var i, j, ret, matched, handleObj, handlerQueue, + args = new Array( arguments.length ), + handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[ 0 ] = event; + + for ( i = 1; i < arguments.length; i++ ) { + args[ i ] = arguments[ i ]; + } + + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( ( handleObj = matched.handlers[ j++ ] ) && + !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or 2) have namespace(s) + // a subset or equal to those in the bound event (both can have no namespace). + if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || + handleObj.handler ).apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( ( event.result = ret ) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, handleObj, sel, matchedHandlers, matchedSelectors, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + if ( delegateCount && + + // Support: IE <=9 + // Black-hole SVG <use> instance trees (trac-13180) + cur.nodeType && + + // Support: Firefox <=42 + // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) + // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click + // Support: IE 11 only + // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) + !( event.type === "click" && event.button >= 1 ) ) { + + for ( ; cur !== this; cur = cur.parentNode || this ) { + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { + matchedHandlers = []; + matchedSelectors = {}; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matchedSelectors[ sel ] === undefined ) { + matchedSelectors[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) > -1 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matchedSelectors[ sel ] ) { + matchedHandlers.push( handleObj ); + } + } + if ( matchedHandlers.length ) { + handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); + } + } + } + } + + // Add the remaining (directly-bound) handlers + cur = this; + if ( delegateCount < handlers.length ) { + handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); + } + + return handlerQueue; + }, + + addProp: function( name, hook ) { + Object.defineProperty( jQuery.Event.prototype, name, { + enumerable: true, + configurable: true, + + get: jQuery.isFunction( hook ) ? + function() { + if ( this.originalEvent ) { + return hook( this.originalEvent ); + } + } : + function() { + if ( this.originalEvent ) { + return this.originalEvent[ name ]; + } + }, + + set: function( value ) { + Object.defineProperty( this, name, { + enumerable: true, + configurable: true, + writable: true, + value: value + } ); + } + } ); + }, + + fix: function( originalEvent ) { + return originalEvent[ jQuery.expando ] ? + originalEvent : + new jQuery.Event( originalEvent ); + }, + + special: { + load: { + + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + this.focus(); + return false; + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + click: { + + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + } +}; + +jQuery.removeEvent = function( elem, type, handle ) { + + // This "if" is needed for plain objects + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle ); + } +}; + +jQuery.Event = function( src, props ) { + + // Allow instantiation without the 'new' keyword + if ( !( this instanceof jQuery.Event ) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + + // Support: Android <=2.3 only + src.returnValue === false ? + returnTrue : + returnFalse; + + // Create target properties + // Support: Safari <=6 - 7 only + // Target should not be a text node (#504, #13143) + this.target = ( src.target && src.target.nodeType === 3 ) ? + src.target.parentNode : + src.target; + + this.currentTarget = src.currentTarget; + this.relatedTarget = src.relatedTarget; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + constructor: jQuery.Event, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + isSimulated: false, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + + if ( e && !this.isSimulated ) { + e.preventDefault(); + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopPropagation(); + } + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Includes all common event props including KeyEvent and MouseEvent specific props +jQuery.each( { + altKey: true, + bubbles: true, + cancelable: true, + changedTouches: true, + ctrlKey: true, + detail: true, + eventPhase: true, + metaKey: true, + pageX: true, + pageY: true, + shiftKey: true, + view: true, + "char": true, + charCode: true, + key: true, + keyCode: true, + button: true, + buttons: true, + clientX: true, + clientY: true, + offsetX: true, + offsetY: true, + pointerId: true, + pointerType: true, + screenX: true, + screenY: true, + targetTouches: true, + toElement: true, + touches: true, + + which: function( event ) { + var button = event.button; + + // Add which for key events + if ( event.which == null && rkeyEvent.test( event.type ) ) { + return event.charCode != null ? event.charCode : event.keyCode; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { + if ( button & 1 ) { + return 1; + } + + if ( button & 2 ) { + return 3; + } + + if ( button & 4 ) { + return 2; + } + + return 0; + } + + return event.which; + } +}, jQuery.event.addProp ); + +// Create mouseenter/leave events using mouseover/out and event-time checks +// so that event delegation works in jQuery. +// Do the same for pointerenter/pointerleave and pointerover/pointerout +// +// Support: Safari 7 only +// Safari sends mouseenter too often; see: +// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 +// for the description of the bug (it existed in older Chrome versions as well). +jQuery.each( { + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mouseenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +} ); + +jQuery.fn.extend( { + + on: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn ); + }, + one: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? + handleObj.origType + "." + handleObj.namespace : + handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each( function() { + jQuery.event.remove( this, types, fn, selector ); + } ); + } +} ); + + +var + + /* eslint-disable max-len */ + + // See https://github.com/eslint/eslint/issues/3229 + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, + + /* eslint-enable */ + + // Support: IE <=10 - 11, Edge 12 - 13 + // In IE/Edge using regex groups here causes severe slowdowns. + // See https://connect.microsoft.com/IE/feedback/details/1736512/ + rnoInnerhtml = /<script|<style|<link/i, + + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptTypeMasked = /^true\/(.*)/, + rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; + +// Prefer a tbody over its parent table for containing new rows +function manipulationTarget( elem, content ) { + if ( nodeName( elem, "table" ) && + nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { + + return jQuery( ">tbody", elem )[ 0 ] || elem; + } + + return elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + + if ( match ) { + elem.type = match[ 1 ]; + } else { + elem.removeAttribute( "type" ); + } + + return elem; +} + +function cloneCopyEvent( src, dest ) { + var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; + + if ( dest.nodeType !== 1 ) { + return; + } + + // 1. Copy private data: events, handlers, etc. + if ( dataPriv.hasData( src ) ) { + pdataOld = dataPriv.access( src ); + pdataCur = dataPriv.set( dest, pdataOld ); + events = pdataOld.events; + + if ( events ) { + delete pdataCur.handle; + pdataCur.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + } + + // 2. Copy user data + if ( dataUser.hasData( src ) ) { + udataOld = dataUser.access( src ); + udataCur = jQuery.extend( {}, udataOld ); + + dataUser.set( dest, udataCur ); + } +} + +// Fix IE bugs, see support tests +function fixInput( src, dest ) { + var nodeName = dest.nodeName.toLowerCase(); + + // Fails to persist the checked state of a cloned checkbox or radio button. + if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + dest.checked = src.checked; + + // Fails to return the selected option to the default selected state when cloning options + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +function domManip( collection, args, callback, ignored ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = collection.length, + iNoClone = l - 1, + value = args[ 0 ], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return collection.each( function( index ) { + var self = collection.eq( index ); + if ( isFunction ) { + args[ 0 ] = value.call( this, index, self.html() ); + } + domManip( self, args, callback, ignored ); + } ); + } + + if ( l ) { + fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + // Require either new content or an interest in ignored elements to invoke the callback + if ( first || ignored ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item + // instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( collection[ i ], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !dataPriv.access( node, "globalEval" ) && + jQuery.contains( doc, node ) ) { + + if ( node.src ) { + + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); + } + } + } + } + } + } + + return collection; +} + +function remove( elem, selector, keepData ) { + var node, + nodes = selector ? jQuery.filter( selector, elem ) : elem, + i = 0; + + for ( ; ( node = nodes[ i ] ) != null; i++ ) { + if ( !keepData && node.nodeType === 1 ) { + jQuery.cleanData( getAll( node ) ); + } + + if ( node.parentNode ) { + if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { + setGlobalEval( getAll( node, "script" ) ); + } + node.parentNode.removeChild( node ); + } + } + + return elem; +} + +jQuery.extend( { + htmlPrefilter: function( html ) { + return html.replace( rxhtmlTag, "<$1></$2>" ); + }, + + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var i, l, srcElements, destElements, + clone = elem.cloneNode( true ), + inPage = jQuery.contains( elem.ownerDocument, elem ); + + // Fix IE cloning issues + if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && + !jQuery.isXMLDoc( elem ) ) { + + // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + fixInput( srcElements[ i ], destElements[ i ] ); + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + cloneCopyEvent( srcElements[ i ], destElements[ i ] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + // Return the cloned set + return clone; + }, + + cleanData: function( elems ) { + var data, elem, type, + special = jQuery.event.special, + i = 0; + + for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { + if ( acceptData( elem ) ) { + if ( ( data = elem[ dataPriv.expando ] ) ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataPriv.expando ] = undefined; + } + if ( elem[ dataUser.expando ] ) { + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataUser.expando ] = undefined; + } + } + } + } +} ); + +jQuery.fn.extend( { + detach: function( selector ) { + return remove( this, selector, true ); + }, + + remove: function( selector ) { + return remove( this, selector ); + }, + + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().each( function() { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.textContent = value; + } + } ); + }, null, value, arguments.length ); + }, + + append: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + } ); + }, + + prepend: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + } ); + }, + + before: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + } ); + }, + + after: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + } ); + }, + + empty: function() { + var elem, + i = 0; + + for ( ; ( elem = this[ i ] ) != null; i++ ) { + if ( elem.nodeType === 1 ) { + + // Prevent memory leaks + jQuery.cleanData( getAll( elem, false ) ); + + // Remove any remaining nodes + elem.textContent = ""; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + } ); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined && elem.nodeType === 1 ) { + return elem.innerHTML; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { + + value = jQuery.htmlPrefilter( value ); + + try { + for ( ; i < l; i++ ) { + elem = this[ i ] || {}; + + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch ( e ) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var ignored = []; + + // Make the changes, replacing each non-ignored context element with the new content + return domManip( this, arguments, function( elem ) { + var parent = this.parentNode; + + if ( jQuery.inArray( this, ignored ) < 0 ) { + jQuery.cleanData( getAll( this ) ); + if ( parent ) { + parent.replaceChild( elem, this ); + } + } + + // Force callback invocation + }, ignored ); + } +} ); + +jQuery.each( { + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1, + i = 0; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone( true ); + jQuery( insert[ i ] )[ original ]( elems ); + + // Support: Android <=4.0 only, PhantomJS 1 only + // .get() because push.apply(_, arraylike) throws on ancient WebKit + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +} ); +var rmargin = ( /^margin/ ); + +var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); + +var getStyles = function( elem ) { + + // Support: IE <=11 only, Firefox <=30 (#15098, #14150) + // IE throws on elements created in popups + // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" + var view = elem.ownerDocument.defaultView; + + if ( !view || !view.opener ) { + view = window; + } + + return view.getComputedStyle( elem ); + }; + + + +( function() { + + // Executing both pixelPosition & boxSizingReliable tests require only one layout + // so they're executed at the same time to save the second computation. + function computeStyleTests() { + + // This is a singleton, we need to execute it only once + if ( !div ) { + return; + } + + div.style.cssText = + "box-sizing:border-box;" + + "position:relative;display:block;" + + "margin:auto;border:1px;padding:1px;" + + "top:1%;width:50%"; + div.innerHTML = ""; + documentElement.appendChild( container ); + + var divStyle = window.getComputedStyle( div ); + pixelPositionVal = divStyle.top !== "1%"; + + // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 + reliableMarginLeftVal = divStyle.marginLeft === "2px"; + boxSizingReliableVal = divStyle.width === "4px"; + + // Support: Android 4.0 - 4.3 only + // Some styles come back with percentage values, even though they shouldn't + div.style.marginRight = "50%"; + pixelMarginRightVal = divStyle.marginRight === "4px"; + + documentElement.removeChild( container ); + + // Nullify the div so it wouldn't be stored in the memory and + // it will also be a sign that checks already performed + div = null; + } + + var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, + container = document.createElement( "div" ), + div = document.createElement( "div" ); + + // Finish early in limited (non-browser) environments + if ( !div.style ) { + return; + } + + // Support: IE <=9 - 11 only + // Style of cloned element affects source element cloned (#8908) + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + + "padding:0;margin-top:1px;position:absolute"; + container.appendChild( div ); + + jQuery.extend( support, { + pixelPosition: function() { + computeStyleTests(); + return pixelPositionVal; + }, + boxSizingReliable: function() { + computeStyleTests(); + return boxSizingReliableVal; + }, + pixelMarginRight: function() { + computeStyleTests(); + return pixelMarginRightVal; + }, + reliableMarginLeft: function() { + computeStyleTests(); + return reliableMarginLeftVal; + } + } ); +} )(); + + +function curCSS( elem, name, computed ) { + var width, minWidth, maxWidth, ret, + + // Support: Firefox 51+ + // Retrieving style before computed somehow + // fixes an issue with getting wrong values + // on detached elements + style = elem.style; + + computed = computed || getStyles( elem ); + + // getPropertyValue is needed for: + // .css('filter') (IE 9 only, #12537) + // .css('--customProperty) (#3144) + if ( computed ) { + ret = computed.getPropertyValue( name ) || computed[ name ]; + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Android Browser returns percentage for some values, + // but width seems to be reliably pixels. + // This is against the CSSOM draft spec: + // https://drafts.csswg.org/cssom/#resolved-values + if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret !== undefined ? + + // Support: IE <=9 - 11 only + // IE returns zIndex value as an integer. + ret + "" : + ret; +} + + +function addGetHookIf( conditionFn, hookFn ) { + + // Define the hook, we'll check on the first run if it's really needed. + return { + get: function() { + if ( conditionFn() ) { + + // Hook not needed (or it's not possible to use it due + // to missing dependency), remove it. + delete this.get; + return; + } + + // Hook needed; redefine it so that the support test is not executed again. + return ( this.get = hookFn ).apply( this, arguments ); + } + }; +} + + +var + + // Swappable if display is none or starts with table + // except "table", "table-cell", or "table-caption" + // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rcustomProp = /^--/, + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: "0", + fontWeight: "400" + }, + + cssPrefixes = [ "Webkit", "Moz", "ms" ], + emptyStyle = document.createElement( "div" ).style; + +// Return a css property mapped to a potentially vendor prefixed property +function vendorPropName( name ) { + + // Shortcut for names that are not vendor prefixed + if ( name in emptyStyle ) { + return name; + } + + // Check for vendor prefixed names + var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in emptyStyle ) { + return name; + } + } +} + +// Return a property mapped along what jQuery.cssProps suggests or to +// a vendor prefixed property. +function finalPropName( name ) { + var ret = jQuery.cssProps[ name ]; + if ( !ret ) { + ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; + } + return ret; +} + +function setPositiveNumber( elem, value, subtract ) { + + // Any relative (+/-) values have already been + // normalized at this point + var matches = rcssNum.exec( value ); + return matches ? + + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i, + val = 0; + + // If we already have the right measurement, avoid augmentation + if ( extra === ( isBorderBox ? "border" : "content" ) ) { + i = 4; + + // Otherwise initialize for horizontal or vertical properties + } else { + i = name === "width" ? 1 : 0; + } + + for ( ; i < 4; i += 2 ) { + + // Both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + } + + if ( isBorderBox ) { + + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // At this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + + // At this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // At this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with computed style + var valueIsBorderBox, + styles = getStyles( elem ), + val = curCSS( elem, name, styles ), + isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test( val ) ) { + return val; + } + + // Check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && + ( support.boxSizingReliable() || val === elem.style[ name ] ); + + // Fall back to offsetWidth/Height when value is "auto" + // This happens for inline elements with no explicit setting (gh-3571) + if ( val === "auto" ) { + val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ]; + } + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + + // Use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +jQuery.extend( { + + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Don't automatically add "px" to these possibly-unitless properties + cssNumber: { + "animationIterationCount": true, + "columnCount": true, + "fillOpacity": true, + "flexGrow": true, + "flexShrink": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "order": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + "float": "cssFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + isCustomProp = rcustomProp.test( name ), + style = elem.style; + + // Make sure that we're working with the right name. We don't + // want to query the value if it is a CSS custom property + // since they are user-defined. + if ( !isCustomProp ) { + name = finalPropName( origName ); + } + + // Gets hook for the prefixed version, then unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // Convert "+=" or "-=" to relative numbers (#7345) + if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { + value = adjustCSS( elem, name, ret ); + + // Fixes bug #9237 + type = "number"; + } + + // Make sure that null and NaN values aren't set (#7116) + if ( value == null || value !== value ) { + return; + } + + // If a number was passed in, add the unit (except for certain CSS properties) + if ( type === "number" ) { + value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); + } + + // background-* props affect original clone's values + if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !( "set" in hooks ) || + ( value = hooks.set( elem, value, extra ) ) !== undefined ) { + + if ( isCustomProp ) { + style.setProperty( name, value ); + } else { + style[ name ] = value; + } + } + + } else { + + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && + ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { + + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var val, num, hooks, + origName = jQuery.camelCase( name ), + isCustomProp = rcustomProp.test( name ); + + // Make sure that we're working with the right name. We don't + // want to modify the value if it is a CSS custom property + // since they are user-defined. + if ( !isCustomProp ) { + name = finalPropName( origName ); + } + + // Try prefixed name followed by the unprefixed name + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + // Convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Make numeric if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || isFinite( num ) ? num || 0 : val; + } + + return val; + } +} ); + +jQuery.each( [ "height", "width" ], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + + // Certain elements can have dimension info if we invisibly show them + // but it must have a current display style that would benefit + return rdisplayswap.test( jQuery.css( elem, "display" ) ) && + + // Support: Safari 8+ + // Table columns in Safari have non-zero offsetWidth & zero + // getBoundingClientRect().width unless display is changed. + // Support: IE <=11 only + // Running getBoundingClientRect on a disconnected node + // in IE throws an error. + ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? + swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + } ) : + getWidthOrHeight( elem, name, extra ); + } + }, + + set: function( elem, value, extra ) { + var matches, + styles = extra && getStyles( elem ), + subtract = extra && augmentWidthOrHeight( + elem, + name, + extra, + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + styles + ); + + // Convert to pixels if value adjustment is needed + if ( subtract && ( matches = rcssNum.exec( value ) ) && + ( matches[ 3 ] || "px" ) !== "px" ) { + + elem.style[ name ] = value; + value = jQuery.css( elem, name ); + } + + return setPositiveNumber( elem, value, subtract ); + } + }; +} ); + +jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, + function( elem, computed ) { + if ( computed ) { + return ( parseFloat( curCSS( elem, "marginLeft" ) ) || + elem.getBoundingClientRect().left - + swap( elem, { marginLeft: 0 }, function() { + return elem.getBoundingClientRect().left; + } ) + ) + "px"; + } + } +); + +// These hooks are used by animate to expand properties +jQuery.each( { + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i = 0, + expanded = {}, + + // Assumes a single number if not a string + parts = typeof value === "string" ? value.split( " " ) : [ value ]; + + for ( ; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( !rmargin.test( prefix ) ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +} ); + +jQuery.fn.extend( { + css: function( name, value ) { + return access( this, function( elem, name, value ) { + var styles, len, + map = {}, + i = 0; + + if ( Array.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + } +} ); + + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || jQuery.easing._default; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + // Use a property on the element directly when it is not a DOM element, + // or when there is no matching style property that exists. + if ( tween.elem.nodeType !== 1 || + tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { + return tween.elem[ tween.prop ]; + } + + // Passing an empty string as a 3rd parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails. + // Simple values such as "10px" are parsed to Float; + // complex values such as "rotate(1rad)" are returned as-is. + result = jQuery.css( tween.elem, tween.prop, "" ); + + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + + // Use step hook for back compat. + // Use cssHook if its there. + // Use .style if available and use plain properties where available. + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.nodeType === 1 && + ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || + jQuery.cssHooks[ tween.prop ] ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Support: IE <=9 only +// Panic based approach to setting things on disconnected nodes +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p * Math.PI ) / 2; + }, + _default: "swing" +}; + +jQuery.fx = Tween.prototype.init; + +// Back compat <1.8 extension point +jQuery.fx.step = {}; + + + + +var + fxNow, inProgress, + rfxtypes = /^(?:toggle|show|hide)$/, + rrun = /queueHooks$/; + +function schedule() { + if ( inProgress ) { + if ( document.hidden === false && window.requestAnimationFrame ) { + window.requestAnimationFrame( schedule ); + } else { + window.setTimeout( schedule, jQuery.fx.interval ); + } + + jQuery.fx.tick(); + } +} + +// Animations created synchronously will run synchronously +function createFxNow() { + window.setTimeout( function() { + fxNow = undefined; + } ); + return ( fxNow = jQuery.now() ); +} + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + i = 0, + attrs = { height: type }; + + // If we include width, step value is 1 to do all cssExpand values, + // otherwise step value is 2 to skip over Left and Right + includeWidth = includeWidth ? 1 : 0; + for ( ; i < 4; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +function createTween( value, prop, animation ) { + var tween, + collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { + + // We're done with this property + return tween; + } + } +} + +function defaultPrefilter( elem, props, opts ) { + var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, + isBox = "width" in props || "height" in props, + anim = this, + orig = {}, + style = elem.style, + hidden = elem.nodeType && isHiddenWithinTree( elem ), + dataShow = dataPriv.get( elem, "fxshow" ); + + // Queue-skipping animations hijack the fx hooks + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always( function() { + + // Ensure the complete handler is called before this completes + anim.always( function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + } ); + } ); + } + + // Detect show/hide animations + for ( prop in props ) { + value = props[ prop ]; + if ( rfxtypes.test( value ) ) { + delete props[ prop ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + + // Pretend to be hidden if this is a "show" and + // there is still data from a stopped show/hide + if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { + hidden = true; + + // Ignore all other no-op show/hide data + } else { + continue; + } + } + orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); + } + } + + // Bail out if this is a no-op like .hide().hide() + propTween = !jQuery.isEmptyObject( props ); + if ( !propTween && jQuery.isEmptyObject( orig ) ) { + return; + } + + // Restrict "overflow" and "display" styles during box animations + if ( isBox && elem.nodeType === 1 ) { + + // Support: IE <=9 - 11, Edge 12 - 13 + // Record all 3 overflow attributes because IE does not infer the shorthand + // from identically-valued overflowX and overflowY + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Identify a display type, preferring old show/hide data over the CSS cascade + restoreDisplay = dataShow && dataShow.display; + if ( restoreDisplay == null ) { + restoreDisplay = dataPriv.get( elem, "display" ); + } + display = jQuery.css( elem, "display" ); + if ( display === "none" ) { + if ( restoreDisplay ) { + display = restoreDisplay; + } else { + + // Get nonempty value(s) by temporarily forcing visibility + showHide( [ elem ], true ); + restoreDisplay = elem.style.display || restoreDisplay; + display = jQuery.css( elem, "display" ); + showHide( [ elem ] ); + } + } + + // Animate inline elements as inline-block + if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { + if ( jQuery.css( elem, "float" ) === "none" ) { + + // Restore the original display value at the end of pure show/hide animations + if ( !propTween ) { + anim.done( function() { + style.display = restoreDisplay; + } ); + if ( restoreDisplay == null ) { + display = style.display; + restoreDisplay = display === "none" ? "" : display; + } + } + style.display = "inline-block"; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + anim.always( function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + } ); + } + + // Implement show/hide animations + propTween = false; + for ( prop in orig ) { + + // General show/hide setup for this element animation + if ( !propTween ) { + if ( dataShow ) { + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + } else { + dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); + } + + // Store hidden/visible for toggle so `.stop().toggle()` "reverses" + if ( toggle ) { + dataShow.hidden = !hidden; + } + + // Show elements before animating them + if ( hidden ) { + showHide( [ elem ], true ); + } + + /* eslint-disable no-loop-func */ + + anim.done( function() { + + /* eslint-enable no-loop-func */ + + // The final step of a "hide" animation is actually hiding the element + if ( !hidden ) { + showHide( [ elem ] ); + } + dataPriv.remove( elem, "fxshow" ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + } ); + } + + // Per-property setup + propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = propTween.start; + if ( hidden ) { + propTween.end = propTween.start; + propTween.start = 0; + } + } + } +} + +function propFilter( props, specialEasing ) { + var index, name, easing, value, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = jQuery.camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( Array.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // Not quite $.extend, this won't overwrite existing keys. + // Reusing 'index' because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +function Animation( elem, properties, options ) { + var result, + stopped, + index = 0, + length = Animation.prefilters.length, + deferred = jQuery.Deferred().always( function() { + + // Don't match elem in the :animated selector + delete tick.elem; + } ), + tick = function() { + if ( stopped ) { + return false; + } + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + + // Support: Android 2.3 only + // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ] ); + + // If there's more to do, yield + if ( percent < 1 && length ) { + return remaining; + } + + // If this was an empty animation, synthesize a final progress notification + if ( !length ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + } + + // Resolve the animation and report its conclusion + deferred.resolveWith( elem, [ animation ] ); + return false; + }, + animation = deferred.promise( { + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { + specialEasing: {}, + easing: jQuery.easing._default + }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + + // If we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + if ( stopped ) { + return this; + } + stopped = true; + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // Resolve when we played the last frame; otherwise, reject + if ( gotoEnd ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + } ), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length; index++ ) { + result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + if ( jQuery.isFunction( result.stop ) ) { + jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = + jQuery.proxy( result.stop, result ); + } + return result; + } + } + + jQuery.map( props, createTween, animation ); + + if ( jQuery.isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + // Attach callbacks from options + animation + .progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); + + jQuery.fx.timer( + jQuery.extend( tick, { + elem: elem, + anim: animation, + queue: animation.opts.queue + } ) + ); + + return animation; +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweeners: { + "*": [ function( prop, value ) { + var tween = this.createTween( prop, value ); + adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); + return tween; + } ] + }, + + tweener: function( props, callback ) { + if ( jQuery.isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.match( rnothtmlwhite ); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length; index++ ) { + prop = props[ index ]; + Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; + Animation.tweeners[ prop ].unshift( callback ); + } + }, + + prefilters: [ defaultPrefilter ], + + prefilter: function( callback, prepend ) { + if ( prepend ) { + Animation.prefilters.unshift( callback ); + } else { + Animation.prefilters.push( callback ); + } + } +} ); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; + + // Go to the end state if fx are off + if ( jQuery.fx.off ) { + opt.duration = 0; + + } else { + if ( typeof opt.duration !== "number" ) { + if ( opt.duration in jQuery.fx.speeds ) { + opt.duration = jQuery.fx.speeds[ opt.duration ]; + + } else { + opt.duration = jQuery.fx.speeds._default; + } + } + } + + // Normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.fn.extend( { + fadeTo: function( speed, to, easing, callback ) { + + // Show any hidden elements after setting opacity to 0 + return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() + + // Animate to the value specified + .end().animate( { opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + + // Empty animations, or finishing resolves immediately + if ( empty || dataPriv.get( this, "finish" ) ) { + anim.stop( true ); + } + }; + doAnimation.finish = doAnimation; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } + + return this.each( function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = dataPriv.get( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && + ( type == null || timers[ index ].queue === type ) ) { + + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // Start the next in the queue if the last step wasn't forced. + // Timers currently will call their complete callbacks, which + // will dequeue but only if they were gotoEnd. + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + } ); + }, + finish: function( type ) { + if ( type !== false ) { + type = type || "fx"; + } + return this.each( function() { + var index, + data = dataPriv.get( this ), + queue = data[ type + "queue" ], + hooks = data[ type + "queueHooks" ], + timers = jQuery.timers, + length = queue ? queue.length : 0; + + // Enable finishing flag on private data + data.finish = true; + + // Empty the queue first + jQuery.queue( this, type, [] ); + + if ( hooks && hooks.stop ) { + hooks.stop.call( this, true ); + } + + // Look for any active animations, and finish them + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && timers[ index ].queue === type ) { + timers[ index ].anim.stop( true ); + timers.splice( index, 1 ); + } + } + + // Look for any animations in the old queue and finish them + for ( index = 0; index < length; index++ ) { + if ( queue[ index ] && queue[ index ].finish ) { + queue[ index ].finish.call( this ); + } + } + + // Turn off finishing flag + delete data.finish; + } ); + } +} ); + +jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +} ); + +// Generate shortcuts for custom animations +jQuery.each( { + slideDown: genFx( "show" ), + slideUp: genFx( "hide" ), + slideToggle: genFx( "toggle" ), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +} ); + +jQuery.timers = []; +jQuery.fx.tick = function() { + var timer, + i = 0, + timers = jQuery.timers; + + fxNow = jQuery.now(); + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + + // Run the timer and safely remove it when done (allowing for external removal) + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; + +jQuery.fx.timer = function( timer ) { + jQuery.timers.push( timer ); + jQuery.fx.start(); +}; + +jQuery.fx.interval = 13; +jQuery.fx.start = function() { + if ( inProgress ) { + return; + } + + inProgress = true; + schedule(); +}; + +jQuery.fx.stop = function() { + inProgress = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + + // Default speed + _default: 400 +}; + + +// Based off of the plugin by Clint Helfers, with permission. +// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ +jQuery.fn.delay = function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = window.setTimeout( next, time ); + hooks.stop = function() { + window.clearTimeout( timeout ); + }; + } ); +}; + + +( function() { + var input = document.createElement( "input" ), + select = document.createElement( "select" ), + opt = select.appendChild( document.createElement( "option" ) ); + + input.type = "checkbox"; + + // Support: Android <=4.3 only + // Default value for a checkbox should be "on" + support.checkOn = input.value !== ""; + + // Support: IE <=11 only + // Must access selectedIndex to make default options select + support.optSelected = opt.selected; + + // Support: IE <=11 only + // An input loses its value after becoming a radio + input = document.createElement( "input" ); + input.value = "t"; + input.type = "radio"; + support.radioValue = input.value === "t"; +} )(); + + +var boolHook, + attrHandle = jQuery.expr.attrHandle; + +jQuery.fn.extend( { + attr: function( name, value ) { + return access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each( function() { + jQuery.removeAttr( this, name ); + } ); + } +} ); + +jQuery.extend( { + attr: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set attributes on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + // Attribute hooks are determined by the lowercase version + // Grab necessary hook if one is defined + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + hooks = jQuery.attrHooks[ name.toLowerCase() ] || + ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); + } + + if ( value !== undefined ) { + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + } + + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + elem.setAttribute( name, value + "" ); + return value; + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + ret = jQuery.find.attr( elem, name ); + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? undefined : ret; + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !support.radioValue && value === "radio" && + nodeName( elem, "input" ) ) { + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + removeAttr: function( elem, value ) { + var name, + i = 0, + + // Attribute names can contain non-HTML whitespace characters + // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 + attrNames = value && value.match( rnothtmlwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( ( name = attrNames[ i++ ] ) ) { + elem.removeAttribute( name ); + } + } + } +} ); + +// Hooks for boolean attributes +boolHook = { + set: function( elem, value, name ) { + if ( value === false ) { + + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + elem.setAttribute( name, name ); + } + return name; + } +}; + +jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { + var getter = attrHandle[ name ] || jQuery.find.attr; + + attrHandle[ name ] = function( elem, name, isXML ) { + var ret, handle, + lowercaseName = name.toLowerCase(); + + if ( !isXML ) { + + // Avoid an infinite loop by temporarily removing this function from the getter + handle = attrHandle[ lowercaseName ]; + attrHandle[ lowercaseName ] = ret; + ret = getter( elem, name, isXML ) != null ? + lowercaseName : + null; + attrHandle[ lowercaseName ] = handle; + } + return ret; + }; +} ); + + + + +var rfocusable = /^(?:input|select|textarea|button)$/i, + rclickable = /^(?:a|area)$/i; + +jQuery.fn.extend( { + prop: function( name, value ) { + return access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + return this.each( function() { + delete this[ jQuery.propFix[ name ] || name ]; + } ); + } +} ); + +jQuery.extend( { + prop: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set properties on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + return ( elem[ name ] = value ); + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + return elem[ name ]; + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + + // Support: IE <=9 - 11 only + // elem.tabIndex doesn't always return the + // correct value when it hasn't been explicitly set + // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + // Use proper attribute retrieval(#12072) + var tabindex = jQuery.find.attr( elem, "tabindex" ); + + if ( tabindex ) { + return parseInt( tabindex, 10 ); + } + + if ( + rfocusable.test( elem.nodeName ) || + rclickable.test( elem.nodeName ) && + elem.href + ) { + return 0; + } + + return -1; + } + } + }, + + propFix: { + "for": "htmlFor", + "class": "className" + } +} ); + +// Support: IE <=11 only +// Accessing the selectedIndex property +// forces the browser to respect setting selected +// on the option +// The getter ensures a default option is selected +// when in an optgroup +// eslint rule "no-unused-expressions" is disabled for this code +// since it considers such accessions noop +if ( !support.optSelected ) { + jQuery.propHooks.selected = { + get: function( elem ) { + + /* eslint no-unused-expressions: "off" */ + + var parent = elem.parentNode; + if ( parent && parent.parentNode ) { + parent.parentNode.selectedIndex; + } + return null; + }, + set: function( elem ) { + + /* eslint no-unused-expressions: "off" */ + + var parent = elem.parentNode; + if ( parent ) { + parent.selectedIndex; + + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + } + }; +} + +jQuery.each( [ + "tabIndex", + "readOnly", + "maxLength", + "cellSpacing", + "cellPadding", + "rowSpan", + "colSpan", + "useMap", + "frameBorder", + "contentEditable" +], function() { + jQuery.propFix[ this.toLowerCase() ] = this; +} ); + + + + + // Strip and collapse whitespace according to HTML spec + // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace + function stripAndCollapse( value ) { + var tokens = value.match( rnothtmlwhite ) || []; + return tokens.join( " " ); + } + + +function getClass( elem ) { + return elem.getAttribute && elem.getAttribute( "class" ) || ""; +} + +jQuery.fn.extend( { + addClass: function( value ) { + var classes, elem, cur, curValue, clazz, j, finalValue, + i = 0; + + if ( jQuery.isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( typeof value === "string" && value ) { + classes = value.match( rnothtmlwhite ) || []; + + while ( ( elem = this[ i++ ] ) ) { + curValue = getClass( elem ); + cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + + if ( cur ) { + j = 0; + while ( ( clazz = classes[ j++ ] ) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = stripAndCollapse( cur ); + if ( curValue !== finalValue ) { + elem.setAttribute( "class", finalValue ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, curValue, clazz, j, finalValue, + i = 0; + + if ( jQuery.isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( !arguments.length ) { + return this.attr( "class", "" ); + } + + if ( typeof value === "string" && value ) { + classes = value.match( rnothtmlwhite ) || []; + + while ( ( elem = this[ i++ ] ) ) { + curValue = getClass( elem ); + + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + + if ( cur ) { + j = 0; + while ( ( clazz = classes[ j++ ] ) ) { + + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) > -1 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = stripAndCollapse( cur ); + if ( curValue !== finalValue ) { + elem.setAttribute( "class", finalValue ); + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value; + + if ( typeof stateVal === "boolean" && type === "string" ) { + return stateVal ? this.addClass( value ) : this.removeClass( value ); + } + + if ( jQuery.isFunction( value ) ) { + return this.each( function( i ) { + jQuery( this ).toggleClass( + value.call( this, i, getClass( this ), stateVal ), + stateVal + ); + } ); + } + + return this.each( function() { + var className, i, self, classNames; + + if ( type === "string" ) { + + // Toggle individual class names + i = 0; + self = jQuery( this ); + classNames = value.match( rnothtmlwhite ) || []; + + while ( ( className = classNames[ i++ ] ) ) { + + // Check each className given, space separated list + if ( self.hasClass( className ) ) { + self.removeClass( className ); + } else { + self.addClass( className ); + } + } + + // Toggle whole class name + } else if ( value === undefined || type === "boolean" ) { + className = getClass( this ); + if ( className ) { + + // Store className if set + dataPriv.set( this, "__className__", className ); + } + + // If the element has a class name or if we're passed `false`, + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + if ( this.setAttribute ) { + this.setAttribute( "class", + className || value === false ? + "" : + dataPriv.get( this, "__className__" ) || "" + ); + } + } + } ); + }, + + hasClass: function( selector ) { + var className, elem, + i = 0; + + className = " " + selector + " "; + while ( ( elem = this[ i++ ] ) ) { + if ( elem.nodeType === 1 && + ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { + return true; + } + } + + return false; + } +} ); + + + + +var rreturn = /\r/g; + +jQuery.fn.extend( { + val: function( value ) { + var hooks, ret, isFunction, + elem = this[ 0 ]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || + jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && + "get" in hooks && + ( ret = hooks.get( elem, "value" ) ) !== undefined + ) { + return ret; + } + + ret = elem.value; + + // Handle most common string cases + if ( typeof ret === "string" ) { + return ret.replace( rreturn, "" ); + } + + // Handle cases where value is null/undef or number + return ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each( function( i ) { + var val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, jQuery( this ).val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + + } else if ( typeof val === "number" ) { + val += ""; + + } else if ( Array.isArray( val ) ) { + val = jQuery.map( val, function( value ) { + return value == null ? "" : value + ""; + } ); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + } ); + } +} ); + +jQuery.extend( { + valHooks: { + option: { + get: function( elem ) { + + var val = jQuery.find.attr( elem, "value" ); + return val != null ? + val : + + // Support: IE <=10 - 11 only + // option.text throws exceptions (#14686, #14858) + // Strip and collapse whitespace + // https://html.spec.whatwg.org/#strip-and-collapse-whitespace + stripAndCollapse( jQuery.text( elem ) ); + } + }, + select: { + get: function( elem ) { + var value, option, i, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one", + values = one ? null : [], + max = one ? index + 1 : options.length; + + if ( index < 0 ) { + i = max; + + } else { + i = one ? index : 0; + } + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Support: IE <=9 only + // IE8-9 doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + + // Don't return options that are disabled or in a disabled optgroup + !option.disabled && + ( !option.parentNode.disabled || + !nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var optionSet, option, + options = elem.options, + values = jQuery.makeArray( value ), + i = options.length; + + while ( i-- ) { + option = options[ i ]; + + /* eslint-disable no-cond-assign */ + + if ( option.selected = + jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 + ) { + optionSet = true; + } + + /* eslint-enable no-cond-assign */ + } + + // Force browsers to behave consistently when non-matching value is set + if ( !optionSet ) { + elem.selectedIndex = -1; + } + return values; + } + } + } +} ); + +// Radios and checkboxes getter/setter +jQuery.each( [ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + set: function( elem, value ) { + if ( Array.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); + } + } + }; + if ( !support.checkOn ) { + jQuery.valHooks[ this ].get = function( elem ) { + return elem.getAttribute( "value" ) === null ? "on" : elem.value; + }; + } +} ); + + + + +// Return jQuery for attributes-only inclusion + + +var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; + +jQuery.extend( jQuery.event, { + + trigger: function( event, data, elem, onlyHandlers ) { + + var i, cur, tmp, bubbleType, ontype, handle, special, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "." ) > -1 ) { + + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split( "." ); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf( ":" ) < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join( "." ); + event.rnamespace = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === ( elem.ownerDocument || document ) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && + dataPriv.get( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( ( !special._default || + special._default.apply( eventPath.pop(), data ) === false ) && + acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name as the event. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + // Piggyback on a donor event to simulate a different one + // Used only for `focus(in | out)` events + simulate: function( type, elem, event ) { + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true + } + ); + + jQuery.event.trigger( e, null, elem ); + } + +} ); + +jQuery.fn.extend( { + + trigger: function( type, data ) { + return this.each( function() { + jQuery.event.trigger( type, data, this ); + } ); + }, + triggerHandler: function( type, data ) { + var elem = this[ 0 ]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +} ); + + +jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup contextmenu" ).split( " " ), + function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; +} ); + +jQuery.fn.extend( { + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +} ); + + + + +support.focusin = "onfocusin" in window; + + +// Support: Firefox <=44 +// Firefox doesn't have focus(in | out) events +// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 +// +// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 +// focus(in | out) events fire after focus & blur events, +// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order +// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 +if ( !support.focusin ) { + jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + var doc = this.ownerDocument || this, + attaches = dataPriv.access( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this, + attaches = dataPriv.access( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + dataPriv.remove( doc, fix ); + + } else { + dataPriv.access( doc, fix, attaches ); + } + } + }; + } ); +} +var location = window.location; + +var nonce = jQuery.now(); + +var rquery = ( /\?/ ); + + + +// Cross-browser xml parsing +jQuery.parseXML = function( data ) { + var xml; + if ( !data || typeof data !== "string" ) { + return null; + } + + // Support: IE 9 - 11 only + // IE throws on parseFromString with invalid input. + try { + xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); + } catch ( e ) { + xml = undefined; + } + + if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; +}; + + +var + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, + rsubmittable = /^(?:input|select|textarea|keygen)/i; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( Array.isArray( obj ) ) { + + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + + // Item is non-scalar (array or object), encode its numeric index. + buildParams( + prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", + v, + traditional, + add + ); + } + } ); + + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + + // Serialize scalar item. + add( prefix, obj ); + } +} + +// Serialize an array of form elements or a set of +// key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, valueOrFunction ) { + + // If value is a function, invoke it and use its return value + var value = jQuery.isFunction( valueOrFunction ) ? + valueOrFunction() : + valueOrFunction; + + s[ s.length ] = encodeURIComponent( key ) + "=" + + encodeURIComponent( value == null ? "" : value ); + }; + + // If an array was passed in, assume that it is an array of form elements. + if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + } ); + + } else { + + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ); +}; + +jQuery.fn.extend( { + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map( function() { + + // Can add propHook for "elements" to filter or add form elements + var elements = jQuery.prop( this, "elements" ); + return elements ? jQuery.makeArray( elements ) : this; + } ) + .filter( function() { + var type = this.type; + + // Use .is( ":disabled" ) so that fieldset[disabled] works + return this.name && !jQuery( this ).is( ":disabled" ) && + rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && + ( this.checked || !rcheckableType.test( type ) ); + } ) + .map( function( i, elem ) { + var val = jQuery( this ).val(); + + if ( val == null ) { + return null; + } + + if ( Array.isArray( val ) ) { + return jQuery.map( val, function( val ) { + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ); + } + + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ).get(); + } +} ); + + +var + r20 = /%20/g, + rhash = /#.*$/, + rantiCache = /([?&])_=[^&]*/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, + + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = "*/".concat( "*" ), + + // Anchor tag for parsing the document origin + originAnchor = document.createElement( "a" ); + originAnchor.href = location.href; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, + i = 0, + dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; + + if ( jQuery.isFunction( func ) ) { + + // For each dataType in the dataTypeExpression + while ( ( dataType = dataTypes[ i++ ] ) ) { + + // Prepend if requested + if ( dataType[ 0 ] === "+" ) { + dataType = dataType.slice( 1 ) || "*"; + ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); + + // Otherwise append + } else { + ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); + } + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { + + var inspected = {}, + seekingTransport = ( structure === transports ); + + function inspect( dataType ) { + var selected; + inspected[ dataType ] = true; + jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { + var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); + if ( typeof dataTypeOrTransport === "string" && + !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + + options.dataTypes.unshift( dataTypeOrTransport ); + inspect( dataTypeOrTransport ); + return false; + } else if ( seekingTransport ) { + return !( selected = dataTypeOrTransport ); + } + } ); + return selected; + } + + return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } + + return target; +} + +/* Handles responses to an ajax request: + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var ct, type, finalDataType, firstDataType, + contents = s.contents, + dataTypes = s.dataTypes; + + // Remove auto dataType and get content-type in the process + while ( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +/* Chain conversions given the request and the original response + * Also sets the responseXXX fields on the jqXHR instance + */ +function ajaxConvert( s, response, jqXHR, isSuccess ) { + var conv2, current, conv, tmp, prev, + converters = {}, + + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(); + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + current = dataTypes.shift(); + + // Convert to each sequential dataType + while ( current ) { + + if ( s.responseFields[ current ] ) { + jqXHR[ s.responseFields[ current ] ] = response; + } + + // Apply the dataFilter if provided + if ( !prev && isSuccess && s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + prev = current; + current = dataTypes.shift(); + + if ( current ) { + + // There's only work to do if current dataType is non-auto + if ( current === "*" ) { + + current = prev; + + // Convert response if prev dataType is non-auto and differs from current + } else if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split( " " ); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.unshift( tmp[ 1 ] ); + } + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s.throws ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { + state: "parsererror", + error: conv ? e : "No conversion from " + prev + " to " + current + }; + } + } + } + } + } + } + + return { state: "success", data: response }; +} + +jQuery.extend( { + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {}, + + ajaxSettings: { + url: location.href, + type: "GET", + isLocal: rlocalProtocol.test( location.protocol ), + global: true, + processData: true, + async: true, + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + "*": allTypes, + text: "text/plain", + html: "text/html", + xml: "application/xml, text/xml", + json: "application/json, text/javascript" + }, + + contents: { + xml: /\bxml\b/, + html: /\bhtml/, + json: /\bjson\b/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText", + json: "responseJSON" + }, + + // Data converters + // Keys separate source (or catchall "*") and destination types with a single space + converters: { + + // Convert anything to text + "* text": String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": JSON.parse, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + url: true, + context: true + } + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + return settings ? + + // Building a settings object + ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : + + // Extending ajaxSettings + ajaxExtend( jQuery.ajaxSettings, target ); + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var transport, + + // URL without anti-cache param + cacheURL, + + // Response headers + responseHeadersString, + responseHeaders, + + // timeout handle + timeoutTimer, + + // Url cleanup var + urlAnchor, + + // Request state (becomes false upon send and true upon completion) + completed, + + // To know if global events are to be dispatched + fireGlobals, + + // Loop variable + i, + + // uncached part of the url + uncached, + + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + + // Callbacks context + callbackContext = s.context || s, + + // Context for global events is callbackContext if it is a DOM node or jQuery collection + globalEventContext = s.context && + ( callbackContext.nodeType || callbackContext.jquery ) ? + jQuery( callbackContext ) : + jQuery.event, + + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + + // Status-dependent callbacks + statusCode = s.statusCode || {}, + + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + + // Default abort message + strAbort = "canceled", + + // Fake xhr + jqXHR = { + readyState: 0, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( completed ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while ( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match == null ? null : match; + }, + + // Raw string + getAllResponseHeaders: function() { + return completed ? responseHeadersString : null; + }, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( completed == null ) { + name = requestHeadersNames[ name.toLowerCase() ] = + requestHeadersNames[ name.toLowerCase() ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( completed == null ) { + s.mimeType = type; + } + return this; + }, + + // Status-dependent callbacks + statusCode: function( map ) { + var code; + if ( map ) { + if ( completed ) { + + // Execute the appropriate callbacks + jqXHR.always( map[ jqXHR.status ] ); + } else { + + // Lazy-add the new callbacks in a way that preserves old ones + for ( code in map ) { + statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; + } + } + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + var finalText = statusText || strAbort; + if ( transport ) { + transport.abort( finalText ); + } + done( 0, finalText ); + return this; + } + }; + + // Attach deferreds + deferred.promise( jqXHR ); + + // Add protocol if not provided (prefilters might expect it) + // Handle falsy url in the settings object (#10093: consistency with old signature) + // We also use the url parameter if available + s.url = ( ( url || s.url || location.href ) + "" ) + .replace( rprotocol, location.protocol + "//" ); + + // Alias method option to type as per ticket #12004 + s.type = options.method || options.type || s.method || s.type; + + // Extract dataTypes list + s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; + + // A cross-domain request is in order when the origin doesn't match the current origin. + if ( s.crossDomain == null ) { + urlAnchor = document.createElement( "a" ); + + // Support: IE <=8 - 11, Edge 12 - 13 + // IE throws exception on accessing the href property if url is malformed, + // e.g. http://example.com:80x/ + try { + urlAnchor.href = s.url; + + // Support: IE <=8 - 11 only + // Anchor's host property isn't correctly set when s.url is relative + urlAnchor.href = urlAnchor.href; + s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== + urlAnchor.protocol + "//" + urlAnchor.host; + } catch ( e ) { + + // If there is an error parsing the URL, assume it is crossDomain, + // it can be rejected by the transport if it is invalid + s.crossDomain = true; + } + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( completed ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) + fireGlobals = jQuery.event && s.global; + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Save the URL in case we're toying with the If-Modified-Since + // and/or If-None-Match header later on + // Remove hash to simplify url manipulation + cacheURL = s.url.replace( rhash, "" ); + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // Remember the hash so we can put it back + uncached = s.url.slice( cacheURL.length ); + + // If data is available, append data to url + if ( s.data ) { + cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; + + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Add or update anti-cache param if needed + if ( s.cache === false ) { + cacheURL = cacheURL.replace( rantiCache, "$1" ); + uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; + } + + // Put hash and anti-cache on the URL that will be requested (gh-1732) + s.url = cacheURL + uncached; + + // Change '%20' to '+' if this is encoded form body content (gh-2658) + } else if ( s.data && s.processData && + ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { + s.data = s.data.replace( r20, "+" ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + if ( jQuery.lastModified[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); + } + if ( jQuery.etag[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? + s.accepts[ s.dataTypes[ 0 ] ] + + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && + ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { + + // Abort if not done already and return + return jqXHR.abort(); + } + + // Aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + completeDeferred.add( s.complete ); + jqXHR.done( s.success ); + jqXHR.fail( s.error ); + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + + // If request was aborted inside ajaxSend, stop there + if ( completed ) { + return jqXHR; + } + + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = window.setTimeout( function() { + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + completed = false; + transport.send( requestHeaders, done ); + } catch ( e ) { + + // Rethrow post-completion exceptions + if ( completed ) { + throw e; + } + + // Propagate others as results + done( -1, e ); + } + } + + // Callback for when everything is done + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Ignore repeat invocations + if ( completed ) { + return; + } + + completed = true; + + // Clear timeout if it exists + if ( timeoutTimer ) { + window.clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Determine if successful + isSuccess = status >= 200 && status < 300 || status === 304; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // Convert no matter what (that way responseXXX fields are always set) + response = ajaxConvert( s, response, jqXHR, isSuccess ); + + // If successful, handle type chaining + if ( isSuccess ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + modified = jqXHR.getResponseHeader( "Last-Modified" ); + if ( modified ) { + jQuery.lastModified[ cacheURL ] = modified; + } + modified = jqXHR.getResponseHeader( "etag" ); + if ( modified ) { + jQuery.etag[ cacheURL ] = modified; + } + } + + // if no content + if ( status === 204 || s.type === "HEAD" ) { + statusText = "nocontent"; + + // if not modified + } else if ( status === 304 ) { + statusText = "notmodified"; + + // If we have data, let's convert it + } else { + statusText = response.state; + success = response.data; + error = response.error; + isSuccess = !error; + } + } else { + + // Extract error from statusText and normalize for non-aborts + error = statusText; + if ( status || !statusText ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + return jqXHR; + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + } +} ); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + + // Shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + // The url can be an options object (which then must have .url) + return jQuery.ajax( jQuery.extend( { + url: url, + type: method, + dataType: type, + data: data, + success: callback + }, jQuery.isPlainObject( url ) && url ) ); + }; +} ); + + +jQuery._evalUrl = function( url ) { + return jQuery.ajax( { + url: url, + + // Make this explicit, since user can override this through ajaxSetup (#11264) + type: "GET", + dataType: "script", + cache: true, + async: false, + global: false, + "throws": true + } ); +}; + + +jQuery.fn.extend( { + wrapAll: function( html ) { + var wrap; + + if ( this[ 0 ] ) { + if ( jQuery.isFunction( html ) ) { + html = html.call( this[ 0 ] ); + } + + // The elements to wrap the target around + wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); + + if ( this[ 0 ].parentNode ) { + wrap.insertBefore( this[ 0 ] ); + } + + wrap.map( function() { + var elem = this; + + while ( elem.firstElementChild ) { + elem = elem.firstElementChild; + } + + return elem; + } ).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each( function( i ) { + jQuery( this ).wrapInner( html.call( this, i ) ); + } ); + } + + return this.each( function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + } ); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each( function( i ) { + jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); + } ); + }, + + unwrap: function( selector ) { + this.parent( selector ).not( "body" ).each( function() { + jQuery( this ).replaceWith( this.childNodes ); + } ); + return this; + } +} ); + + +jQuery.expr.pseudos.hidden = function( elem ) { + return !jQuery.expr.pseudos.visible( elem ); +}; +jQuery.expr.pseudos.visible = function( elem ) { + return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); +}; + + + + +jQuery.ajaxSettings.xhr = function() { + try { + return new window.XMLHttpRequest(); + } catch ( e ) {} +}; + +var xhrSuccessStatus = { + + // File protocol always yields status code 0, assume 200 + 0: 200, + + // Support: IE <=9 only + // #1450: sometimes IE returns 1223 when it should be 204 + 1223: 204 + }, + xhrSupported = jQuery.ajaxSettings.xhr(); + +support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); +support.ajax = xhrSupported = !!xhrSupported; + +jQuery.ajaxTransport( function( options ) { + var callback, errorCallback; + + // Cross domain only allowed if supported through XMLHttpRequest + if ( support.cors || xhrSupported && !options.crossDomain ) { + return { + send: function( headers, complete ) { + var i, + xhr = options.xhr(); + + xhr.open( + options.type, + options.url, + options.async, + options.username, + options.password + ); + + // Apply custom fields if provided + if ( options.xhrFields ) { + for ( i in options.xhrFields ) { + xhr[ i ] = options.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( options.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( options.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Set headers + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + + // Callback + callback = function( type ) { + return function() { + if ( callback ) { + callback = errorCallback = xhr.onload = + xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; + + if ( type === "abort" ) { + xhr.abort(); + } else if ( type === "error" ) { + + // Support: IE <=9 only + // On a manual native abort, IE9 throws + // errors on any property access that is not readyState + if ( typeof xhr.status !== "number" ) { + complete( 0, "error" ); + } else { + complete( + + // File: protocol always yields status 0; see #8605, #14207 + xhr.status, + xhr.statusText + ); + } + } else { + complete( + xhrSuccessStatus[ xhr.status ] || xhr.status, + xhr.statusText, + + // Support: IE <=9 only + // IE9 has no XHR2 but throws on binary (trac-11426) + // For XHR2 non-text, let the caller handle it (gh-2498) + ( xhr.responseType || "text" ) !== "text" || + typeof xhr.responseText !== "string" ? + { binary: xhr.response } : + { text: xhr.responseText }, + xhr.getAllResponseHeaders() + ); + } + } + }; + }; + + // Listen to events + xhr.onload = callback(); + errorCallback = xhr.onerror = callback( "error" ); + + // Support: IE 9 only + // Use onreadystatechange to replace onabort + // to handle uncaught aborts + if ( xhr.onabort !== undefined ) { + xhr.onabort = errorCallback; + } else { + xhr.onreadystatechange = function() { + + // Check readyState before timeout as it changes + if ( xhr.readyState === 4 ) { + + // Allow onerror to be called first, + // but that will not handle a native abort + // Also, save errorCallback to a variable + // as xhr.onerror cannot be accessed + window.setTimeout( function() { + if ( callback ) { + errorCallback(); + } + } ); + } + }; + } + + // Create the abort callback + callback = callback( "abort" ); + + try { + + // Do send the request (this may raise an exception) + xhr.send( options.hasContent && options.data || null ); + } catch ( e ) { + + // #14683: Only rethrow if this hasn't been notified as an error yet + if ( callback ) { + throw e; + } + } + }, + + abort: function() { + if ( callback ) { + callback(); + } + } + }; + } +} ); + + + + +// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) +jQuery.ajaxPrefilter( function( s ) { + if ( s.crossDomain ) { + s.contents.script = false; + } +} ); + +// Install script dataType +jQuery.ajaxSetup( { + accepts: { + script: "text/javascript, application/javascript, " + + "application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /\b(?:java|ecma)script\b/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +} ); + +// Handle cache's special case and crossDomain +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + } +} ); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function( s ) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + var script, callback; + return { + send: function( _, complete ) { + script = jQuery( "<script>" ).prop( { + charset: s.scriptCharset, + src: s.url + } ).on( + "load error", + callback = function( evt ) { + script.remove(); + callback = null; + if ( evt ) { + complete( evt.type === "error" ? 404 : 200, evt.type ); + } + } + ); + + // Use native DOM manipulation to avoid our domManip AJAX trickery + document.head.appendChild( script[ 0 ] ); + }, + abort: function() { + if ( callback ) { + callback(); + } + } + }; + } +} ); + + + + +var oldCallbacks = [], + rjsonp = /(=)\?(?=&|$)|\?\?/; + +// Default jsonp settings +jQuery.ajaxSetup( { + jsonp: "callback", + jsonpCallback: function() { + var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); + this[ callback ] = true; + return callback; + } +} ); + +// Detect, normalize options and install callbacks for jsonp requests +jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { + + var callbackName, overwritten, responseContainer, + jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? + "url" : + typeof s.data === "string" && + ( s.contentType || "" ) + .indexOf( "application/x-www-form-urlencoded" ) === 0 && + rjsonp.test( s.data ) && "data" + ); + + // Handle iff the expected data type is "jsonp" or we have a parameter to set + if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { + + // Get callback name, remembering preexisting value associated with it + callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? + s.jsonpCallback() : + s.jsonpCallback; + + // Insert callback into url or form data + if ( jsonProp ) { + s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); + } else if ( s.jsonp !== false ) { + s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; + } + + // Use data converter to retrieve json after script execution + s.converters[ "script json" ] = function() { + if ( !responseContainer ) { + jQuery.error( callbackName + " was not called" ); + } + return responseContainer[ 0 ]; + }; + + // Force json dataType + s.dataTypes[ 0 ] = "json"; + + // Install callback + overwritten = window[ callbackName ]; + window[ callbackName ] = function() { + responseContainer = arguments; + }; + + // Clean-up function (fires after converters) + jqXHR.always( function() { + + // If previous value didn't exist - remove it + if ( overwritten === undefined ) { + jQuery( window ).removeProp( callbackName ); + + // Otherwise restore preexisting value + } else { + window[ callbackName ] = overwritten; + } + + // Save back as free + if ( s[ callbackName ] ) { + + // Make sure that re-using the options doesn't screw things around + s.jsonpCallback = originalSettings.jsonpCallback; + + // Save the callback name for future use + oldCallbacks.push( callbackName ); + } + + // Call if it was a function and we have a response + if ( responseContainer && jQuery.isFunction( overwritten ) ) { + overwritten( responseContainer[ 0 ] ); + } + + responseContainer = overwritten = undefined; + } ); + + // Delegate to script + return "script"; + } +} ); + + + + +// Support: Safari 8 only +// In Safari 8 documents created via document.implementation.createHTMLDocument +// collapse sibling forms: the second one becomes a child of the first one. +// Because of that, this security measure has to be disabled in Safari 8. +// https://bugs.webkit.org/show_bug.cgi?id=137337 +support.createHTMLDocument = ( function() { + var body = document.implementation.createHTMLDocument( "" ).body; + body.innerHTML = "<form></form><form></form>"; + return body.childNodes.length === 2; +} )(); + + +// Argument "data" should be string of html +// context (optional): If specified, the fragment will be created in this context, +// defaults to document +// keepScripts (optional): If true, will include scripts passed in the html string +jQuery.parseHTML = function( data, context, keepScripts ) { + if ( typeof data !== "string" ) { + return []; + } + if ( typeof context === "boolean" ) { + keepScripts = context; + context = false; + } + + var base, parsed, scripts; + + if ( !context ) { + + // Stop scripts or inline event handlers from being executed immediately + // by using document.implementation + if ( support.createHTMLDocument ) { + context = document.implementation.createHTMLDocument( "" ); + + // Set the base href for the created document + // so any parsed elements with URLs + // are based on the document's URL (gh-2965) + base = context.createElement( "base" ); + base.href = document.location.href; + context.head.appendChild( base ); + } else { + context = document; + } + } + + parsed = rsingleTag.exec( data ); + scripts = !keepScripts && []; + + // Single tag + if ( parsed ) { + return [ context.createElement( parsed[ 1 ] ) ]; + } + + parsed = buildFragment( [ data ], context, scripts ); + + if ( scripts && scripts.length ) { + jQuery( scripts ).remove(); + } + + return jQuery.merge( [], parsed.childNodes ); +}; + + +/** + * Load a url into a page + */ +jQuery.fn.load = function( url, params, callback ) { + var selector, type, response, + self = this, + off = url.indexOf( " " ); + + if ( off > -1 ) { + selector = stripAndCollapse( url.slice( off ) ); + url = url.slice( 0, off ); + } + + // If it's a function + if ( jQuery.isFunction( params ) ) { + + // We assume that it's the callback + callback = params; + params = undefined; + + // Otherwise, build a param string + } else if ( params && typeof params === "object" ) { + type = "POST"; + } + + // If we have elements to modify, make the request + if ( self.length > 0 ) { + jQuery.ajax( { + url: url, + + // If "type" variable is undefined, then "GET" method will be used. + // Make value of this field explicit since + // user can override it through ajaxSetup method + type: type || "GET", + dataType: "html", + data: params + } ).done( function( responseText ) { + + // Save response for use in complete callback + response = arguments; + + self.html( selector ? + + // If a selector was specified, locate the right elements in a dummy div + // Exclude scripts to avoid IE 'Permission Denied' errors + jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : + + // Otherwise use the full result + responseText ); + + // If the request succeeds, this function gets "data", "status", "jqXHR" + // but they are ignored because response was set above. + // If it fails, this function gets "jqXHR", "status", "error" + } ).always( callback && function( jqXHR, status ) { + self.each( function() { + callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); + } ); + } ); + } + + return this; +}; + + + + +// Attach a bunch of functions for handling common AJAX events +jQuery.each( [ + "ajaxStart", + "ajaxStop", + "ajaxComplete", + "ajaxError", + "ajaxSuccess", + "ajaxSend" +], function( i, type ) { + jQuery.fn[ type ] = function( fn ) { + return this.on( type, fn ); + }; +} ); + + + + +jQuery.expr.pseudos.animated = function( elem ) { + return jQuery.grep( jQuery.timers, function( fn ) { + return elem === fn.elem; + } ).length; +}; + + + + +jQuery.offset = { + setOffset: function( elem, options, i ) { + var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, + position = jQuery.css( elem, "position" ), + curElem = jQuery( elem ), + props = {}; + + // Set position first, in-case top/left are set even on static elem + if ( position === "static" ) { + elem.style.position = "relative"; + } + + curOffset = curElem.offset(); + curCSSTop = jQuery.css( elem, "top" ); + curCSSLeft = jQuery.css( elem, "left" ); + calculatePosition = ( position === "absolute" || position === "fixed" ) && + ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; + + // Need to be able to calculate position if either + // top or left is auto and position is either absolute or fixed + if ( calculatePosition ) { + curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; + } + + if ( jQuery.isFunction( options ) ) { + + // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) + options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); + } + + if ( options.top != null ) { + props.top = ( options.top - curOffset.top ) + curTop; + } + if ( options.left != null ) { + props.left = ( options.left - curOffset.left ) + curLeft; + } + + if ( "using" in options ) { + options.using.call( elem, props ); + + } else { + curElem.css( props ); + } + } +}; + +jQuery.fn.extend( { + offset: function( options ) { + + // Preserve chaining for setter + if ( arguments.length ) { + return options === undefined ? + this : + this.each( function( i ) { + jQuery.offset.setOffset( this, options, i ); + } ); + } + + var doc, docElem, rect, win, + elem = this[ 0 ]; + + if ( !elem ) { + return; + } + + // Return zeros for disconnected and hidden (display: none) elements (gh-2310) + // Support: IE <=11 only + // Running getBoundingClientRect on a + // disconnected node in IE throws an error + if ( !elem.getClientRects().length ) { + return { top: 0, left: 0 }; + } + + rect = elem.getBoundingClientRect(); + + doc = elem.ownerDocument; + docElem = doc.documentElement; + win = doc.defaultView; + + return { + top: rect.top + win.pageYOffset - docElem.clientTop, + left: rect.left + win.pageXOffset - docElem.clientLeft + }; + }, + + position: function() { + if ( !this[ 0 ] ) { + return; + } + + var offsetParent, offset, + elem = this[ 0 ], + parentOffset = { top: 0, left: 0 }; + + // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, + // because it is its only offset parent + if ( jQuery.css( elem, "position" ) === "fixed" ) { + + // Assume getBoundingClientRect is there when computed position is fixed + offset = elem.getBoundingClientRect(); + + } else { + + // Get *real* offsetParent + offsetParent = this.offsetParent(); + + // Get correct offsets + offset = this.offset(); + if ( !nodeName( offsetParent[ 0 ], "html" ) ) { + parentOffset = offsetParent.offset(); + } + + // Add offsetParent borders + parentOffset = { + top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ), + left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ) + }; + } + + // Subtract parent offsets and element margins + return { + top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), + left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) + }; + }, + + // This method will return documentElement in the following cases: + // 1) For the element inside the iframe without offsetParent, this method will return + // documentElement of the parent window + // 2) For the hidden or detached element + // 3) For body or html element, i.e. in case of the html node - it will return itself + // + // but those exceptions were never presented as a real life use-cases + // and might be considered as more preferable results. + // + // This logic, however, is not guaranteed and can change at any point in the future + offsetParent: function() { + return this.map( function() { + var offsetParent = this.offsetParent; + + while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { + offsetParent = offsetParent.offsetParent; + } + + return offsetParent || documentElement; + } ); + } +} ); + +// Create scrollLeft and scrollTop methods +jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { + var top = "pageYOffset" === prop; + + jQuery.fn[ method ] = function( val ) { + return access( this, function( elem, method, val ) { + + // Coalesce documents and windows + var win; + if ( jQuery.isWindow( elem ) ) { + win = elem; + } else if ( elem.nodeType === 9 ) { + win = elem.defaultView; + } + + if ( val === undefined ) { + return win ? win[ prop ] : elem[ method ]; + } + + if ( win ) { + win.scrollTo( + !top ? val : win.pageXOffset, + top ? val : win.pageYOffset + ); + + } else { + elem[ method ] = val; + } + }, method, val, arguments.length ); + }; +} ); + +// Support: Safari <=7 - 9.1, Chrome <=37 - 49 +// Add the top/left cssHooks using jQuery.fn.position +// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 +// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 +// getComputedStyle returns percent when specified for top/left/bottom/right; +// rather than make the css module depend on the offset module, just check for it here +jQuery.each( [ "top", "left" ], function( i, prop ) { + jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, + function( elem, computed ) { + if ( computed ) { + computed = curCSS( elem, prop ); + + // If curCSS returns percentage, fallback to offset + return rnumnonpx.test( computed ) ? + jQuery( elem ).position()[ prop ] + "px" : + computed; + } + } + ); +} ); + + +// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods +jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { + jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, + function( defaultExtra, funcName ) { + + // Margin is only for outerHeight, outerWidth + jQuery.fn[ funcName ] = function( margin, value ) { + var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), + extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); + + return access( this, function( elem, type, value ) { + var doc; + + if ( jQuery.isWindow( elem ) ) { + + // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) + return funcName.indexOf( "outer" ) === 0 ? + elem[ "inner" + name ] : + elem.document.documentElement[ "client" + name ]; + } + + // Get document width or height + if ( elem.nodeType === 9 ) { + doc = elem.documentElement; + + // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], + // whichever is greatest + return Math.max( + elem.body[ "scroll" + name ], doc[ "scroll" + name ], + elem.body[ "offset" + name ], doc[ "offset" + name ], + doc[ "client" + name ] + ); + } + + return value === undefined ? + + // Get width or height on the element, requesting but not forcing parseFloat + jQuery.css( elem, type, extra ) : + + // Set width or height on the element + jQuery.style( elem, type, value, extra ); + }, type, chainable ? margin : undefined, chainable ); + }; + } ); +} ); + + +jQuery.fn.extend( { + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length === 1 ? + this.off( selector, "**" ) : + this.off( types, selector || "**", fn ); + } +} ); + +jQuery.holdReady = function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } +}; +jQuery.isArray = Array.isArray; +jQuery.parseJSON = JSON.parse; +jQuery.nodeName = nodeName; + + + + +// Register as a named AMD module, since jQuery can be concatenated with other +// files that may use define, but not via a proper concatenation script that +// understands anonymous AMD modules. A named AMD is safest and most robust +// way to register. Lowercase jquery is used because AMD module names are +// derived from file names, and jQuery is normally delivered in a lowercase +// file name. Do this after creating the global so that if an AMD module wants +// to call noConflict to hide this version of jQuery, it will work. + +// Note that for maximum portability, libraries that are not jQuery should +// declare themselves as anonymous modules, and avoid setting a global if an +// AMD loader is present. jQuery is a special case. For more information, see +// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon + +if ( typeof define === "function" && define.amd ) { + define( "jquery", [], function() { + return jQuery; + } ); +} + + + + +var + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$; + +jQuery.noConflict = function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; +}; + +// Expose jQuery and $ identifiers, even in AMD +// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) +// and CommonJS for browser emulators (#13566) +if ( !noGlobal ) { + window.jQuery = window.$ = jQuery; +} + + + + +return jQuery; +} ); diff --git a/tests/tests/legacy/js/testrunner.js b/tests/tests/legacy/js/testrunner.js new file mode 100644 index 0000000000..f6f46d38f1 --- /dev/null +++ b/tests/tests/legacy/js/testrunner.js @@ -0,0 +1,65 @@ +$(function(){ + var delay = 100; + + $("dt").click(function(){ + $(this).siblings('dd').toggle(); + }); + + $('dd').addClass('todo'); + + var doing = false; + var i=0; + + var p = setInterval(function() { + if (doing) + return; + + i++; + doing = true; + + var start = new Date; + + var me = $("dd.todo:first"); + if (!me.length) { + clearInterval(p); + return; + } + + me.find('a.joli') + .click(function() { + $(this).siblings('div.result').toggle(); + return false; + }) + .end() + .prepend('<a href="' + $('a',me).attr('href') + '" target="_result'+i+'">➠</a> ') + .append('<span>...</span>') + + $('<div class="result">...</div>') + .hide() + .appendTo(me) + .load( + $("a", me).attr('href'), + function(e){ + $(this).parent().removeClass('todo'); + if (e.match(/^\s*OK/)) { + $(this).prev().html(e).parent().addClass('ok'); + if ($(this).parent().siblings('dd:not(.ok):not(.na)').length == 0) + $(this).parent().parent().addClass('ok'); + $('#succes').html(parseInt($('#succes').text())+1); + } else if (e.match(/^\s*NA/)) { + $(this).prev().html(e).parent().addClass('na'); + if ($(this).parent().siblings('dd:not(.ok):not(.na)').length == 0) + $(this).parent().parent().addClass('ok'); + } else { + $(this).prev().html('erreur').parent().addClass('erreur'); + $(this).parent().parent().addClass('erreur'); + $('#echec').html(parseInt($('#echec').text())+1); + } + $('#total').html(parseInt($('#total').text())+1); + $('#timer').html(parseInt($('#timer').text()) + (new Date - start)); + doing = false; + } + ); + }, delay); + +}); diff --git a/tests/tests/legacy/squel.php b/tests/tests/legacy/squel.php new file mode 100644 index 0000000000..383acfcd9e --- /dev/null +++ b/tests/tests/legacy/squel.php @@ -0,0 +1,58 @@ +<?php + +declare(strict_types=1); + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +// calcule un test a partir d'un squelette + +$fond = preg_replace('#\.html$#', '', $_GET['test']); + +$debug = (_request('var_mode') === 'debug'); + +define('_INTERDIRE_COMPRESSION_HTML', true); + +$flag_preserver = true; + +tests_init_dossier_squelettes(); + +$contenu = recuperer_fond($fond); + +//include 'spip.php'; + +//$contenu = ob_get_contents(); + +//ob_end_clean(); + +$page = preg_replace('#^filtre:\s*.*\n?#im', '', $contenu); + +// filtres a appliquer + +if (preg_match_all('#^filtre:\s*(\w+)#im', $contenu, $r, PREG_SET_ORDER)) { + foreach ($r as $filtre) { + $page = $filtre[1]($page); + } +} + +$page = trim($page); + +echo $page; + +// Tester si on est admin et il y a des choses supplementaires a dire + +// type tableau pour y mettre des choses au besoin. + +$debug = ($debug || isset($tableau_des_temps) && $tableau_des_temps) ? [1] : []; + +if ($debug) { + $var_mode_affiche = _request('var_mode_affiche'); + $var_mode_objet = _request('var_mode_objet'); + $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet . 'tout'] = ($var_mode_affiche === 'validation' ? $page['texte'] : ''); + echo erreur_squelette(false); +} diff --git a/tests/tests/legacy/squelettes/balise/formulaire_test_phraseur.php b/tests/tests/legacy/squelettes/balise/formulaire_test_phraseur.php new file mode 100644 index 0000000000..cacc1e3ea5 --- /dev/null +++ b/tests/tests/legacy/squelettes/balise/formulaire_test_phraseur.php @@ -0,0 +1,50 @@ +<?php + +declare(strict_types=1); + +/***************************************************************************\ + * SPIP, Systeme de publication pour l'internet * + * * + * Copyright (c) 2001-2020 * + * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * + * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +if (! defined('_ECRIRE_INC_VERSION')) { + return; +} +#securite + +function balise_FORMULAIRE_TEST_PHRASEUR($p) +{ + return calculer_balise_dynamique($p, 'FORMULAIRE_TEST_PHRASEUR', ['id_rubrique']); +} + +function balise_FORMULAIRE_TEST_PHRASEUR_stat($args, $context_compil) +{ + // le denier arg peut contenir l'url sur lequel faire le retour + // exemple dans un squelette article.html : [(#FORMULAIRE_FORUM{#SELF})] + + // recuperer les donnees du forum auquel on repond. + [$idr, $url] = $args; + + return [$idr, $url]; +} + +function balise_FORMULAIRE_TEST_PHRASEUR_dyn($id_rubrique, $url) +{ + $res = 'OK'; + + if (! preg_match("#^\d+$#", $id_rubrique)) { + $res = 'Erreur id_rubrique non numerique : ' . var_export($id_rubrique, 1); + } + + return ['formulaires/test_phraseur', + 0, + [ + 'result' => $res, + ], + ]; +} diff --git a/tests/tests/legacy/squelettes/cache_session_w_1.html b/tests/tests/legacy/squelettes/cache_session_w_1.html new file mode 100644 index 0000000000..7e48e34dc3 --- /dev/null +++ b/tests/tests/legacy/squelettes/cache_session_w_1.html @@ -0,0 +1,2 @@ +<h1>#SQUELETTE</h1> +#INCLURE{fond=inclure/A_session_w,assert_session=1,caller=#SQUELETTE,salt} \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/cache_session_w_2.html b/tests/tests/legacy/squelettes/cache_session_w_2.html new file mode 100644 index 0000000000..d38efe5ef5 --- /dev/null +++ b/tests/tests/legacy/squelettes/cache_session_w_2.html @@ -0,0 +1,4 @@ +<h1>#SQUELETTE</h1> +<INCLURE{fond=inclure/A_session_wo,assert_session=0,caller=#SQUELETTE,salt} /> +#INCLURE{fond=inclure/B_session_w,assert_session=1,caller=#SQUELETTE,salt} +<INCLURE{fond=inclure/C_session_wo,assert_session=0,caller=#SQUELETTE,salt} /> \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/cache_session_w_3.html b/tests/tests/legacy/squelettes/cache_session_w_3.html new file mode 100644 index 0000000000..9a5e4239cb --- /dev/null +++ b/tests/tests/legacy/squelettes/cache_session_w_3.html @@ -0,0 +1,4 @@ +<h1>#SQUELETTE</h1> +#INCLURE{fond=inclure/A_session_w,assert_session=1,caller=#SQUELETTE,salt} +<INCLURE{fond=inclure/B_session_wo,assert_session=0,caller=#SQUELETTE,salt} /> +#INCLURE{fond=inclure/C_session_w,assert_session=1,caller=#SQUELETTE,salt} \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/cache_session_wo_1.html b/tests/tests/legacy/squelettes/cache_session_wo_1.html new file mode 100644 index 0000000000..7b4a405ee1 --- /dev/null +++ b/tests/tests/legacy/squelettes/cache_session_wo_1.html @@ -0,0 +1,2 @@ +<h1>#SQUELETTE</h1> +<INCLURE{fond=inclure/A_session_wo,assert_session=0,caller=#SQUELETTE,salt} /> \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/cache_session_wo_2.html b/tests/tests/legacy/squelettes/cache_session_wo_2.html new file mode 100644 index 0000000000..06e0c1de78 --- /dev/null +++ b/tests/tests/legacy/squelettes/cache_session_wo_2.html @@ -0,0 +1,2 @@ +<h1>#SQUELETTE</h1> +<INCLURE{fond=inclure/A_session_w,assert_session=1,caller=#SQUELETTE,salt} /> \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/cache_session_wo_3.html b/tests/tests/legacy/squelettes/cache_session_wo_3.html new file mode 100644 index 0000000000..d559fe883d --- /dev/null +++ b/tests/tests/legacy/squelettes/cache_session_wo_3.html @@ -0,0 +1,2 @@ +<h1>#SQUELETTE</h1> +#INCLURE{fond=inclure/A_session_wo,assert_session=0,caller=#SQUELETTE,salt} \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/cache_session_wo_4.html b/tests/tests/legacy/squelettes/cache_session_wo_4.html new file mode 100644 index 0000000000..3779e8f0a6 --- /dev/null +++ b/tests/tests/legacy/squelettes/cache_session_wo_4.html @@ -0,0 +1,4 @@ +<h1>#SQUELETTE</h1> +<INCLURE{fond=inclure/A_session_wo,assert_session=0,caller=#SQUELETTE,salt} /> +<INCLURE{fond=inclure/B_session_w,assert_session=1,caller=#SQUELETTE,salt} /> +<INCLURE{fond=inclure/C_session_wo,assert_session=0,caller=#SQUELETTE,salt} /> \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/cache_session_wo_5.html b/tests/tests/legacy/squelettes/cache_session_wo_5.html new file mode 100644 index 0000000000..a156a6ccac --- /dev/null +++ b/tests/tests/legacy/squelettes/cache_session_wo_5.html @@ -0,0 +1,4 @@ +<h1>#SQUELETTE</h1> +<INCLURE{fond=inclure/A_session_w,assert_session=1,caller=#SQUELETTE,salt} /> +<INCLURE{fond=inclure/B_session_wo,assert_session=0,caller=#SQUELETTE,salt} /> +<INCLURE{fond=inclure/C_session_w,assert_session=1,caller=#SQUELETTE,salt} /> \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/cache_session_wo_6.html b/tests/tests/legacy/squelettes/cache_session_wo_6.html new file mode 100644 index 0000000000..ea1f881405 --- /dev/null +++ b/tests/tests/legacy/squelettes/cache_session_wo_6.html @@ -0,0 +1,4 @@ +<h1>#SQUELETTE</h1> +<INCLURE{fond=inclure/A_session_w,assert_session=1,caller=#SQUELETTE,salt} /> +#INCLURE{fond=inclure/B_session_wo,assert_session=0,caller=#SQUELETTE,salt} +<INCLURE{fond=inclure/C_session_w,assert_session=1,caller=#SQUELETTE,salt} /> \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/cache_session_wo_7.html b/tests/tests/legacy/squelettes/cache_session_wo_7.html new file mode 100644 index 0000000000..a5a705d209 --- /dev/null +++ b/tests/tests/legacy/squelettes/cache_session_wo_7.html @@ -0,0 +1,4 @@ +<h1>#SQUELETTE</h1> +#INCLURE{fond=inclure/A_session_wo,assert_session=0,caller=#SQUELETTE,salt} +<INCLURE{fond=inclure/B_session_w,assert_session=1,caller=#SQUELETTE,salt} /> +#INCLURE{fond=inclure/C_session_wo,assert_session=0,caller=#SQUELETTE,salt} \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/formulaires/test_dyn_lang.html b/tests/tests/legacy/squelettes/formulaires/test_dyn_lang.html new file mode 100644 index 0000000000..d749cb29dd --- /dev/null +++ b/tests/tests/legacy/squelettes/formulaires/test_dyn_lang.html @@ -0,0 +1,8 @@ +[(#REM) + + Squelette + (c) 2009 xxx + Distribue sous licence GPL + +] +#ENV{message_ok} \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/formulaires/test_dyn_lang.php b/tests/tests/legacy/squelettes/formulaires/test_dyn_lang.php new file mode 100644 index 0000000000..0c198f4368 --- /dev/null +++ b/tests/tests/legacy/squelettes/formulaires/test_dyn_lang.php @@ -0,0 +1,17 @@ +<?php + +declare(strict_types=1); + +/* + * Plugin xxx + * (c) 2009 xxx + * Distribue sous licence GPL + * + */ + +function formulaires_test_dyn_lang_charger_dist($lang_skel) +{ + return [ + 'message_ok' => $lang_skel === $GLOBALS['spip_lang'] ? 'OK' : "NOK : La langue dans le squelette appelant est {$lang_skel} mais la langue dans charger() est " . $GLOBALS['spip_lang'], + ]; +} diff --git a/tests/tests/legacy/squelettes/formulaires/test_phraseur.html b/tests/tests/legacy/squelettes/formulaires/test_phraseur.html new file mode 100644 index 0000000000..0368c79ae0 --- /dev/null +++ b/tests/tests/legacy/squelettes/formulaires/test_phraseur.html @@ -0,0 +1,8 @@ +[(#REM) + + Squelette + (c) 2009 xxx + Distribue sous licence GPL + +] +#ENV{result} \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/inclure/A_session_w.html b/tests/tests/legacy/squelettes/inclure/A_session_w.html new file mode 100644 index 0000000000..b776cfbd3d --- /dev/null +++ b/tests/tests/legacy/squelettes/inclure/A_session_w.html @@ -0,0 +1,2 @@ +<h1>#SQUELETTE</h1> +#SESSION{nom} \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/inclure/A_session_wo.html b/tests/tests/legacy/squelettes/inclure/A_session_wo.html new file mode 100644 index 0000000000..64268bcc40 --- /dev/null +++ b/tests/tests/legacy/squelettes/inclure/A_session_wo.html @@ -0,0 +1,4 @@ +<h1>#SQUELETTE</h1> +<?php +echo $GLOBALS['visiteur_session']['nom']; +?> diff --git a/tests/tests/legacy/squelettes/inclure/B_session_w.html b/tests/tests/legacy/squelettes/inclure/B_session_w.html new file mode 100644 index 0000000000..b776cfbd3d --- /dev/null +++ b/tests/tests/legacy/squelettes/inclure/B_session_w.html @@ -0,0 +1,2 @@ +<h1>#SQUELETTE</h1> +#SESSION{nom} \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/inclure/B_session_wo.html b/tests/tests/legacy/squelettes/inclure/B_session_wo.html new file mode 100644 index 0000000000..64268bcc40 --- /dev/null +++ b/tests/tests/legacy/squelettes/inclure/B_session_wo.html @@ -0,0 +1,4 @@ +<h1>#SQUELETTE</h1> +<?php +echo $GLOBALS['visiteur_session']['nom']; +?> diff --git a/tests/tests/legacy/squelettes/inclure/C_session_w.html b/tests/tests/legacy/squelettes/inclure/C_session_w.html new file mode 100644 index 0000000000..b776cfbd3d --- /dev/null +++ b/tests/tests/legacy/squelettes/inclure/C_session_w.html @@ -0,0 +1,2 @@ +<h1>#SQUELETTE</h1> +#SESSION{nom} \ No newline at end of file diff --git a/tests/tests/legacy/squelettes/inclure/C_session_wo.html b/tests/tests/legacy/squelettes/inclure/C_session_wo.html new file mode 100644 index 0000000000..64268bcc40 --- /dev/null +++ b/tests/tests/legacy/squelettes/inclure/C_session_wo.html @@ -0,0 +1,4 @@ +<h1>#SQUELETTE</h1> +<?php +echo $GLOBALS['visiteur_session']['nom']; +?> diff --git a/tests/tests/legacy/squelettes/modeles/foreach_test_ul_li.html b/tests/tests/legacy/squelettes/modeles/foreach_test_ul_li.html new file mode 100644 index 0000000000..87c4fba36d --- /dev/null +++ b/tests/tests/legacy/squelettes/modeles/foreach_test_ul_li.html @@ -0,0 +1 @@ +<li>#CLE : #VALEUR</li> diff --git a/tests/tests/legacy/squelettes/modeles/foreach_ul_li.html b/tests/tests/legacy/squelettes/modeles/foreach_ul_li.html new file mode 100644 index 0000000000..ee2013754f --- /dev/null +++ b/tests/tests/legacy/squelettes/modeles/foreach_ul_li.html @@ -0,0 +1 @@ +<li><a href="#ENV{valeur}">#ENV{cle}</a></li> diff --git a/tests/tests/legacy/squelettes/root.html b/tests/tests/legacy/squelettes/root.html new file mode 100644 index 0000000000..8a056c230b --- /dev/null +++ b/tests/tests/legacy/squelettes/root.html @@ -0,0 +1,2 @@ +<h1>#SQUELETTE</h1> +<INCLURE{fond=#ENV{sousfond},assert_session=#ENV{inc_assert_session},caller=#SQUELETTE} /> \ No newline at end of file diff --git a/tests/tests/legacy/test.inc b/tests/tests/legacy/test.inc new file mode 100644 index 0000000000..1870a69ba4 --- /dev/null +++ b/tests/tests/legacy/test.inc @@ -0,0 +1,87 @@ +<?php + +/* + * Ce fichier s'appelle depuis un test.php + * qui doit definir auparavant $test, et faire + * ensuite ses tests. + * + * Si tout est ok, le test doit afficher 'OK' et sortir + * Sinon du debug ou toute indication de la nature de l'échec... + * + */ +// let's go spip +if (!defined('_SPIP_TEST_INC')) { + define('_SPIP_TEST_INC', dirname(dirname(dirname(__FILE__)))); +} +if (!defined('_SPIP_TEST_CHDIR')){ + // si rien defini on va dans le public + define('_SPIP_TEST_CHDIR', dirname(_SPIP_TEST_INC)); +} +chdir(_SPIP_TEST_CHDIR); + +if (!defined('_DIR_TESTS')){ + define('_DIR_TESTS', substr(_SPIP_TEST_INC, strlen(_SPIP_TEST_CHDIR)+1) . '/'); +} + +// pas de _VAR_MODE=recalcul par defaut, ca masque les eventuels problemes de cache +// cf +#if (!defined('_VAR_MODE')) { +# define('_VAR_MODE', 'recalcul'); +#} + +if (!empty($GLOBALS['argv'])) { + // passer les argv en set_request pour compat + $args = $GLOBALS['argv']; + array_shift($args); + $_GET = []; + foreach ($args as $arg) { + $arg = explode('=', $arg, 2); + if (count($arg) === 2) { + $_GET[$arg[0]] = $arg[1]; + } + } +} + + +require_once dirname(_SPIP_TEST_INC) . '/ecrire/inc_version.php'; +include_once __DIR__ . '/test_fonctions.php'; + + +// pour notice sur recuperer_fond() +if (!isset($GLOBALS['spip_lang'])) { + include_spip('inc/lang'); + utiliser_langue_visiteur(); +} + + +// vous devez theoriquement definir $test avant d'inclure ce script +#spip_log('test ' . $test,'testrunner'); +$GLOBALS['taille_des_logs'] = 1024; +$GLOBALS['compteur_essai'] = 0; + +// pas admin ? passe ton chemin (ce script est un vilain trou de securite) +if (!defined('_IS_CLI') or !_IS_CLI) { + if ((!isset($GLOBALS['visiteur_session']['statut']) + OR $GLOBALS['visiteur_session']['statut'] != '0minirezo') + AND !in_array($_SERVER["REMOTE_ADDR"], ['127.0.0.1', '127.0.1.1', '::1']) ) { + die('Administrateur local requis !'); + } +} +else { + $_SERVER['REQUEST_METHOD'] = 'GET'; // eviter des notices dans les tests + tests_loger_webmestre(); +} + +// afficher toutes les erreurs +@ini_set('display_errors', 'On'); +@error_reporting(E_ALL); + +// pour essayer de calculer/montrer le temps qu'on y met +if (!defined('_IS_CLI') or !_IS_CLI) { + register_shutdown_function('afficher_timer', time() + (float)microtime()); +} + +function afficher_timer($depart) { + if (!defined('_NO_TIMER')) + echo sprintf(" %.2fs", time() + (float)microtime() - $depart); +} diff --git a/tests/tests/legacy/test_fonctions.php b/tests/tests/legacy/test_fonctions.php new file mode 100644 index 0000000000..ad58db2cc8 --- /dev/null +++ b/tests/tests/legacy/test_fonctions.php @@ -0,0 +1,289 @@ +<?php + +declare(strict_types=1); + +// pour FineDiff +include_once _SPIP_TEST_INC . '/vendor/autoload.php'; + +function tests_init_dossier_squelettes() +{ + $GLOBALS['dossier_squelettes'] = _DIR_TESTS . 'tests/legacy/squelettes'; +} + +function tests_loger_webmestre() +{ + // il faut charger une session webmestre + include_spip('base/abstract_sql'); + $webmestre = sql_fetsel('*', 'spip_auteurs', "statut='0minirezo' AND webmestre='oui'", '', 'id_auteur', '0,1'); + include_spip('inc/auth'); + auth_loger($webmestre); +} + +/** + * fonction pas obligatoire a utiliser mais qui simplifie la vie du testeur $fun: le nom de la fonction a tester + * $essais: un tableau d'items array(résultat, arg1, arg2 ...) a tester descriptif dans l'index "je teste + * ca"=>array(...) si pas d'index, "test {numero}" sera utilise retourne un tableau de textes d'erreur dont le but est + * d'etre vide :) + */ +function tester_fun($fun, $essais, $opts = []) +{ + // pas d'erreur au depart + $err = []; + + // let's go ! + foreach ($essais as $titre => $ess) { + switch (is_countable($ess) ? count($ess) : 0) { + case 0: $res = null; + break; + case 1: $res = $fun(); + break; + case 2: $res = $fun($ess[1]); + break; + case 3: $res = $fun($ess[1], $ess[2]); + break; + case 4: $res = $fun($ess[1], $ess[2], $ess[3]); + break; + case 5: $res = $fun($ess[1], $ess[2], $ess[3], $ess[4]); + break; + default: + $copy = $ess; + array_shift($copy); + $res = call_user_func_array($fun, $copy); + } + + $ok = false; + $expected = null; + $affdiff = true; + if (is_array($ess) && is_array($ess[0]) && (isset($ess[0][0]) + && is_string($ess[0][0]) && function_exists($ess[0][0]) && isset($ess[0][1]) && isset($ess[0][2]))) { + $ok = ($ess[0][0]($ess[0][1], $res) === $ess[0][2]); + $expected = $ess[0][0] . '(' . sql_quote($ess[0][1]) . ', $res) == ' . sql_quote($ess[0][2]); + $affdiff = false; + } else { + $ok = test_equality($res, $ess[0]); + } + + spip_log( + 'test ' . $GLOBALS['test'] . ' : Essai ' . $GLOBALS['compteur_essai']++ . ($ok ? ' ok' : ' ECHEC'), + 'testrunner' + ); + if (! $ok) { + $erritem_args = []; + $essCount = count($ess); + for ($iarg = 1; $iarg < $essCount; ++$iarg) { + $erritem_args[] = htmlspecialchars(var_export($ess[$iarg], true)); + } + $opts['affdiff'] = $affdiff; + $err[] = display_error($titre, "{$fun}(" . implode(', ', $erritem_args) . ')', $res, $expected ?: $ess[0], $opts); + } + } + + if (defined('_IS_CLI') && _IS_CLI && count($err)) { + exit; + } + + return $err; +} + +class SpipTestFineDiffRenderer extends \cogpowered\FineDiff\Render\Text +{ + public function callback($opcode, $from, $offset, $length): string + { + $content = substr($from, $offset, $length); + switch ($opcode) { + case 'c': + return ' ' . $content . PHP_EOL; + case 'd': + return '- ' . $content . PHP_EOL; + case 'i': + return '+ ' . $content . PHP_EOL; + } + } +} + +function display_error($titre, $call, $result, $expected, $opts = []) +{ + $out = null; + static $bef, $mid, $end; + static $style; + if (defined('_IS_CLI') && _IS_CLI) { + echo "\n/!\ FAIL test `{$titre}`\n--- Expected\n+++ Actual\n@@ @@\n"; + + $from = var_export($expected, true); + + $FineDiff = new \cogpowered\FineDiff\Diff(); + $FineDiff->setRenderer(new SpipTestFineDiffRenderer()); + $FineDiff->setGranularity(new \cogpowered\FineDiff\Granularity\Paragraph()); + echo $FineDiff->render($from, var_export($result, true)); + } else { + if (! isset($bef)) { + // options + foreach ([ + 'out' => '<dt>@</dt><dd class="ei">@</dd>', + ] as $opt => $def) { + ${$opt} = $opts[$opt] ?? $def; + } + + // l'enrobage de sortie + [$bef, $mid, $end] = explode('@', $out); + } + + $affdiff = true; + if (isset($opts['affdiff'])) { + $affdiff = $opts['affdiff']; + } + + if ($style === null) { + $style = '<style>.ei del {background: none repeat scroll 0 0 #FFDDDD;color: #FF0000;text-decoration: none;} + .ei ins {background: none repeat scroll 0 0 #DDFFDD;color: #008000;text-decoration: none;} + .ei pre {word-wrap: break-word} + .ei table {border-collapse: collapse;border:1px solid #BBB;} + .ei td,.ei th{border-collapse: collapse;border:1px solid #BBB;padding:5px;text-align: left} + .ei dt {font-weight: bold;font-size: 1.2em;} + .ei dd {margin-bottom: 1em;} + </style>'; + } else { + $style = ''; + } + + $FineDiff = new \cogpowered\FineDiff\Diff(); + $FineDiff->setRenderer(new \cogpowered\FineDiff\Render\Html()); + $diff = $FineDiff->render(var_export($expected, true), var_export($result, true)); + + return $style + . $bef + . (is_numeric($titre) ? "test {$titre}" : htmlspecialchars($titre)) + . $mid + . "<pre>{$call}</pre>" + . "<table style='width:100%;'><tr><th>diff</th><th>attendu</th><th>resultat</th></tr><tr>" + . '<td><pre>' . ($affdiff ? $diff : $affdiff) . '</pre></td>' + . '<td><pre>' . htmlspecialchars(var_export($expected, true)) . '</pre></td>' + . '<td><pre>' . htmlspecialchars(var_export($result, true)) . '</pre></td>' + . '</tr></table>' + . $end . "\n"; + } +} + +if (! function_exists('array_diff_assoc_recursive')) { + // http://www.php.net/manual/fr/function.array-diff-assoc.php#73972 + function array_diff_assoc_recursive($array1, $array2) + { + foreach ($array1 as $key => $value) { + if (is_array($value)) { + if (! isset($array2[$key])) { + $difference[$key] = $value; + } elseif (! is_array($array2[$key])) { + $difference[$key] = $value; + } else { + $new_diff = array_diff_assoc_recursive($value, $array2[$key]); + if ($new_diff !== []) { + $difference[$key] = $new_diff; + } + } + } elseif (! array_key_exists($key, $array2) || ! test_equality($array2[$key], $value)) { + $difference[$key] = $value; + } + } + + return $difference ?? []; + } +} + +function test_equality($val1, $val2) +{ + if (is_array($val1) && is_array($val2)) { + return ! (is_countable(array_diff_assoc_recursive($val1, $val2)) ? count( + array_diff_assoc_recursive($val1, $val2) + ) : 0) && ! (is_countable( + array_diff_assoc_recursive($val2, $val1) + ) ? count(array_diff_assoc_recursive($val2, $val1)) : 0) + ; + } elseif (is_array($val1) || is_array($val2)) { + return false; + } elseif (is_float($val1) || is_float($val2)) { + return abs($val1 - $val2) <= 1e-10 * abs($val1); + } + return $val1 === $val2; +} + +function tests_legacy_lister($extension = null) +{ + // chercher les bases de tests + $bases = [_DIR_TESTS . 'tests/legacy/unit']; + + foreach (creer_chemin() as $d) { + if ($d && @is_dir("{$d}tests")) { + $bases[] = "{$d}tests"; + } + } + + if (! $extension) { + $extension = 'php|html'; + } + + $liste_fichiers = []; + + foreach ($bases as $base) { + // regarder tous les tests + $tests = preg_files($base .= '/', '/\w+/.*\.(' . $extension . ')$'); + + foreach ($tests as $test) { + $t = (string) _request('rech'); + if (strlen($t) && (strpos($test, $t) === false)) { + continue; + } + + //ignorer le contenu du jeu de squelettes dédié aux tests + if (stristr($test, 'squelettes/')) { + continue; + } + + //ignorer le contenu des donnees de test + if (stristr($test, 'data/')) { + continue; + } + + //ignorer les tests todo + if (stristr($test, '/_todo_')) { + continue; + } + + if (stristr($test, 'bootstrap.php')) { + continue; + } + + $testbasename = basename($test); + // ignorer les vrais tests PHPUnit + if (strlen($testbasename) > 8 && substr($testbasename, -8) === 'Test.php') { + continue; + } + + if (strncmp($testbasename, 'inclus_', 7) !== 0 && substr($testbasename, -14) !== '_fonctions.php' && (strncmp( + $testbasename, + 'NA_', + 3 + ) !== 0 || _request('var_mode') === 'dev')) { + $joli = preg_replace('#\.(php|html)$#', '', basename($test)); + $section = dirname($test); + if (strpos($base, _DIR_TESTS) === 0) { + $section = substr($section, strlen(_DIR_TESTS . '/tests')); + } + + $titre = "{$section}/{$joli}"; + if (isset($liste_fichiers[$titre])) { + $nb = 0; + do { + ++$nb; + $suffixe = '_' . str_pad($nb, 2, '0', STR_PAD_LEFT); + } while (isset($liste_fichiers[$titre . $suffixe])); + + $titre .= $suffixe; + } + + $liste_fichiers[$titre] = $test; + } + } + } + + return $liste_fichiers; +} diff --git a/tests/tests/legacy/unit/abstract_sql/.ok b/tests/tests/legacy/unit/abstract_sql/.ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/tests/legacy/unit/abstract_sql/00_sql_create_drop_view.php b/tests/tests/legacy/unit/abstract_sql/00_sql_create_drop_view.php new file mode 100644 index 0000000000..0695875ead --- /dev/null +++ b/tests/tests/legacy/unit/abstract_sql/00_sql_create_drop_view.php @@ -0,0 +1,76 @@ +<?php + +declare(strict_types=1); + +// nom du test + +$test = 'sql/sql_create_drop_view'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include __DIR__ . '/inc-sql_datas.inc'; + +include_spip('base/abstract_sql'); + +/* + * Creation/suppression/analyse de tables dans la base de donnee + * + * Permet de verifier que + * - tous les champs sont correctement ajoutes + * - que les PRIMARY sont pris en compte + * - que les KEY sont prises en compte + * + */ + +/* + * Lecture de la description des tables + */ + +function test_show_table() +{ + $tables = test_sql_datas(); + $essais = []; + // lire la structure de la table + // la structure doit avoir le meme nombre de champs et de cle + // attention : la primary key DOIT etre dans les cle aussi + foreach ($tables as $t => $d) { + $desc = sql_showtable($t); + $essais["Compter field {$t}"] = [is_countable($d['desc']['field']) ? count($d['desc']['field']) : 0, $desc['field']]; + $essais["Compter key {$t}"] = [$d['desc']['nb_key_attendues'], $desc['key']]; + } + + $err = tester_fun('count', $essais); + if ($err) { + return '<b>Lecture des structures de table en echec</b><dl>' . implode('', $err) . '</dl>'; + } +} + +$err = ''; + +// supprimer les eventuelles tables + +$err .= test_drop_table(); + +// creer les eventuelles tables + +$err .= test_create_table(); + +// lire les structures des tables + +$err .= test_show_table(); + +// supprimer les tables + +$err .= test_drop_table(); + +if ($err !== '' && $err !== '0') { + die($err); +} + +echo 'OK'; diff --git a/tests/tests/legacy/unit/abstract_sql/10_sql_insert_select.php b/tests/tests/legacy/unit/abstract_sql/10_sql_insert_select.php new file mode 100644 index 0000000000..d4d5f92e27 --- /dev/null +++ b/tests/tests/legacy/unit/abstract_sql/10_sql_insert_select.php @@ -0,0 +1,327 @@ +<?php + +declare(strict_types=1); + +// nom du test + +$test = 'sql/sql_insert_select'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include __DIR__ . '/inc-sql_datas.inc'; + +include_spip('base/abstract_sql'); + +/* + * Selection/insertion de tables dans la base de donnee + * + */ + +/* + * Teste que le champ "maj" s'actualise bien sur les update + * ainsi que les autres champs ! + * + * utilise sql_quote, sql_getfetsel, sql_update et sql_updateq. + */ + +function test_maj_timestamp() +{ + $table = 'spip_test_tintin'; + $where = 'id_tintin=' . sql_quote(1); + $err = []; + $essais = []; + + // lecture du timestamp actuel + $maj1 = sql_getfetsel('maj', $table, $where); + if (! $maj1) { + $err[] = "Le champ 'maj' ({$maj1}) n'a vraisemblablement pas recu de timestamp à l'insertion"; + } + + // update + sleep(1); // sinon le timestamp ne change pas ! + $texte = 'nouveau texte'; + sql_update($table, [ + 'un_texte' => sql_quote($texte), + ], $where); + // comparaison timastamp + $maj2 = sql_getfetsel('maj', $table, $where); + if (! $maj2 || ! strtotime($maj2)) { + $err[] = "Le champ 'maj' ({$maj2}) est incorrect suite à l'update"; + } elseif ($maj1 === $maj2) { + $err[] = "Le champ 'maj' ({$maj2}) n'a vraisemblablement pas été mis a jour lors de l'update"; + } + + // comparaison texte + $texte2 = sql_getfetsel('un_texte', $table, $where); + if (! $texte2 || $texte2 !== $texte) { + $err[] = "Le champ 'un_texte' ({$texte2}) n'est pas correctement rempli a l'update"; + } + + // idem avec updateq + sleep(1); // sinon le timestamp ne change pas ! + $texte = 'encore un nouveau texte'; + sql_updateq($table, [ + 'un_texte' => $texte, + ], $where); + // comparaison timastamp + $maj3 = sql_getfetsel('maj', $table, $where); + if (! $maj3 || ! strtotime($maj3)) { + $err[] = "Le champ 'maj' ({$maj3}) est incorrect suite à l'updateq"; + } elseif ($maj3 === $maj2) { + $err[] = "Le champ 'maj' ({$maj3}) n'a vraisemblablement pas été mis a jour lors de l'updateq"; + } + + // comparaison texte + $texte3 = sql_getfetsel('un_texte', $table, $where); + if (! $texte3 || $texte3 !== $texte) { + $err[] = "Le champ 'un_texte' ({$texte2}) n'est pas correctement rempli a l'update"; + } + + // affichage + if ($err) { + return "<b>Champ maj sur update</b><dl>\n<dd>" . implode("</dd>\n<dd>", $err) . '</dd></dl>'; + } +} + +/* + * Selections diverses selon criteres + * - + */ + +function test_selections() +{ + $nb_data = null; + $err = []; + $essais = []; + $desc = test_sql_datas(); + $nb_data = is_countable($desc['spip_test_tintin']['data']) ? count($desc['spip_test_tintin']['data']) : 0; + // selection simple + $res = sql_select('*', 'spip_test_tintin'); + if (($nb = sql_count($res)) !== $nb_data) { + $err[] = "1.sql_count ({$nb}) ne renvoie pas : {$nb_data} elements"; + } + + // selection float + $res = sql_select('*', 'spip_test_tintin', ['un_double>' . sql_quote(3)]); + $elems = $desc['spip_test_tintin']['data']; + $n = 0; + foreach ($elems as $a => $b) { + foreach ($b as $c => $d) { + if ($c === 'un_double' && $d > 3) { + ++$n; + } + } + } + + if (($nb = sql_count($res)) !== $n) { + $err[] = "2.sql_count ({$nb}) ne renvoie pas : {$n} elements"; + } + + // selection REGEXP + // ! chiffre en dur ! + $res = sql_select('*', 'spip_test_tintin', ['un_varchar REGEXP ' . sql_quote('^De')]); + if (($nb = sql_count($res)) !== 1) { + $err[] = "3.sql_select comprends mal REGEXP ({$nb} resultats au lieu de 1)"; + } + + // selection LIKE + // ! chiffre en dur ! + $res = sql_select('*', 'spip_test_tintin', ['un_varchar LIKE ' . sql_quote('De%')]); + if (($nb = sql_count($res)) !== 1) { + $err[] = "4.sql_select comprends mal LIKE ({$nb} resultats au lieu de 1)"; + } + + // selection array(champs) + $res = sql_fetsel(['id_tintin', 'un_varchar'], 'spip_test_tintin'); + if (! isset($res['id_tintin']) || ! isset($res['un_varchar'])) { + $err[] = '5.sql_select comprends mal une selection : array(champ1, champ2)'; + } + + // selection array(champs=>alias) + $res = sql_fetsel(['id_tintin AS id', 'un_varchar AS vchar'], 'spip_test_tintin'); + if (! isset($res['id']) || ! isset($res['vchar'])) { + $err[] = '6.sql_select comprends mal une selection : array(champ1 AS alias1, champ2 AS alias2)'; + } + + // selection avec sql_multi + $res = sql_select(['id_milou', sql_multi('grrrr', 'fr')], 'spip_test_milou', '', '', 'multi'); + if (sql_count($res) !== $nb_data) { + $err[] = '7.sql_multi mal interprete'; + } + + $rs = sql_fetch($res); + $id1 = intval($rs['id_milou']); + $rs = sql_fetch($res); + $id2 = intval($rs['id_milou']); + $rs = sql_fetch($res); + $id3 = intval($rs['id_milou']); + if ($id1 !== 3 && $id2 !== 2 && $id3 !== 1) { + $err[] = "8.sql_multi order by multi rate : ordre ({$id1}, {$id2}, {$id3}) - attendu : (3, 2, 1)"; + } + + // le bon texte avec multi + foreach ([ + 'fr' => 'Crac', + 'en' => 'Krack', + ] as $lg => $res) { + $multi = sql_getfetsel(sql_multi('grrrr', $lg), 'spip_test_milou', 'id_milou=' . sql_quote(2)); + if ($multi !== $res) { + $err[] = "9.sql_multi {$lg} mal rendu : retour : " . htmlentities($multi) . ', attendu : ' . htmlentities($res); + } + } + + // le bon texte avec multi et accents + foreach ([ + 'fr' => 'Aérien', + 'en' => 'Aérieny', + ] as $lg => $res) { + $multi = sql_getfetsel(sql_multi('alcool', $lg), 'spip_test_haddock', 'id_haddock=' . sql_quote(2)); + if ($multi !== $res) { + $err[] = "10.sql_multi {$lg} mal rendu : retour : " . htmlentities($multi) . ', attendu : ' . htmlentities($res); + } + } + + // le bon texte avec multi et debut et fin de chaine + foreach ([ + 'fr' => 'Un début de chaine : Vinasse, et [la fin]', + 'en' => 'Un début de chaine : Vinassy, et [la fin]', + 'de' => 'Un début de chaine : Vinasse, et [la fin]', + ] as $lg => $res) { + $multi = sql_getfetsel(sql_multi('alcool', $lg), 'spip_test_haddock', 'id_haddock=' . sql_quote(4)); + if ($multi !== $res) { + $err[] = "11.sql_multi [{$lg}] mal rendu : retour : " . htmlentities($multi) . ', attendu : ' . htmlentities($res); + } + } + + // affichage + if ($err !== []) { + return "<b>Selections</b><dl>\n<dd>" . implode("</dd>\n<dd>", $err) . '</dd></dl>'; + } +} + +/* + * Selections diverses entre plusieurs tables + * - + */ + +function test_selections_entre_table() +{ + $err = []; + $essais = []; + // selection 2 tables + // ! nombre en dur ! + $res = sql_select( + ['spip_test_tintin.id_tintin', 'spip_test_milou.id_milou'], + ['spip_test_tintin', 'spip_test_milou'], + ['spip_test_milou.id_tintin=spip_test_tintin.id_tintin'] + ); + if (! ($nb = sql_count($res) === 3)) { + $err[] = "selection sur 2 tables avec where en echec : attendu 3 reponses, présentes : {$nb}"; + } + + // selection 2 tables avec alias => + // ! nombre en dur ! + $res = sql_select( + ['a.id_tintin AS x', 'b.id_milou AS y'], + [ + 'a' => 'spip_test_tintin', + 'b' => 'spip_test_milou', + ], + ['a.id_tintin=b.id_tintin'] + ); + if (! ($nb = sql_count($res) === 3)) { + $err[] = "From avec alias en echec (3 reponses attendues) - présentes : {$nb}"; + } + + // selection 2 tables avec alias AS + // ! nombre en dur ! + $res = sql_select( + ['a.id_tintin AS x', 'b.id_milou AS y'], + ['spip_test_tintin AS a', 'spip_test_milou AS b'], + ['a.id_tintin=b.id_tintin'] + ); + if (($nb = sql_count($res)) !== 3) { + $err[] = "From avec alias AS en echec (3 reponses attendues) - présentes : {$nb}"; + } + + // selection 2 tables avec INNER JOIN + ON + // ! nombre en dur ! + $res = sql_select( + ['a.id_tintin AS x', 'b.id_milou AS y'], + ['spip_test_tintin AS a INNER JOIN spip_test_milou AS b ON (a.id_tintin=b.id_tintin)'] + ); + if (($nb = sql_count($res)) !== 3) { + $err[] = "Echec INNER JOIN + ON (3 reponses attendues, présentes : {$nb})"; + } + + // selection 2 tables avec LEFT JOIN + ON + // ! nombre en dur ! + $res = sql_select( + ['a.id_tintin AS x', 'b.id_milou AS y'], + ['spip_test_tintin AS a LEFT JOIN spip_test_milou AS b ON (a.id_tintin=b.id_tintin)'] + ); + if (($nb = sql_count($res)) !== 4) { + $err[] = "Echec LEFT JOIN + ON (4 reponses attendues, présentes : {$nb})"; + } + + // selection 2 tables avec jointure INNER JOIN + USING + // ! nombre en dur ! + // SQLite 2 se plante : il ne connait pas USING (enleve de la requete, + // et du coup ne fait pas correctement la jointure) + $res = sql_select( + ['a.id_tintin AS x', 'b.id_milou AS y'], + ['spip_test_tintin AS a INNER JOIN spip_test_milou AS b USING (id_tintin)'] + ); + if (($nb = sql_count($res)) !== 3) { + $err[] = "Echec INNER JOIN + USING (3 reponses attendues, présentes : {$nb})"; + } + + // affichage + if ($err) { + return "<b>Selections multi tables</b><dl>\n<dd>" . implode("</dd>\n<dd>", $err) . '</dd></dl>'; + } +} + +$err = ''; + +// supprimer les eventuelles tables + +$err .= test_drop_table(); + +// creer les eventuelles tables + +$err .= test_create_table(); + +// inserer les donnees dans la table + +$err .= test_insert_data(); + +// test maj timestamp automatique (select, update, comparaison) + +// ! il prend 3 secondes volontairement ! + +$err .= test_maj_timestamp(); + +// tests de selections + +$err .= test_selections(); + +// tests de selections entre 2 tables et jointures + +$err .= test_selections_entre_table(); + +// supprimer les tables + +$err .= test_drop_table(); + +if ($err !== '' && $err !== '0') { + die($err); +} + +echo 'OK'; diff --git a/tests/tests/legacy/unit/abstract_sql/20_sql_update_delete.php b/tests/tests/legacy/unit/abstract_sql/20_sql_update_delete.php new file mode 100644 index 0000000000..eeb5ccad6c --- /dev/null +++ b/tests/tests/legacy/unit/abstract_sql/20_sql_update_delete.php @@ -0,0 +1,108 @@ +<?php + +declare(strict_types=1); + +// nom du test + +$test = 'sql/sql_update_delete'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include __DIR__ . '/inc-sql_datas.inc'; + +include_spip('base/abstract_sql'); + +/* + * Update/delete, de tables dans la base de donnee + * + */ + +/* + * Updates + */ + +function test_update_data() +{ + $err = []; + $essais = []; + // ajouter un champ + $nb = sql_getfetsel('un_bigint', 'spip_test_tintin', 'id_tintin=' . sql_quote(1)); + sql_update('spip_test_tintin', [ + 'un_bigint' => 'un_bigint+2', + ]); + $nb2 = sql_getfetsel('un_bigint', 'spip_test_tintin', 'id_tintin=' . sql_quote(1)); + if ($nb + 2 != $nb2) { + $err[] = "sql_update n'a pas fait l'adition ! ({$nb} + 2 != {$nb2})"; + } + + // affichage + if ($err) { + return '<b>Updates</b><dl><dd>' . implode('</dd><dd>', $err) . '</dd></dl>'; + } +} + +/* + * Delete + */ + +function test_delete_data() +{ + $err = []; + $essais = []; + // supprimer une colonne + sql_delete('spip_test_tintin', 'id_tintin=' . sql_quote(1)); + $nb = sql_countsel('spip_test_tintin'); + if ($nb !== 2) { + $err[] = "sql_delete n'a rate sa suppression de id_tintin=1"; + } + + // supprimer une colonne + sql_delete('spip_test_tintin'); + $nb = sql_countsel('spip_test_tintin'); + if ($nb !== 0) { + $err[] = "sql_delete n'a rate le vidage de la table spip_test_tintin"; + } + + // affichage + if ($err) { + return '<b>Updates</b><dl><dd>' . implode('</dd><dd>', $err) . '</dd></dl>'; + } +} + +$err = ''; + +// supprimer les eventuelles tables + +$err .= test_drop_table(); + +// creer les eventuelles tables + +$err .= test_create_table(); + +// inserer les donnees dans la table + +$err .= test_insert_data(); + +// mettre a jour les donnees dans la table + +$err .= test_update_data(); + +// supprimer les donnees dans la table + +$err .= test_delete_data(); + +// supprimer les tables + +$err .= test_drop_table(); + +if ($err !== '' && $err !== '0') { + die($err); +} + +echo 'OK'; diff --git a/tests/tests/legacy/unit/abstract_sql/30_sql_alter.php b/tests/tests/legacy/unit/abstract_sql/30_sql_alter.php new file mode 100644 index 0000000000..5cd85fb536 --- /dev/null +++ b/tests/tests/legacy/unit/abstract_sql/30_sql_alter.php @@ -0,0 +1,309 @@ +<?php + +declare(strict_types=1); + +// nom du test + +$test = 'sql/sql_alter'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include __DIR__ . '/inc-sql_datas.inc'; + +include_spip('base/abstract_sql'); + +/* + * alter de tables dans la base de donnee + */ + +/* + * Alter colonne + */ + +function test_alter_colonne() +{ + $err = []; + $essais = []; + $table = 'spip_test_tintin'; + + // supprimer une colonne + sql_alter("TABLE {$table} DROP COLUMN un_bigint"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate DROP COLUMN (plus de table ou sql_showtable en erreur?)'; + } elseif (isset($desc['field']['un_bigint'])) { + $err[] = 'sql_alter rate DROP COLUMN'; + } + + // supprimer une colonne (sans COLUMN) + sql_alter("TABLE {$table} DROP un_smallint"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate DROP sans COLUMN (plus de table ou sql_showtable en erreur?)'; + } elseif (isset($desc['field']['un_smallint'])) { + $err[] = 'sql_alter rate DROP sans COLUMN'; + } + + // renommer une colonne + sql_alter("TABLE {$table} CHANGE un_varchar deux_varchars VARCHAR(30) NOT NULL DEFAULT ''"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate CHANGE (plus de table ou sql_showtable en erreur?)'; + } elseif ((isset($desc['field']['un_varchar']) || ! isset($desc['field']['deux_varchars']))) { + $err[] = 'sql_alter rate CHANGE'; + } + + // changer le type d'une colonne + $table = 'spip_test_milou'; + sql_alter("TABLE {$table} MODIFY schtroumf TEXT NOT NULL DEFAULT ''"); + $desc = sql_showtable($table); + $s = $desc['field']['schtroumf']; + if (! $s || stripos($s, 'TEXT') === false) { + $err[] = "sql_alter rate MODIFY varchar en text : {$s}"; + } + + // ajouter des colonnes + sql_alter("TABLE {$table} ADD COLUMN houba BIGINT(21) NOT NULL DEFAULT '0'"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate ADD COLUMN houba (plus de table ou sql_showtable en erreur?)'; + } elseif (! $s = $desc['field']['houba']) { + $err[] = "sql_alter rate ADD COLUMN houba : {$s}"; + } + + // ajouter des colonnes avec "AFTER" + sql_alter("TABLE {$table} ADD COLUMN hop BIGINT(21) NOT NULL DEFAULT '0' AFTER id_tintin"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate ADD COLUMN hop AFTER (plus de table ou sql_showtable en erreur?)'; + } elseif (! $s = $desc['field']['hop']) { + $err[] = "sql_alter rate ADD COLUMN hop AFTER ... : {$s}"; + } + + // affichage + if ($err) { + return '<b>Alter : drop column</b><dl><dd>' . implode('</dd><dd>', $err) . '</dd></dl>'; + } +} + +/* + * Renomme table + */ + +function test_alter_renomme_table() +{ + $err = []; + $essais = []; + $table = 'spip_test_tintin'; + + // renommer une table + sql_alter("TABLE {$table} RENAME spip_test_castafiore"); + $desc = sql_showtable($table); + $desc2 = sql_showtable('spip_test_castafiore'); + if ($desc || ! $desc2) { + $err[] = 'sql_alter rate RENAME table'; + } + + // affichage + if ($err) { + return '<b>Alter : renomme table</b><dl><dd>' . implode('</dd><dd>', $err) . '</dd></dl>'; + } +} + +/* + * pointer l'index + */ + +function test_alter_index() +{ + $err = []; + $essais = []; + $table = 'spip_test_milou'; + + // supprimer un index + sql_alter("TABLE {$table} DROP INDEX sons"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate DROP INDEX sons (plus de table ou sql_showtable en erreur?)'; + } elseif (isset($desc['key']['KEY sons'])) { + $err[] = 'sql_alter rate DROP INDEX sons'; + } + + // ajouter un index simple + sql_alter("TABLE {$table} ADD INDEX (wouaf)"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate ADD INDEX (wouaf) (plus de table ou sql_showtable en erreur?)'; + } elseif (! isset($desc['key']['KEY wouaf'])) { + $err[] = 'sql_alter rate ADD INDEX (wouaf)'; + } + + // ajouter un index nomme + sql_alter("TABLE {$table} ADD INDEX pluie (grrrr)"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate ADD INDEX pluie (grrrr) (plus de table ou sql_showtable en erreur?)'; + } elseif (! isset($desc['key']['KEY pluie'])) { + $err[] = 'sql_alter rate ADD INDEX pluie (grrrr)'; + } + + // supprimer un index + sql_alter("TABLE {$table} DROP INDEX pluie"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate DROP INDEX pluie (plus de table ou sql_showtable en erreur?)'; + } elseif (isset($desc['key']['KEY pluie'])) { + $err[] = 'sql_alter rate DROP INDEX pluie'; + } + + // ajouter un index nomme double + sql_alter("TABLE {$table} ADD INDEX dring (grrrr, wouaf)"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate ADD INDEX dring (grrrr, wouaf) (plus de table ou sql_showtable en erreur?)'; + } elseif (! isset($desc['key']['KEY dring'])) { + $err[] = 'sql_alter rate ADD INDEX dring (grrrr, wouaf)'; + } + + // affichage + if ($err) { + return '<b>Alter : index</b><dl><dd>' . implode('</dd><dd>', $err) . '</dd></dl>'; + } +} + +/* + * dezinguer la primary + */ + +function test_alter_primary() +{ + $err = []; + $essais = []; + $table = 'spip_test_kirikou'; + + // creer une table pour jouer + sql_create( + $table, + [ + 'un' => 'INTEGER NOT NULL', + 'deux' => 'INTEGER NOT NULL', + 'trois' => 'INTEGER NOT NULL', + ], + [ + 'PRIMARY KEY' => 'un', + ] + ); + + // supprimer une primary + $desc = sql_showtable($table); + sql_alter("TABLE {$table} DROP PRIMARY KEY"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate DROP PRIMARY KEY (plus de table ou sql_showtable en erreur?)'; + } elseif (isset($desc['key']['PRIMARY KEY'])) { + $err[] = 'sql_alter rate DROP PRIMARY KEY'; + } + + // ajouter une primary + $desc = sql_showtable($table); + sql_alter("TABLE {$table} ADD PRIMARY KEY (deux, trois)"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate ADD PRIMARY KEY (plus de table)'; + } elseif (! isset($desc['key']['PRIMARY KEY'])) { + $err[] = 'sql_alter rate ADD PRIMARY KEY (deux, trois)'; + } + + // affichage + if ($err) { + return '<b>Alter : primary key</b><dl><dd>' . implode('</dd><dd>', $err) . '</dd></dl>'; + } +} + +/* + * Alter colonne + */ + +function test_alter_multiple() +{ + $err = []; + $essais = []; + $table = 'spip_test_milou'; + + // supprimer des colonnes + sql_alter("TABLE {$table} DROP INDEX dring, DROP COLUMN wouaf, DROP COLUMN grrrr"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate DROP INDEX dring, DROP COLUMN wouaf, DROP COLUMN grrrr (plus de table ou sql_showtable en erreur?)'; + } elseif ( + isset($desc['field']['waouf']) || isset($desc['field']['grrrr']) || isset($desc['key']['KEY dring']) + ) { + $err[] = 'sql_alter rate DROP INDEX dring, DROP COLUMN wouaf, DROP COLUMN grrrr'; + } + + // ajouter des colonnes + sql_alter("TABLE {$table} ADD COLUMN a INT, ADD COLUMN b INT, ADD COLUMN c INT, ADD INDEX abc (a,b,c)"); + $desc = sql_showtable($table); + if (! $desc) { + $err[] = 'sql_alter rate ADD COLUMN a INT, ADD COLUMN b INT, ADD COLUMN c INT, ADD INDEX abc (a,b,c) (plus de table ou sql_showtable en erreur?)'; + } elseif ( + ! $desc['field']['a'] || ! $desc['field']['b'] || ! $desc['field']['c'] || ! $desc['key']['KEY abc'] + ) { + $err[] = 'sql_alter rate ADD COLUMN a INT, ADD COLUMN b INT, ADD COLUMN c INT, ADD INDEX abc (a,b,c)'; + } + + // affichage + if ($err) { + return '<b>Alter : multiples</b><dl><dd>' . implode('</dd><dd>', $err) . '</dd></dl>'; + } +} + +$err = ''; + +// supprimer les eventuelles tables + +$err .= test_drop_table(); + +sql_drop_table('spip_test_castafiore', true); + +sql_drop_table('spip_test_kirikou', true); + +// creer les eventuelles tables + +$err .= test_create_table(); + +// inserer les donnees dans la table + +$err .= test_insert_data(); + +// series d'alter + +$err .= test_alter_colonne(); + +$err .= test_alter_renomme_table(); + +$err .= test_alter_index(); + +$err .= test_alter_primary(); + +$err .= test_alter_multiple(); + +// supprimer les tables + +$err .= test_drop_table(); + +sql_drop_table('spip_test_castafiore', true); + +sql_drop_table('spip_test_kirikou', true); + +if ($err !== '' && $err !== '0') { + die($err); +} + +echo 'OK'; diff --git a/tests/tests/legacy/unit/abstract_sql/40_sql_divers.php b/tests/tests/legacy/unit/abstract_sql/40_sql_divers.php new file mode 100644 index 0000000000..8148428f6f --- /dev/null +++ b/tests/tests/legacy/unit/abstract_sql/40_sql_divers.php @@ -0,0 +1,164 @@ +<?php + +declare(strict_types=1); + +// nom du test + +$test = 'sql/sql_divers'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include __DIR__ . '/inc-sql_datas.inc'; + +include_spip('base/abstract_sql'); + +/* + * Selections mathematiques + */ + +function test_func_mathematiques() +{ + $err = []; + $essais = []; + // + foreach ([ + 'COUNT' => 3, + 'SUM' => 9000, + 'AVG' => 3000, + ] as $func => $attendu) { + $nb = sql_getfetsel("{$func}(un_int) AS nb", ['spip_test_tintin']); + if ($nb != $attendu) { + $err[] = "Selection {$func} en echec : attendu : {$attendu}, recu : {$nb}"; + } + } + + // + foreach ([ + 'EXP(0)' => exp(0), + 'ROUND(3.56)' => round(3.56), + 'ROUND(3.5684,2)' => round(3.5684, 2), + 'SQRT(9)' => 3, + //'1/2'=>(0), // Le standard SQL : entier divise par entier = division entiere (pas trouve la reference) + '1.0/2' => (1 / 2), // Le standart SQL : reel divise par entier = reel + //'4/3'=>1, + 'ROUND(4.0/3,2)' => round(4 / 3, 2), + '1.5/2' => (1.5 / 2), + '2.0/2' => (2.0 / 2), + '2/2' => (2 / 2), + 'md5(8)' => md5("8"), + 'md5(' . sql_quote('a') . ')' => md5('a'), + ] as $func => $attendu) { + $nb = sql_getfetsel("{$func} AS nb", ['spip_test_tintin'], ['id_tintin=' . sql_quote(1)]); + if ($nb != $attendu) { + $err[] = "Selection {$func} en echec : attendu : {$attendu}, recu : {$nb}"; + } + } + + // affichage + if ($err !== []) { + return '<b>Selections multi tables</b><dl><dd>' . implode('</dd><dd>', $err) . '</dd></dl>'; + } +} + +/* + * Selections mathematiques + */ + +function test_func_strings() +{ + $err = []; + $essais = []; + // + foreach ([ + 'CONCAT(' . sql_quote('cou') . ',' . sql_quote('cou') . ')' => 'coucou', + 'CONCAT(' . sql_quote('cou,') . ',' . sql_quote('cou') . ')' => 'cou,cou', + ] as $func => $attendu) { + $nb = sql_getfetsel("{$func} AS nb", ['spip_test_tintin'], ['id_tintin=' . sql_quote(1)]); + if ($nb !== $attendu) { + $err[] = "Selection {$func} en echec : attendu : {$attendu}, recu : {$nb}"; + } + } + + // affichage + if ($err !== []) { + return '<b>Selections strings</b><dl><dd>' . implode('</dd><dd>', $err) . '</dd></dl>'; + } +} + +/* + * retours des fonctions d'erreurs lors d'une requete + */ + +function test_func_error() +{ + $err = []; + + // requete sans erreur + sql_select('*', 'spip_test_tintin'); + if (sql_error() !== '') { + $err[] = "sql_error() non vide lors d'une requete sans erreur"; + } + + if (sql_errno() !== 0) { + $err[] = "sql_errno() ne retourne pas 0 lors d'une requete sans erreur"; + } + + // requete en erreur + sql_select('*', 'spip_test_toto'); + if (sql_error() === '') { + $err[] = "sql_error() vide lors d'une requete en erreur"; + } + + if (sql_errno() === 0) { + $err[] = "sql_errno() retourne 0 lors d'une requete en erreur"; + } + + // affichage + if ($err) { + return "<b>Retours fonctions d'erreur</b><dl><dd>" . implode('</dd><dd>', $err) . '</dd></dl>'; + } +} + +$err = ''; + +// supprimer les eventuelles tables + +$err .= test_drop_table(); + +// creer les eventuelles tables + +$err .= test_create_table(); + +// inserer les donnees dans la table + +$err .= test_insert_data(); + +// test de fonctions mathematiques + +$err .= test_func_mathematiques(); + +// test de fonctions string + +$err .= test_func_strings(); + +// test des fonctions d'erreur + +$err .= test_func_error(); + +// supprimer les tables + +$err .= test_drop_table(); + +// affichage + +if ($err !== '' && $err !== '0') { + die($err); +} + +echo 'OK'; diff --git a/tests/tests/legacy/unit/abstract_sql/inc-sql_datas.inc b/tests/tests/legacy/unit/abstract_sql/inc-sql_datas.inc new file mode 100644 index 0000000000..7096c22a5b --- /dev/null +++ b/tests/tests/legacy/unit/abstract_sql/inc-sql_datas.inc @@ -0,0 +1,211 @@ +<?php + +/* + * Jeu de donnees pour les differents fichiers de tests sql + * + * Quelques fonctions utilises souvent : + * - test_create_table + * - test_drop_table + */ + +/* + * tableaux des donnees + * + */ +function test_sql_datas(){ + $table_tintin = [ + 'field'=> [ + "id_tintin" => "INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY", + "un_bigint" => "BIGINT(21) NOT NULL DEFAULT '0'", + "un_int" => "BIGINT(21) NOT NULL DEFAULT '0'", + "un_smallint" => "SMALLINT(3) NOT NULL DEFAULT '0'", + "un_double" => "DOUBLE NOT NULL DEFAULT '0'", + "un_tinyint" => "TINYINT(2) NOT NULL DEFAULT '0'", + "un_varchar" => "VARCHAR(30) NOT NULL DEFAULT ''", + "un_texte" => "TEXT NOT NULL DEFAULT ''", + "maj" => "TIMESTAMP" + ], + 'key'=>[ + + ], + 'nb_key_attendues'=>1 // attention : la primary key DOIT etre dans les cle aussi + ]; + $data_tintin = [ + [ + "id_tintin" => 1, + "un_bigint" => 30000, + "un_int" => 2000, + "un_smallint" => 40, + "un_double" => 2.58, + "un_tinyint" => 8, + "un_varchar" => "Premier varchar", + "un_texte" => "Premier texte", + //"maj" => "" // doit se remplir automatiquement + ], + [ + "id_tintin" => 2, + "un_bigint" => 40000, + "un_int" => 3000, + "un_smallint" => 50, + "un_double" => 3.58, + "un_tinyint" => 9, + "un_varchar" => "Deuxieme varchar", + "un_texte" => "Second texte", + //"maj" => "" // doit se remplir automatiquement + ], + [ + "id_tintin" => 3, + "un_bigint" => 60000, + "un_int" => 4000, + "un_smallint" => 70, + "un_double" => 8.58, + "un_tinyint" => 3, + "un_varchar" => "Troisieme varchar", + "un_texte" => "Troisieme texte", + //"maj" => "" // doit se remplir automatiquement + ] + ]; + + $table_milou = [ + 'field'=> [ + "id_milou" => "INTEGER NOT NULL AUTO_INCREMENT", + "id_tintin" => "INTEGER NOT NULL", + "un_enum" => "ENUM('blanc','noir') NOT NULL DEFAULT 'blanc'", + "wouaf" => "VARCHAR(80) NOT NULL DEFAULT ''", + "grrrr" => "VARCHAR(80) NOT NULL DEFAULT ''", + "schtroumf" => "VARCHAR(80) NOT NULL DEFAULT ''", + "maj" => "TIMESTAMP" + ], + 'key'=>[ + "PRIMARY KEY" => "id_milou", + "KEY id_tintin" => "id_tintin", + "KEY sons" => "wouaf, grrrr", + ], + 'nb_key_attendues'=>3 // attention : la primary key DOIT etre dans les cle aussi + ]; + $data_milou = [ + [ + "id_milou" => 1, + "id_tintin" => 1, + "un_enum" => "blanc", + "wouaf" => "Warf !!", + "grrrr" => "Grogne !", + // "maj" => "" // doit se remplir automatiquement + ], + [ + "id_milou" => 2, + "id_tintin" => 1, + "un_enum" => "noir", + "wouaf" => "Wouf", + "grrrr" => "<multi>[fr]Crac[en]Krack</multi>", + // "maj" => "" // doit se remplir automatiquement + ], + [ + "id_milou" => 3, + "id_tintin" => 2, + "un_enum" => "blanc", + "wouaf" => "Wif", + "grrrr" => "Ahrg", + // "maj" => "" // doit se remplir automatiquement + ], + ]; + + $table_haddock = [ + 'field'=> [ + "id_haddock" => "INTEGER NOT NULL AUTO_INCREMENT", + "alcool" => "VARCHAR(80) NOT NULL DEFAULT ''", + + ], + 'key'=>[ + "PRIMARY KEY" => "id_haddock", + ], + 'nb_key_attendues'=>1 // attention : la primary key DOIT etre dans les cle aussi + ]; + $data_haddock = [ + [ + "id_haddock" => 1, + "alcool" => "<multi>[fr]Agile[en]Agily</multi>", + ], + [ + "id_haddock" => 2, + "alcool" => "<multi>[fr]Aérien[en]Aérieny</multi>", + ], + [ + "id_haddock" => 3, + "alcool" => "<multi>[fr]Vinasse[en]Vinassy</multi>", + ], + [ + "id_haddock" => 4, + "alcool" => "Un début de chaine : <multi>[fr]Vinasse[en]Vinassy</multi>, et [la fin]", + ], + ]; + + return [ + 'spip_test_tintin'=>[ + 'desc'=>$table_tintin, + 'data'=>$data_tintin + ], + 'spip_test_milou'=>[ + 'desc'=>$table_milou, + 'data'=>$data_milou + ], + 'spip_test_haddock'=>[ + 'desc'=>$table_haddock, + 'data'=>$data_haddock + ], + ]; +} + +/* + * Suppression de tables + */ +function test_drop_table(){ + $tables = test_sql_datas(); + $essais = []; + $err = []; + foreach ($tables as $t=>$v){ + $essais["Suppression table $t si existe"] = [true, $t, true]; // reponse, arguments + } + $err = tester_fun('sql_drop_table', $essais); // DROP IF EXISTS + if ($err) { + return '<b>Suppression de table en echec</b><dl>' . join('', $err) . '</dl>'; + } +} + +/* + * Creation des tables + */ +function test_create_table(){ + $tables = test_sql_datas(); + $essais = []; + $err = []; + foreach ($tables as $t=>$v){ + if (!sql_create($t, $v['desc']['field'], $v['desc']['key'])) + $err[] = "sql_create $t en echec"; // reponse, arguments + } + if ($err) { + return '<b>Creation de table en echec</b><dl>' . join('', $err) . '</dl>'; + } +} + + + +/* + * Insertion de champs multiples sql_insertq_multi + * et comptage avec sql_countsel + */ +function test_insert_data() { + $tables = test_sql_datas(); + $essais = []; + // inserer les donnees dans la table + foreach ($tables as $t=>$d){ + sql_insertq_multi($t, $d['data']); + $essais[] = [count($d['data']),$t]; + } + $err = tester_fun('sql_countsel', $essais); + if ($err) { + return '<b>Insertion multiple puis countsel dans table</b><dl>' . join('', $err) . '</dl>'; + } +} + +?> diff --git a/tests/tests/legacy/unit/balises/balise_dyn_langue.html b/tests/tests/legacy/unit/balises/balise_dyn_langue.html new file mode 100644 index 0000000000..927f1d2929 --- /dev/null +++ b/tests/tests/legacy/unit/balises/balise_dyn_langue.html @@ -0,0 +1,16 @@ +[(#REM) + + Squelette + (c) 2009 xxx + Distribue sous licence GPL + +] +[(#REM) Ici on est dans la #LANG fixee dans le fichier _fonctions] +<BOUCLE_art(ARTICLES){lang!=#LANG}{0,1}> +[(#REM) Ici on est dans une autre langue : celle de l'article +On envoie cette langue au formulaire qui va verifier qu'elle correspond a sa globale spip_lang +] +#FORMULAIRE_TEST_DYN_LANG{#LANG} +</BOUCLE_art> +NA : Impossible de trouver un article dans une autre langue que #LANG +<//B_art> diff --git a/tests/tests/legacy/unit/balises/balise_dyn_langue_fonctions.php b/tests/tests/legacy/unit/balises/balise_dyn_langue_fonctions.php new file mode 100644 index 0000000000..bdd508a6c3 --- /dev/null +++ b/tests/tests/legacy/unit/balises/balise_dyn_langue_fonctions.php @@ -0,0 +1,6 @@ +<?php + +declare(strict_types=1); + +// placer une langue globale arbitraire +$GLOBALS['spip_lang'] = 'ar'; diff --git a/tests/tests/legacy/unit/balises/balise_dyn_langue_modele.html b/tests/tests/legacy/unit/balises/balise_dyn_langue_modele.html new file mode 100644 index 0000000000..1da128db9d --- /dev/null +++ b/tests/tests/legacy/unit/balises/balise_dyn_langue_modele.html @@ -0,0 +1,17 @@ +[(#REM) + + Squelette + (c) 2009 xxx + Distribue sous licence GPL + +] +[(#REM) Ici on est dans la #LANG fixee dans le fichier _fonctions] +<BOUCLE_art(ARTICLES){lang!=#LANG}{0,1}> +[(#REM) Ici on est dans une autre langue : celle de l'article +On appelle le formulaire via un modele pour verifier que la langue correspond a sa globale spip_lang +] +[(#VAL{'<formulaire|test_dyn_lang|t='}|concat{#LANG,'>'}|propre|interdire_scripts)] +</BOUCLE_art> +NA : Impossible de trouver un article dans une autre langue que #LANG +<//B_art> +#FILTRE{textebrut} diff --git a/tests/tests/legacy/unit/balises/balise_dyn_langue_modele_fonctions.php b/tests/tests/legacy/unit/balises/balise_dyn_langue_modele_fonctions.php new file mode 100644 index 0000000000..bdd508a6c3 --- /dev/null +++ b/tests/tests/legacy/unit/balises/balise_dyn_langue_modele_fonctions.php @@ -0,0 +1,6 @@ +<?php + +declare(strict_types=1); + +// placer une langue globale arbitraire +$GLOBALS['spip_lang'] = 'ar'; diff --git a/tests/tests/legacy/unit/balises/doublons.html b/tests/tests/legacy/unit/balises/doublons.html new file mode 100644 index 0000000000..d4de04b02e --- /dev/null +++ b/tests/tests/legacy/unit/balises/doublons.html @@ -0,0 +1,33 @@ +[(#REM) + + Gestion des doublons : + // # DOUBLONS{mots} ou #DOUBLONS{mots,famille} + // donne l'etat des doublons (MOTS) a cet endroit + // sous forme de tableau d'id_mot array(1,2,3,...) + // # DOUBLONS tout seul donne la liste brute de tous les doublons + // # DOUBLONS*{mots} donne la chaine brute ",1,2,3,..." + // (changera si la gestion des doublons evolue) + +]#SET{d,''} +<BOUCLE_t(ARTICLES) />[(#TOTAL_BOUCLE|<{2}|?{NA})]<//B_t> + +<BOUCLE_a(ARTICLES){par hasard}{0,2}{doublons test}> + #SET{d,#GET{d}|concat{','}|concat{#ID_ARTICLE}} +</BOUCLE_a> + + +[(#DOUBLONS|count|=={1}|?{'', 'erreur doublons 1'})] + + +[(#DOUBLONS{articles}|count|?{'erreur doublons 2 non vide'})] + + +[(#DOUBLONS{articles,test}|=={ + #GET{d}|explode{","}|array_filter + }|?{'','erreur doublons 3'})] + + +[(#DOUBLONS*{articles,test}|=={#GET{d}}|?{'','erreur doublons*'})] + + +OK diff --git a/tests/tests/legacy/unit/balises/filtre.html b/tests/tests/legacy/unit/balises/filtre.html new file mode 100644 index 0000000000..3cc020f1e2 --- /dev/null +++ b/tests/tests/legacy/unit/balises/filtre.html @@ -0,0 +1,10 @@ +[(#REM) + + Squelette + (c) 2009 xxx + Distribue sous licence GPL + +] +NONONOK +#FILTRE{strip_non} +#FILTRE{strip_on} \ No newline at end of file diff --git a/tests/tests/legacy/unit/balises/filtre_fonctions.php b/tests/tests/legacy/unit/balises/filtre_fonctions.php new file mode 100644 index 0000000000..e430c14d19 --- /dev/null +++ b/tests/tests/legacy/unit/balises/filtre_fonctions.php @@ -0,0 +1,20 @@ +<?php + +declare(strict_types=1); + +/* + * Plugin xxx + * (c) 2009 xxx + * Distribue sous licence GPL + * + */ + +function strip_non($texte) +{ + return str_replace('NON', '', $texte); +} + +function strip_on($texte) +{ + return str_replace('ON', '', $texte); +} diff --git a/tests/tests/legacy/unit/balises/formulaire_.html b/tests/tests/legacy/unit/balises/formulaire_.html new file mode 100644 index 0000000000..9dfa9a9285 --- /dev/null +++ b/tests/tests/legacy/unit/balises/formulaire_.html @@ -0,0 +1,9 @@ +[(#REM) + + Squelette + (c) 2009 xxx + Distribue sous licence GPL + +] +#FORMULAIRE_{inscription,6forum,''} +#FILTRE{formulaire_inscription_present} \ No newline at end of file diff --git a/tests/tests/legacy/unit/balises/formulaire__fonctions.php b/tests/tests/legacy/unit/balises/formulaire__fonctions.php new file mode 100644 index 0000000000..e25b07a520 --- /dev/null +++ b/tests/tests/legacy/unit/balises/formulaire__fonctions.php @@ -0,0 +1,18 @@ +<?php + +declare(strict_types=1); + +/* + * Plugin xxx + * (c) 2009 xxx + * Distribue sous licence GPL + * + */ + +function formulaire_inscription_present($page) +{ + if (trim($page) === '') { + return '#FORMULAIRE_{inscription} ne renvoie rien'; + } + return 'OK'; +} diff --git a/tests/tests/legacy/unit/balises/inclure_array.html b/tests/tests/legacy/unit/balises/inclure_array.html new file mode 100644 index 0000000000..e20117acb7 --- /dev/null +++ b/tests/tests/legacy/unit/balises/inclure_array.html @@ -0,0 +1,20 @@ +[(#REM) + + la balise INCLURE avec un tableau en argument + +] +#SET{test1,(#INCLURE{fond=#DOSSIER_SQUELETTE/inclus_article}{zero=1})} +#SET{test1,#GET{test1}|concat{(#INCLURE{fond=#DOSSIER_SQUELETTE/inclus_rien})}} +#SET{test1,#GET{test1}|concat{(#INCLURE{fond=#DOSSIER_SQUELETTE/inclus_article}{zero=1})}} +#SET{fonds,#ARRAY{0,#DOSSIER_SQUELETTE/inclus_article,1,#DOSSIER_SQUELETTE/inclus_rien,2,#DOSSIER_SQUELETTE/inclus_article}} +#SET{test2,(#INCLURE{fond=#GET{fonds}}{zero=1})} +[(#GET{test1}|=={#GET{test2}}|?{OK,#GET{test1}!=#GET{test2}})] +<?php ob_start(); +?><INCLURE{fond=#GET{fonds}}{zero=1}><?php +$texte = ob_get_contents(); +ob_end_clean(); +$attendu = '[(#GET{test1}|texte_script)]'; +if ($texte!==$attendu) { + echo "Erreur sur <INCLURE> avec un tableau pour fond : $texte ; attendu : $attendu"; +} +?> \ No newline at end of file diff --git a/tests/tests/legacy/unit/balises/inclure_manquant.html b/tests/tests/legacy/unit/balises/inclure_manquant.html new file mode 100644 index 0000000000..13694dc3ee --- /dev/null +++ b/tests/tests/legacy/unit/balises/inclure_manquant.html @@ -0,0 +1,9 @@ +[(#REM) + + INCLURE un fichier non existant + +] +filtre:fin_inclure_manquant +#SET{toto,'toto9876543210'} +[(#GET{toto}|concat{'.html'}|find_in_path|?{le fichier [(#GET{toto})] ne doit pas exister})] +<INCLURE{fond=#GET{toto}}{env}> diff --git a/tests/tests/legacy/unit/balises/inclure_manquant_fonctions.php b/tests/tests/legacy/unit/balises/inclure_manquant_fonctions.php new file mode 100644 index 0000000000..883c8d14ad --- /dev/null +++ b/tests/tests/legacy/unit/balises/inclure_manquant_fonctions.php @@ -0,0 +1,18 @@ +<?php + +declare(strict_types=1); + +function fin_inclure_manquant() +{ + $debusquer = charger_fonction('debusquer', 'public'); + $erreurs = $debusquer('', '', [ + 'erreurs' => 'get', + ]); + + if (! $erreurs && ! (_request('var_mode') === 'debug' && erreur_squelette(false))) { + return "pas d'erreur declenchee"; + } + + $GLOBALS['tableau_des_erreurs'] = []; + return 'OK'; +} diff --git a/tests/tests/legacy/unit/balises/inclus_article.html b/tests/tests/legacy/unit/balises/inclus_article.html new file mode 100644 index 0000000000..c7c3e31062 --- /dev/null +++ b/tests/tests/legacy/unit/balises/inclus_article.html @@ -0,0 +1 @@ +<BOUCLE_art(ARTICLES){#ENV{zero,0},1}>test:#ID_ARTICLE</BOUCLE_art> \ No newline at end of file diff --git a/tests/tests/legacy/unit/balises/inclus_rien.html b/tests/tests/legacy/unit/balises/inclus_rien.html new file mode 100644 index 0000000000..b28b04f643 --- /dev/null +++ b/tests/tests/legacy/unit/balises/inclus_rien.html @@ -0,0 +1,3 @@ + + + diff --git a/tests/tests/legacy/unit/balises/phraseur_balise_dyn.html b/tests/tests/legacy/unit/balises/phraseur_balise_dyn.html new file mode 100644 index 0000000000..a8e2fce769 --- /dev/null +++ b/tests/tests/legacy/unit/balises/phraseur_balise_dyn.html @@ -0,0 +1,11 @@ +[(#REM) + + Squelette + (c) 2009 xxx + Distribue sous licence GPL + +] +<BOUCLE_rub(RUBRIQUES){0,1}> +[<div>(#FORMULAIRE_TEST_PHRASEUR{#SELF})</div>] +</BOUCLE_rub> +#FILTRE{textebrut} \ No newline at end of file diff --git a/tests/tests/legacy/unit/cache/cache_sessions.php b/tests/tests/legacy/unit/cache/cache_sessions.php new file mode 100644 index 0000000000..3a6ea57234 --- /dev/null +++ b/tests/tests/legacy/unit/cache/cache_sessions.php @@ -0,0 +1,159 @@ +<?php + +declare(strict_types=1); + +// nom du test + +$test = 'cache/sessions'; + +define('_VAR_MODE', 'recalcul'); + +// recherche test.inc qui nous ouvre au monde spip + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +tests_init_dossier_squelettes(); + +// commencer par verifier que les assertions fonctionnent + +$GLOBALS['erreurs_test'] = []; + +test_cache_squelette($f = 'inclure/A_session_wo', false); + +if ($GLOBALS['erreurs_test'] !== []) { + die("Echec Assertion {$f} assert_session=0\n"); +} + +$GLOBALS['erreurs_test'] = []; + +test_cache_squelette($f = 'inclure/A_session_wo', true); + +if ($GLOBALS['erreurs_test'] === []) { + die("Echec Assertion {$f} assert_session=1\n"); +} + +$GLOBALS['erreurs_test'] = []; + +test_cache_squelette($f = 'inclure/A_session_w', false); + +if (count($GLOBALS['erreurs_test']) === 0) { + die("Echec Assertion {$f} assert_session=0\n"); +} + +$GLOBALS['erreurs_test'] = []; + +test_cache_squelette($f = 'inclure/A_session_w', true); + +if (count($GLOBALS['erreurs_test']) > 0) { + die("Echec Assertion {$f} assert_session=1\n"); +} + +// now let's start the tests ! + +$GLOBALS['erreurs_test'] = []; + +test_cache_squelette($f = 'cache_session_wo_1', false); + +test_cache_squelette($f = 'cache_session_wo_2', false); + +test_cache_squelette($f = 'cache_session_wo_3', false); + +test_cache_squelette($f = 'cache_session_wo_4', false); + +test_cache_squelette($f = 'cache_session_wo_5', false); + +test_cache_squelette($f = 'cache_session_wo_6', false); + +test_cache_squelette($f = 'cache_session_wo_7', false); + +test_cache_squelette($f = 'cache_session_w_1', true); + +test_cache_squelette($f = 'cache_session_w_2', true); + +test_cache_squelette($f = 'cache_session_w_3', true); + +if (count($GLOBALS['erreurs_test']) > 0) { + echo '<ul><li>' + . implode('</li><li>', $GLOBALS['erreurs_test']) + . '</li></ul>'; +} else { + echo 'OK'; +} + +function test_cache_squelette($fond, $session_attendue) +{ + unset($GLOBALS['cache_utilise_session']); + recuperer_fond($fond, [ + 'assert_session' => ((bool) $session_attendue), + 'caller' => 'none', + 'salt' => salt_contexte(), + ]); + unset($GLOBALS['cache_utilise_session']); + recuperer_fond('root', [ + 'sousfond' => $fond, + 'inc_assert_session' => ((bool) $session_attendue), + 'salt' => salt_contexte(), + ]); +} + +/** + * Fonction chargee de faire les assertions d'erreur si l'invalideur session n'est pas comme on l'attend + * + * @param $chemin_cache + * @param $page + */ + +function inc_maj_invalideurs($chemin_cache, $page) +{ + if (isset($page['contexte']) && isset($page['contexte']['assert_session'])) { + $has_session = false; + if (isset($page['invalideurs']) && isset($page['invalideurs']['session'])) { + $has_session = $page['invalideurs']['session']; + } + + if ($page['contexte']['assert_session'] && $page['contexte']['assert_session'] !== 'non' || $page['contexte']['assert_session'] === 'oui') { + if (! $has_session) { + $GLOBALS['erreurs_test'][] = 'ERREUR : PAS de session pour ' . $page['source'] . ' ' . trace_contexte( + $page['contexte'] + ); + } + } elseif ($has_session) { + $GLOBALS['erreurs_test'][] = "ERREUR : SESSION {$has_session} pour " . $page['source'] . ' ' . trace_contexte( + $page['contexte'] + ); + } + } +} + +function salt_contexte() +{ + static $deja = []; + + do { + $salt = time() . ':' . md5(time() . ':' . random_int(0, 65536)); + } while (isset($deja[$salt])); + + $deja[$salt] = true; + return $salt; +} + +function trace_contexte($contexte) +{ + foreach ($contexte as $k => $v) { + if (strpos($k, 'date_') === 0 || $k === 'salt') { + unset($contexte[$k]); + } + } + + if (isset($contexte['caller']) && strpos($contexte['caller'], 'tests/squelettes/') === 0) { + $contexte['caller'] = substr($contexte['caller'], 17); + } + + return json_encode($contexte, JSON_THROW_ON_ERROR); +} diff --git a/tests/tests/legacy/unit/criteres/branche.html b/tests/tests/legacy/unit/criteres/branche.html new file mode 100644 index 0000000000..cfea3708dd --- /dev/null +++ b/tests/tests/legacy/unit/criteres/branche.html @@ -0,0 +1,38 @@ +[(#REM) + + Un test pour le critere {branche} + + verifie : + - une rubrique est dans sa branche + - sa fille est dans sa branche + - elle n'est pas dans la branche de sa fille + - que la boucle documents compile sans erreur + - que la boucle articles compile sans erreur + +] +<BOUCLE_a(RUBRIQUES){id_parent>0}> +<BOUCLE_b(RUBRIQUES){id_rubrique=#ID_PARENT}> + +<BOUCLE_d(RUBRIQUES){branche}{id_rubrique}> +</BOUCLE_d> +#_b:ID_RUBRIQUE devrait etre dans sa propre branche<br /> +<//B_d> + +<BOUCLE_c(RUBRIQUES){branche}{id_rubrique=#_a:ID_RUBRIQUE}> +</BOUCLE_c> +#_a:ID_RUBRIQUE devrait etre dans la branche de #_b:ID_RUBRIQUE<br /> +<//B_c> + +</BOUCLE_b> + +<BOUCLE_e(RUBRIQUES){branche}{id_rubrique=#ID_PARENT}> +#ID_RUBRIQUE ne devrait pas etre dans la branche de sa fille ! <br /> +</BOUCLE_e> + +</BOUCLE_a> + +<BOUCLE_docs(DOCUMENTS){branche}{0,1}> </BOUCLE_docs> + +<BOUCLE_art(ARTICLES){branche}{0,1}> </BOUCLE_art> +OK + diff --git a/tests/tests/legacy/unit/criteres/origine_traduction.html b/tests/tests/legacy/unit/criteres/origine_traduction.html new file mode 100644 index 0000000000..7730c124c4 --- /dev/null +++ b/tests/tests/legacy/unit/criteres/origine_traduction.html @@ -0,0 +1,27 @@ +#CACHE{0} + +[(#REM) + + test 1 : un article non traduit est bien {origine_traduction} + +] +<BOUCLE_t(ARTICLES)/>[(#TOTAL_BOUCLE|<{2}|?{NA il faut des articles})]<//B_t> + +<BOUCLE_ori(ARTICLES){origine_traduction}{id_trad=0}{0,1}> </BOUCLE_ori> + erreur boucle origine +<//B_ori> + +[(#REM) + + test 2 : un article traduit n'a qu'une traduction qui est {origine_traduction} + +] +<BOUCLE_ori2(ARTICLES){id_trad>0}{origine_traduction}> +<BOUCLE_casse(ARTICLES){traduction}{origine_traduction}{!id_article}> + boum ! #ID_ARTICLE ne devrait pas etre origine +</BOUCLE_casse> +</BOUCLE_ori2> +NA ce test exige d'avoir au moins un article traduit +<//B_ori2> + +OK diff --git a/tests/tests/legacy/unit/criteres/regexp-like.html b/tests/tests/legacy/unit/criteres/regexp-like.html new file mode 100644 index 0000000000..57b40fec2d --- /dev/null +++ b/tests/tests/legacy/unit/criteres/regexp-like.html @@ -0,0 +1,79 @@ +#CACHE{0} +[(#REM) + + Cette page teste le fonctionnement du critere {LIKE} + on selectionne d'abord un article, puis on regarde si + + on reussit a le selectionner avec {titre LIKE a%} + ou a est son initiale (test b) + et l'inverse (test c) + + idem pour regexp + +] + + +<BOUCLE_a(ARTICLES){titre>=A}{titre<=Z}{0,1}> + +[(#SET{t,[(#TITRE|couper{1})]})] + + +[(#REM) ------------- tests de LIKE ---------------- ] + +[(#REM) + + Cette boucle doit donner l'article + +]<BOUCLE_b(ARTICLES){titre like (#GET{t}|concat{%})}{id_article}> + #SET{testb,ok} +</BOUCLE_b> + echec de {titre like #GET{t}%} +<//B_b> + +[(#REM) + + Cette boucle doit echouer + +]<BOUCLE_c(ARTICLES){titre !like (#GET{t}|concat{%})}{id_article}> + +</BOUCLE_c> + echec de {titre !like #GET{t}%} +</B_c> + #SET{testc,ok} +<//B_c> + + +[(#REM) ------------- tests de REGEXP ---------------- ] +[(#REM) + + Cette boucle doit donner l'article + +]<BOUCLE_d(ARTICLES){titre == ^#GET{t}}{id_article}> + #SET{testd,ok} +</BOUCLE_d> + echec de {titre ==^#GET{t}} +<//B_d> + +[(#REM) + + Cette boucle doit echouer + +]<BOUCLE_e(ARTICLES){titre !==^#GET{t}}{id_article}> + +</BOUCLE_e> + echec de {titre !== ^#GET{t}} +</B_e> + #SET{teste,ok} +<//B_e> + + +</BOUCLE_a> + +[(#REM) ------------- validation des resultats ---------------- ] + +[(#GET{testb}|?{#GET{testc}}|?{#GET{testd}}|?{#GET{teste}}|?{OK})] +</B_a> + +NA Ce test exige un article ayant un titre qui commence par une lettre A-Z + +<//B_a> \ No newline at end of file diff --git a/tests/tests/legacy/unit/criteres/traduction.html b/tests/tests/legacy/unit/criteres/traduction.html new file mode 100644 index 0000000000..cd39f3d5cc --- /dev/null +++ b/tests/tests/legacy/unit/criteres/traduction.html @@ -0,0 +1,40 @@ +[(#REM) + + Le critere {traduction} doit donner l'article courant meme s'il n'a + aucune traduction, cf. + http://thread.gmane.org/gmane.comp.web.spip.devel/20772 + +] +#CACHE{0} +[(#REM) test 1 : un article sans trad] +<BOUCLE_principale(ARTICLES){id_trad=0}{0,1}> +<BOUCLE_check(ARTICLES){traduction}> + #SET{ok1,1} +</BOUCLE_check> + boucle check: le critere {traduction} a echoue + sur un article non traduit (article #ID_ARTICLE) +<//B_check> +</BOUCLE_principale> +NA Le test 1 requiert un article publie sur le site +<//B_principale> +[(#REM) /fin test 1 ] + + + + +[(#REM) test 2 : un article et ses traductions ] +<BOUCLE_s(ARTICLES){id_trad>0}{0,1}> +<B_t> + #SET{ok2,1} +<BOUCLE_t(ARTICLES){traduction}> </BOUCLE_t> +</BOUCLE_s> +NA Le test 2 necessite un article publie et traduit +<//B_s> +[(#REM) / fin test 2 ] + + + +[(#REM) Valider les tests et donner le OK ] + +[(#GET{ok1}|?{#GET{ok2}}|?{OK})] + diff --git a/tests/tests/legacy/unit/documents/affichage_documents.html b/tests/tests/legacy/unit/documents/affichage_documents.html new file mode 100644 index 0000000000..3d621810f1 --- /dev/null +++ b/tests/tests/legacy/unit/documents/affichage_documents.html @@ -0,0 +1,44 @@ +[(#REM) + + On va tester le rendu des documents joints + +] +#SET{ok1,''}#SET{ok2,''}#SET{ok3,''} + + +[(#REM) + D'abord une image uploadee en vignette, et sans titre + On teste le rendu de son src, width, height +] +<BOUCLE_d(DOCUMENTS){mode=image}{titre=''}{descriptif=''}{0,1}> +[(#SET{img,[(#REM|sinon{<img#ID_DOCUMENT>}|propre)]})] +[(#SET{doc,[(#REM|sinon{<doc#ID_DOCUMENT>}|propre)]})] +[(#SET{emb,[(#REM|sinon{<emb#ID_DOCUMENT>}|propre)]})] + +[(#GET{img}|extraire_balise{img}|extraire_attribut{src}|quote_amp|=={#URL_DOCUMENT}|?{ + #SET{ok1,1} + ,' '}) + <img#ID_DOCUMENT> src pas bon: "#URL_DOCUMENT" != "[(#GET{img}|extraire_balise{img}|extraire_attribut{src})]" +] +[(#GET{doc}|extraire_balise{img}|extraire_attribut{src}|quote_amp|=={#URL_DOCUMENT}|?{ + #SET{ok2,1} + ,' '}) + <doc#ID_DOCUMENT> src pas bon: "#URL_DOCUMENT" != "[(#GET{doc}|extraire_balise{img}|extraire_attribut{src})]" +] +[(#GET{emb}|extraire_balise{img}|extraire_attribut{src}|quote_amp|=={#URL_DOCUMENT}|?{ + #SET{ok3,1} + ,' '}) + <emb#ID_DOCUMENT> src pas bon: "#URL_DOCUMENT" != "[(#GET{emb}|extraire_balise{img}|extraire_attribut{src})]" +] + + +</BOUCLE_d> + +NA Ce test exige une image chargee en mode "image" et n'ayant ni titre ni descriptif + +<//B_d> + + + + +[(#GET{ok1}|?{#GET{ok2}}|?{#GET{ok3}}|?{OK})] diff --git a/tests/tests/legacy/unit/entrees_sorties/flock_sous_repertoire.php b/tests/tests/legacy/unit/entrees_sorties/flock_sous_repertoire.php new file mode 100644 index 0000000000..31021fc2b9 --- /dev/null +++ b/tests/tests/legacy/unit/entrees_sorties/flock_sous_repertoire.php @@ -0,0 +1,34 @@ +<?php + +declare(strict_types=1); + +/** + * Tests unitaires de sous_repertoire() du fichier ecrire/inc/flock.php + */ + +$test = 'sous_repertoire'; +$remonte = __DIR__ . '/'; +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +$ok = true; + +$sous_repertoire = 'test' . md5(strval(random_int(0, mt_getrandmax()))); + +include_spip('inc/flock'); + +$ok = (sous_repertoire( + _NOM_TEMPORAIRES_ACCESSIBLES, + $sous_repertoire +) === _NOM_TEMPORAIRES_ACCESSIBLES . $sous_repertoire . '/'); + +// Nettoyage +@unlink(_NOM_TEMPORAIRES_ACCESSIBLES . $sous_repertoire . '/.ok'); +@rmdir(_NOM_TEMPORAIRES_ACCESSIBLES . $sous_repertoire); + +if ($ok) { + echo 'OK'; +} diff --git a/tests/tests/legacy/unit/entrees_sorties/spip_nfslock.php b/tests/tests/legacy/unit/entrees_sorties/spip_nfslock.php new file mode 100644 index 0000000000..e87b4f0ab2 --- /dev/null +++ b/tests/tests/legacy/unit/entrees_sorties/spip_nfslock.php @@ -0,0 +1,48 @@ +<?php + +declare(strict_types=1); + +$test = 'spip_nfslock'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/nfslock'); + +$verrou = spip_nfslock('monfichier'); + +$verrou_ok = spip_nfslock_test('monfichier', $verrou); + +$verrou_absent = spip_nfslock_test('un autre', $verrou); + +$deverrouille = spip_nfsunlock('monfichier', $verrou); + +$birth = false; + +$verrou_absent2 = spip_nfslock_test('monfichier', $birth); + +if ($verrou && $verrou_ok && ! $verrou_absent && $deverrouille && ! $verrou_absent2) { + echo 'OK'; + exit; +} + +echo '<ul><li>Erreur NFSLock :'; + +echo '<ul>'; + +echo "<li>verrou sur 'monfichier':{$verrou}</li>"; + +echo "<li>test du verrou sur 'monfichier':{$verrou_ok}</li>"; + +echo "<li>test du verrou sur 'un autre':{$verrou_absent}</li>"; + +echo "<li>deverrouille 'monfichier':{$deverrouille}</li>"; + +echo "<li>test du verrou sur 'monfichier':{$verrou_absent2}</li>"; + +echo '</ul></li></ul>'; diff --git a/tests/tests/legacy/unit/filtres/abs_url.html b/tests/tests/legacy/unit/filtres/abs_url.html new file mode 100644 index 0000000000..61f12efba1 --- /dev/null +++ b/tests/tests/legacy/unit/filtres/abs_url.html @@ -0,0 +1,16 @@ +[(#REM) + +Le filtre |abs_url doit modifier les liens a@href et img@src +a l'interieur d'un texte, et modifier les simples chaines de caracteres +quand elles proviennent de # URL_ARTICLE, mais pas ailleurs (# TITRE par ex) + +] +<BOUCLE_a(ARTICLES){texte=='<(a|img) '}{0,1}>[ +(#URL_ARTICLE|abs_url|=={#URL_ARTICLE}|?{#VAL{'erreur sur #URL_ARTICLE 1 :'}|concat{#URL_ARTICLE|abs_url,'=',#URL_ARTICLE}})][ +(#URL_ARTICLE|abs_url{#URL_SITE_SPIP/}|=={#URL_SITE_SPIP|concat{/}|suivre_lien{#URL_ARTICLE}}|?{'',#VAL{'erreur sur #URL_ARTICLE 2 :'}|concat{#URL_ARTICLE|abs_url{#URL_SITE_SPIP/},'!=',#URL_SITE_SPIP|concat{/}|concat{#URL_ARTICLE}}})][ +(#TITRE|abs_url|=={#TITRE}|?{'','erreur sur #TITRE'})][ +(#TITRE|abs_url|=={#TEXTE}|?{'erreur sur #TEXTE'})]</BOUCLE_a> + +OK + +<//B_a> \ No newline at end of file diff --git a/tests/tests/legacy/unit/filtres/affdate.php b/tests/tests/legacy/unit/filtres/affdate.php new file mode 100644 index 0000000000..aa12147e3f --- /dev/null +++ b/tests/tests/legacy/unit/filtres/affdate.php @@ -0,0 +1,109 @@ +<?php + +declare(strict_types=1); + +$test = 'affdate'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/filtres'); + +include_spip('inc/lang'); + +$lang = $GLOBALS['spip_lang']; + +$GLOBALS['spip_lang'] = 'ca'; + +$essais['nc-01-2010'] = ['gener de 2010', '2010-01-00 01:00:00']; + +$essais['nc-nc-2010'] = ['2010', '2010-00-00 01:00:00']; + +$err[$GLOBALS['spip_lang']] = tester_fun('affdate', $essais); + +$GLOBALS['spip_lang'] = 'de'; + +$essais['nc-01-2010'] = ['Januar 2010', '2010-01-00 01:00:00']; + +$essais['nc-nc-2010'] = ['2010', '2010-00-00 01:00:00']; + +$err[$GLOBALS['spip_lang']] = tester_fun('affdate', $essais); + +$GLOBALS['spip_lang'] = 'en'; + +$essais['nc-01-2010'] = ['January 2010', '2010-01-00 01:00:00']; + +$essais['nc-nc-2010'] = ['2010', '2010-00-00 01:00:00']; + +$err[$GLOBALS['spip_lang']] = tester_fun('affdate', $essais); + +$GLOBALS['spip_lang'] = 'es'; + +$essais['nc-01-2010'] = ['enero de 2010', '2010-01-00 01:00:00']; + +$essais['nc-nc-2010'] = ['2010', '2010-00-00 01:00:00']; + +$err[$GLOBALS['spip_lang']] = tester_fun('affdate', $essais); + +$GLOBALS['spip_lang'] = 'fr'; + +$essais['nc-01-2010'] = ['janvier 2010', '2010-01-00 01:00:00']; + +$essais['nc-nc-2010'] = ['2010', '2010-00-00 01:00:00']; + +$err[$GLOBALS['spip_lang']] = tester_fun('affdate', $essais); + +$GLOBALS['spip_lang'] = 'it'; + +$essais['nc-01-2010'] = ['Gennaio 2010', '2010-01-00 01:00:00']; + +$essais['nc-nc-2010'] = ['2010', '2010-00-00 01:00:00']; + +$err[$GLOBALS['spip_lang']] = tester_fun('affdate', $essais); + +$GLOBALS['spip_lang'] = 'nl'; + +$essais['nc-01-2010'] = ['januari 2010', '2010-01-00 01:00:00']; + +$essais['nc-nc-2010'] = ['2010', '2010-00-00 01:00:00']; + +$err[$GLOBALS['spip_lang']] = tester_fun('affdate', $essais); + +$GLOBALS['spip_lang'] = 'pl'; + +$essais['nc-01-2010'] = ['Styczeń 2010', '2010-01-00 01:00:00']; + +$essais['nc-nc-2010'] = ['2010', '2010-00-00 01:00:00']; + +$err[$GLOBALS['spip_lang']] = tester_fun('affdate', $essais); + +$GLOBALS['spip_lang'] = 'pt'; + +$essais['nc-01-2010'] = ['Janeiro de 2010', '2010-01-00 01:00:00']; + +$essais['nc-nc-2010'] = ['2010', '2010-00-00 01:00:00']; + +$err[$GLOBALS['spip_lang']] = tester_fun('affdate', $essais); + +$GLOBALS['spip_lang'] = $lang; + +// si le tableau $err est pas vide ca va pas + +$ok = true; + +foreach ($err as $l => $e) { + if (count($e) > 0) { + $ok = false; + echo $l; + echo '<dl>' . implode('', $e) . '</dl>'; + } +} + +if ($ok) { + echo 'OK'; +} diff --git a/tests/tests/legacy/unit/filtres/attribut_html.php b/tests/tests/legacy/unit/filtres/attribut_html.php new file mode 100644 index 0000000000..1ab3ecf49c --- /dev/null +++ b/tests/tests/legacy/unit/filtres/attribut_html.php @@ -0,0 +1,48 @@ +<?php + +declare(strict_types=1); + +$test = 'attribut_html'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/filtres'); + +$url = '/ecrire/?exec=exec&id_obj=id_obj&no_val'; + +$amp = str_replace('&', '&', $url); + +$essais[] = + ['aujourd'hui > "30" → 50', "aujourd'hui > \"30\" → <a href='http://www.spip.net'>50</a>"]; + +$essais[] = + [ + 'L'histoire 'très' "folle" des métas en iitalik', + 'L\'histoire \'très\' "folle" <strong>des</strong> métas<p>en <em>ii</em>talik</p>', + ]; + +// le a` risque de matcher \s + +$essais[] = +['allons à la mer', 'allons ' . chr(195) . chr(160) . ' la mer']; + +// + +// hop ! on y va +// + +$err = tester_fun('attribut_html', $essais); + +// si le tableau $err est pas vide ca va pas + +if ($err) { + die('<dl>' . implode('', $err) . '</dl>'); +} + +echo 'OK'; diff --git a/tests/tests/legacy/unit/filtres/date_iso.php b/tests/tests/legacy/unit/filtres/date_iso.php new file mode 100644 index 0000000000..1d426b3a53 --- /dev/null +++ b/tests/tests/legacy/unit/filtres/date_iso.php @@ -0,0 +1,33 @@ +<?php + +declare(strict_types=1); + +$test = 'date_iso'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/filtres'); + +$essais['01-01-2010'] = [gmdate('Y-m-d\TH:i:s\Z', mktime(2, 5, 30, 1, 1, 2010)), '2010-01-01 02:05:30']; + +$essais['nc-01-2010'] = [gmdate('Y-m-d\TH:i:s\Z', mktime(3, 6, 40, 1, 1, 2010)), '2010-01-00 03:06:40']; + +$essais['nc-nc-2010'] = [gmdate('Y-m-d\TH:i:s\Z', mktime(4, 7, 50, 1, 1, 2010)), '2010-00-00 04:07:50']; + +// si le tableau $err est pas vide ca va pas + +$err = tester_fun('date_iso', $essais); + +// si le tableau $err est pas vide ca va pas + +if ($err) { + die('<dl>' . implode('', $err) . '</dl>'); +} + +echo 'OK'; diff --git a/tests/tests/legacy/unit/filtres/entites_html.php b/tests/tests/legacy/unit/filtres/entites_html.php new file mode 100644 index 0000000000..36efaadb3b --- /dev/null +++ b/tests/tests/legacy/unit/filtres/entites_html.php @@ -0,0 +1,111 @@ +<?php + +declare(strict_types=1); + +$test = 'entites_html'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/filtres'); + +$essais[] = + ['<code>&#233;</code>é', '<code>é</code>é']; + +// + +// hop ! on y va +// + +$err = tester_fun('entites_html', $essais); + +// si le tableau $err est pas vide ca va pas + +if ($err) { + die('<dl>' . implode('', $err) . '</dl>'); +} + +echo 'OK'; + +function essais_entites_html() +{ + return [ + 0 => + [ + 0 => '', + 1 => '', + 2 => false, + ], + 1 => + [ + 0 => '0', + 1 => '0', + 2 => false, + ], + 2 => + [ + 0 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 1 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->http://www.spip.net] http://www.spip.net', + 2 => false, + ], + 3 => + [ + 0 => 'Un texte avec des entit&eacute;s &&lt;&gt;&quot;', + 1 => 'Un texte avec des entités &<>"', + 2 => false, + ], + 4 => + [ + 0 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 2 => false, + ], + 5 => + [ + 0 => 'Un texte avec des entités numériques &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entités numériques &<>"', + 2 => false, + ], + 6 => + [ + 0 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 2 => false, + ], + 7 => + [ + 0 => "Un texte sans entites &<>"'", + 1 => 'Un texte sans entites &<>"\'', + 2 => false, + ], + 8 => + [ + 0 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', + 2 => false, + ], + 9 => + [ + 0 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 1 => 'Un modele <modeleinexistant|lien=[->http://www.spip.net]>', + 2 => false, + ], + 10 => + [ + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 2 => false, + ], + ]; +} diff --git a/tests/tests/legacy/unit/filtres/extraire_attribut.php b/tests/tests/legacy/unit/filtres/extraire_attribut.php new file mode 100644 index 0000000000..85c1e4ca1c --- /dev/null +++ b/tests/tests/legacy/unit/filtres/extraire_attribut.php @@ -0,0 +1,158 @@ +<?php + +declare(strict_types=1); + +$test = 'extraire_attribut'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/filtres'); + +$tag = "<img src=\"sha'dok\" width=\"10\" height=100 />"; + +$essais = [["sha'dok", $tag, 'src'], ['10', $tag, 'width'], ['100', $tag, 'height']]; + +$val = '"&\''; + +$tag = inserer_attribut('<img width=10>', 'src', $val); + +$essais[] = ['"&\'', $tag, 'src']; + +$essais[] = ['10', $tag, 'width']; + +// Dans les crayons on s'etait fait avoir par un titre + +// qui valait "<span class="color:xxx;">Titre</span> + +// et que inserer_attribut detruisait en inserant a tort + +// le style='width:560px' dans l'attribut value="" du <input/> + +// (bon je sais c'est pas clair) + +$val = '<span style="color:red;">ho</span>'; + +$src = inserer_attribut('<input />', 'value', $val); + +$a = inserer_attribut($src, 'style', 'width: 120px;'); + +$essais['attribut imbrique'] = [$val, $a, 'value']; + +// attribut autodefini + +$essais['attribut autodefini'] = ['checked', '<input checked />', 'checked']; + +$essais['attribut autodefini 2'] = ['checked', '<input checked/>', 'checked']; + +$essais['attribut autodefini 3'] = ['checked', '<input checked>', 'checked']; + +// inserer un attribut deja existant + +$balise = inserer_attribut('<img src="a" width=12>', 'src', 'b'); + +$essais['remplacement attribut'] = ['b', $balise, 'src']; + +// Ne pas confondre "", "0" et attribut autodefini + +$essais["title=''"] = ['', "<a title=''>", 'title']; + +$essais['width=0'] = ['0', '<img width=0>', 'width']; + +$essais["height='0'"] = ['0', "<img height='0'>", 'height']; + +// extraire un attribut d'une balise xml:truc : + +$essais['xml:deuxpoints'] = ['a', "<chose:truc machin='a'/>", 'machin']; + +// manipuler des listes de balises + +$essais['liste'] = [['a', 'b'], ["<chose machin='a'/>", "<chose machin='b'/>"], 'machin']; + +$essais['nom attribut partiel'] = [null, "<img mysrc='test'>", 'src']; + +// Attrapper un attribut d'un tag interne (oui oui)... + +$essais['extraction tag interne'] = + ['image', "<a href='url'><img src='image' /></a>", 'src']; + +// autoriser les points et tirets dans les attributs + +$essais['points et tirets'] = + ['1', "<bidule chose.truc='yo' machin-lol='ouais' toto='1' />", 'toto']; + +$essais['points et tirets'] = + ['yo', "<bidule chose.truc='yo' machin-lol='ouais' toto='1' />", 'chose.truc']; + +$essais['points et tirets'] = + ['ouais', "<bidule chose.truc='yo' machin-lol='ouais' toto='1' />", 'machin-lol']; + +$essais['tirets et pas tirets 1'] = ['a', "<bidule toto-a='a' toto='1' toto-b='b' />", 'toto-a']; + +$essais['tirets et pas tirets 2'] = ['b', "<bidule toto-a='a' toto='1' toto-b='b' />", 'toto-b']; + +$essais['tirets et pas tirets 3'] = ['1', "<bidule toto-a='a' toto='1' toto-b='b' />", 'toto']; + +$essais['base64'] = [ + 'PGEgbmFtZT0nZm9ybTEnPjwvYT4KPGRpdiBjbGFzcz0nc3BpcF9mb3Jtcyc+Cgo8ZGl2IGNsYXNzPSdzcGlwX2Rlc2NyaXB0aWYnPjwvZGl2PgoKCgoKIAoJIAoJPGZvcm0gbWV0aG9kPSdwb3N0JyBhY3Rpb249J0NvbnRhY3QuaHRtbCNmb3JtMScKCQllbmN0eXBlPSdtdWx0aXBhcnQvZm9ybS1kYXRhJz4KCQkKCQk8ZGl2PgoJCQoJCTxpbnB1dCB0eXBlPSdoaWRkZW4nIG5hbWU9J2Fqb3V0X3JlcG9uc2U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fun('extraire_attribut', $essais); + +// des tests pas dans le tableau +// + +// ... pour pouvoir le remplacer correctement + +if ( + strpos('x', (string) inserer_attribut('<a><img src="x"/></a>', 'src', 'y')) + !== false) { + $err[] = 'erreur remplacement tag interne'; +} + +$balise = "<img + src='sites/sunny/local/cache-gd2/648a4f8c1b5f8885415bc80228800d87.png' + width='96' height='96' style='height:96px;width:96px;' + class='format_png' />"; + +$a = extraire_attribut($balise, 'src'); + +if ($a === null) { + $err[] = + '<dt>Une image + src parfois ca casse, va comprendre<dt><dd>' . $a . "</dd>\n"; +} + +// si le tableau $err est pas vide ca va pas + +if ($err) { + die('<dl>' . implode('', $err) . '</dl>'); +} + +echo 'OK'; + +// essai de perf simple + +$repeter = _request('repeter'); + +while ($repeter--) { + foreach ($essais as $ess) { + extraire_attribut($ess[1], $ess[2]); + } +} diff --git a/tests/tests/legacy/unit/filtres/form_hidden.html b/tests/tests/legacy/unit/filtres/form_hidden.html new file mode 100644 index 0000000000..2aac415f55 --- /dev/null +++ b/tests/tests/legacy/unit/filtres/form_hidden.html @@ -0,0 +1,36 @@ +#SET{t,t#EVAL{chr(91).chr(93)}} + + +[(#REM) + + Verifier que parametre_url fonctionne + +] +[(#VAL{x}|parametre_url{y,1}|=={'x?y=1'}|?{'', erreur parametre url 1})] +[(#VAL{x}|parametre_url{y,1}|parametre_url{y,2}|=={'x?y=2'}|?{'', +erreur parametre url 2<br />})] + + +[(#VAL{x}|parametre_url{#GET{t},#LISTE{1,2}}|=={ +#VAL{x}|concat{'?'}|concat{#GET{t}}|concat{'=1&'}|concat{#GET{t}}|concat{'=2'} +}|?{'', +erreur parametre url tableau<br />})] + + +[(#REM) + + Verifie que form_hidden n'ajoute pas des valeurs pour rien + +] + +[(#VAL{x}|parametre_url{toto,1}|parametre_url{toto,%!}|concat{&toto=3=2}|form_hidden|extraire_balises{input}|count|=={1}|?{'', +bug compte d'input<br />})] + +[(#VAL{x}|parametre_url{toto,3=2}|concat{&toto=p}|form_hidden|extraire_balise{input}|extraire_attribut{value}|=={'3=2'}|?{'', +bug value<br />})] + +[(#REM) si var est un tableau, il faut conserver tous les input ] +[(#VAL{x}|parametre_url{#GET{t},#LISTE{1,%!}}|concat{&#GET{t}}|concat{=3=2}|form_hidden|extraire_balises{input}|count|=={3}|?{'', +bug tableau<br />})] + +OK \ No newline at end of file diff --git a/tests/tests/legacy/unit/filtres/liens_absolus.php b/tests/tests/legacy/unit/filtres/liens_absolus.php new file mode 100644 index 0000000000..3036734d89 --- /dev/null +++ b/tests/tests/legacy/unit/filtres/liens_absolus.php @@ -0,0 +1,66 @@ +<?php + +declare(strict_types=1); + +if (! (isset($test) && $test)) { + $test = 'liens_absolus'; +} + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/filtres'); + +$essais['lien prive'] = + [ + "bla bla <a href='" . str_replace( + '&', + '&', + generer_url_ecrire('toto', 'truc=machin&chose=bidule', false, false) + ) . "'>lien prive</a>", + "bla bla <a href='" . generer_url_ecrire('toto', 'truc=machin&chose=bidule', false, true) . "'>lien prive</a>", + ]; + +$essais['lien public'] = + [ + "bla bla <a href='" . str_replace( + '&', + '&', + generer_url_public('toto', 'truc=machin&chose=bidule', false, false) + ) . "'>lien public</a>", + "bla bla <a href='" . generer_url_public('toto', 'truc=machin&chose=bidule', false, true) . "'>lien public</a>", + ]; + +$essais['mailto'] = + ["bla bla <a href='mailto:toto'>email</a>", "bla bla <a href='mailto:toto'>email</a>"]; + +$essais['javascript'] = + ["bla bla <a href='javascript:open()'>javascript</a>", "bla bla <a href='javascript:open()'>javascript</a>"]; + +// + +// hop ! on y va +// + +# tests invalides si _SPIP_SCRIPT vaut '' + +if (_SPIP_SCRIPT === '') { + die('NA _SPIP_SCRIPT=""'); +} + +# non applicable + +$err = tester_fun('liens_absolus', $essais); + +// si le tableau $err est pas vide ca va pas + +if ($err) { + die('<dl>' . implode('', $err) . '</dl>'); +} + +echo 'OK'; diff --git a/tests/tests/legacy/unit/filtres/liens_absolus_prive.php b/tests/tests/legacy/unit/filtres/liens_absolus_prive.php new file mode 100644 index 0000000000..279da29816 --- /dev/null +++ b/tests/tests/legacy/unit/filtres/liens_absolus_prive.php @@ -0,0 +1,23 @@ +<?php + +declare(strict_types=1); + +/* + * Le meme que liens_absolus.php mais on hacke _SPIP_TEST_INC + * pour que le chdir() au debut de test.inc nous transporte dans ecrire/ + * ceci avant que inc_version.php soit inclus ... + */ +// let's go ecrire/ +$dir_racine = dirname(__DIR__, 2); +while (! is_dir($dir_racine . '/ecrire')) { + $dir_racine = dirname($dir_racine); +} + +define('_SPIP_TEST_CHDIR', $dir_racine . '/ecrire'); +$test = 'liens_absolus_prive'; + +// si on rajoute ça ... +// ça serait presque mieux , mais generer_url_public fait pas de resolv_path() +//define('_SPIP_SCRIPT', '../../'); + +include __DIR__ . '/liens_absolus.php'; diff --git a/tests/tests/legacy/unit/filtres/liens_ouvrants.html b/tests/tests/legacy/unit/filtres/liens_ouvrants.html new file mode 100644 index 0000000000..9c354411a4 --- /dev/null +++ b/tests/tests/legacy/unit/filtres/liens_ouvrants.html @@ -0,0 +1,17 @@ +[(#REM) + + Teste le filtre |liens_ouvrants + +] + + +#SET{texte, + Ceci est un lien [ouvrant->http://www.spip.net/ar] rondtudiou. +} + +[(#GET{texte}|propre + |liens_ouvrants + |match{<a\s.*target=('|")_blank('|").*>} + |?{OK} + |sinon{#GET{texte}|propre})] + diff --git a/tests/tests/legacy/unit/filtres/logique.html b/tests/tests/legacy/unit/filtres/logique.html new file mode 100644 index 0000000000..965541f5a6 --- /dev/null +++ b/tests/tests/legacy/unit/filtres/logique.html @@ -0,0 +1,9 @@ +[(#REM|ou{1}|=={' '}|?{'',ou est pete})] +[(#REM|et{1}|=={''}|?{'',et est pete})] +[(#REM|xor{1}|=={' '}|?{'',xor est pete})] +[(#REM|not|=={' '}|?{'',not est pete})] +[(#REM|not|not|=={''}|?{'',not est pete})] +[(#REM|sinon{'a'}|=={'a'}|?{'',sinon est pete})] +[(#REM|not|sinon{'a'}|=={' '}|?{'',sinon est pete})] + +OK diff --git a/tests/tests/legacy/unit/filtres/suivre_liens.php b/tests/tests/legacy/unit/filtres/suivre_liens.php new file mode 100644 index 0000000000..ab8d47f06e --- /dev/null +++ b/tests/tests/legacy/unit/filtres/suivre_liens.php @@ -0,0 +1,157 @@ +<?php + +declare(strict_types=1); + +if (! (isset($test) && $test)) { + $test = 'suivre_liens'; +} + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/filtres'); + +# source # lien # resultat + +$tests = [ + ['http://host/', 'http://tata/', 'http://tata/'], + ['//host/', 'http://tata/', 'http://tata/'], + ['http://host/', '//tata/', '//tata/'], + ['http://host/', '/tata/', 'http://host/tata/'], + ['//host/', '/tata/', '//host/tata/'], + ['http://host/', '#tata', 'http://host/#tata'], + ['//host/', '#tata', '//host/#tata'], + ['http://host/', '', 'http://host/'], + ['//host/', '', '//host/'], + ['http://host/', 'tata', 'http://host/tata'], + ['//host/', 'tata', '//host/tata'], + ['http://host/', '?par=value', 'http://host/?par=value'], + ['//host/', '?par=value', '//host/?par=value'], + ['http://host/', 'tata?par=value', 'http://host/tata?par=value'], + ['//host/', 'tata?par=value', '//host/tata?par=value'], + ['http://host/', 'tata#ancre', 'http://host/tata#ancre'], + ['//host/', 'tata#ancre', '//host/tata#ancre'], + ['http://host/', 'tata?par=value#ancre', 'http://host/tata?par=value#ancre'], + ['//host/', 'tata?par=value#ancre', '//host/tata?par=value#ancre'], + + ['http://host/page', 'http://tata/', 'http://tata/'], + ['//host/page', 'http://tata/', 'http://tata/'], + ['http://host/page', '//tata/', '//tata/'], + ['http://host/page', '/tata/', 'http://host/tata/'], + ['//host/page', '/tata/', '//host/tata/'], + ['http://host/page', '#tata', 'http://host/page#tata'], + ['//host/page', '#tata', '//host/page#tata'], + ['http://host/page', '', 'http://host/page'], + ['//host/page', '', '//host/page'], + ['http://host/page', 'tata', 'http://host/tata'], + ['//host/page', 'tata', '//host/tata'], + ['http://host/page', '?par=value', 'http://host/?par=value'], + ['//host/page', '?par=value', '//host/?par=value'], + ['http://host/page', 'tata?par=value', 'http://host/tata?par=value'], + ['//host/page', 'tata?par=value', '//host/tata?par=value'], + ['http://host/page', 'tata#ancre', 'http://host/tata#ancre'], + ['//host/page', 'tata#ancre', '//host/tata#ancre'], + ['http://host/page', 'tata?par=value#ancre', 'http://host/tata?par=value#ancre'], + ['//host/page', 'tata?par=value#ancre', '//host/tata?par=value#ancre'], + + ['http://host/rep/page', 'http://tata/', 'http://tata/'], + ['//host/rep/page', 'http://tata/', 'http://tata/'], + ['http://host/rep/page', '//tata/', '//tata/'], + ['http://host/rep/page', '/tata/', 'http://host/tata/'], + ['//host/rep/page', '/tata/', '//host/tata/'], + ['http://host/rep/page', '#tata', 'http://host/rep/page#tata'], + ['//host/rep/page', '#tata', '//host/rep/page#tata'], + ['http://host/rep/page', '', 'http://host/rep/page'], + ['//host/rep/page', '', '//host/rep/page'], + ['http://host/rep/page', 'tata', 'http://host/rep/tata'], + ['//host/rep/page', 'tata', '//host/rep/tata'], + ['http://host/rep/page', '?par=value', 'http://host/rep/?par=value'], + ['//host/rep/page', '?par=value', '//host/rep/?par=value'], + ['http://host/rep/page', 'tata?par=value', 'http://host/rep/tata?par=value'], + ['//host/rep/page', 'tata?par=value', '//host/rep/tata?par=value'], + ['http://host/rep/page', 'tata#ancre', 'http://host/rep/tata#ancre'], + ['//host/rep/page', 'tata#ancre', '//host/rep/tata#ancre'], + ['http://host/rep/page', 'tata?par=value#ancre', 'http://host/rep/tata?par=value#ancre'], + ['//host/rep/page', 'tata?par=value#ancre', '//host/rep/tata?par=value#ancre'], + + ['http://host/rep/page#anchor', 'http://tata/', 'http://tata/'], + ['http://host/rep/page#anchor', '/tata/', 'http://host/tata/'], + ['http://host/rep/page#anchor', '#tata', 'http://host/rep/page#tata'], + ['http://host/rep/page#anchor', '', 'http://host/rep/page#anchor'], + ['http://host/rep/page#anchor', 'tata', 'http://host/rep/tata'], + ['http://host/rep/page#anchor', '?par=value', 'http://host/rep/?par=value'], + ['http://host/rep/page#anchor', 'tata?par=value', 'http://host/rep/tata?par=value'], + ['http://host/rep/page#anchor', 'tata#ancre', 'http://host/rep/tata#ancre'], + ['http://host/rep/page#anchor', 'tata?par=value#ancre', 'http://host/rep/tata?par=value#ancre'], + + ['http://host/rep/page?titi=valeur&bidule=chose/truc', 'http://tata/', 'http://tata/'], + ['http://host/rep/page?titi=valeur&bidule=chose/truc', '/tata/', 'http://host/tata/'], + [ + 'http://host/rep/page?titi=valeur&bidule=chose/truc', '#tata', 'http://host/rep/page?titi=valeur&bidule=chose/truc#tata', + ], + ['http://host/rep/page?titi=valeur&bidule=chose/truc', '', 'http://host/rep/page?titi=valeur&bidule=chose/truc'], + ['http://host/rep/page?titi=valeur&bidule=chose/truc', 'tata', 'http://host/rep/tata'], + ['http://host/rep/page?titi=valeur&bidule=chose/truc', '?par=value', 'http://host/rep/?par=value'], + ['http://host/rep/page?titi=valeur&bidule=chose/truc', 'tata?par=value', 'http://host/rep/tata?par=value'], + ['http://host/rep/page?titi=valeur&bidule=chose/truc', 'tata#ancre', 'http://host/rep/tata#ancre'], + [ + 'http://host/rep/page?titi=valeur&bidule=chose/truc', 'tata?par=value#ancre', 'http://host/rep/tata?par=value#ancre', + ], + + ['http://host/rep/page?titi=valeur&bidule=chose/truc#anchor', 'http://tata/', 'http://tata/'], + ['http://host/rep/page?titi=valeur&bidule=chose/truc#anchor', '/tata/', 'http://host/tata/'], + [ + 'http://host/rep/page?titi=valeur&bidule=chose/truc#anchor', '#tata', 'http://host/rep/page?titi=valeur&bidule=chose/truc#tata', + ], + [ + 'http://host/rep/page?titi=valeur&bidule=chose/truc#anchor', '', 'http://host/rep/page?titi=valeur&bidule=chose/truc#anchor', + ], + ['http://host/rep/page?titi=valeur&bidule=chose/truc#anchor', 'tata', 'http://host/rep/tata'], + ['http://host/rep/page?titi=valeur&bidule=chose/truc#anchor', '?par=value', 'http://host/rep/?par=value'], + ['http://host/rep/page?titi=valeur&bidule=chose/truc#anchor', 'tata?par=value', 'http://host/rep/tata?par=value'], + ['http://host/rep/page?titi=valeur&bidule=chose/truc#anchor', 'tata#ancre', 'http://host/rep/tata#ancre'], + [ + 'http://host/rep/page?titi=valeur&bidule=chose/truc#anchor', 'tata?par=value#ancre', 'http://host/rep/tata?par=value#ancre', + ], + + ['http://toto/ad?hic', '?hoc', 'http://toto/?hoc'], + ['http://toto/./', '#hup', 'http://toto/#hup'], + ['http://toto/fleche/de/tout', '/bois/', 'http://toto/bois/'], + ['http://toto/du/lac#1', 'yop', 'http://toto/du/yop'], + ['http://toto/', 'http://tata/', 'http://tata/'], + ['http://toto/allo', '#3', 'http://toto/allo#3'], + ['http://toto/', 'http://tata/./', 'http://tata/'], + ['http://toto/et#lui', '', 'http://toto/et#lui'], + ['http://toto', './', 'http://toto/'], + ['http://toto/hop/a', './', 'http://toto/hop/'], +]; + +// + +// hop ! on y va +// + +$err = 0; + +foreach ($tests as $c => $u) { + if (($s = suivre_lien($u[0], $u[1])) !== $u[2]) { + echo "test {$c}: suivre_lien(" + . htmlspecialchars($u[0]) + . ',' + . htmlspecialchars($u[1]) + . ') = ' + . htmlspecialchars($s) . ' mais =! ' . htmlspecialchars($u[2]) . "<br />\n"; + ++$err; + } +} + +if ($err !== 0) { + exit; +} + +echo 'OK'; diff --git a/tests/tests/legacy/unit/path/creer_chemin.php b/tests/tests/legacy/unit/path/creer_chemin.php new file mode 100644 index 0000000000..9e8a154d11 --- /dev/null +++ b/tests/tests/legacy/unit/path/creer_chemin.php @@ -0,0 +1,54 @@ +<?php + +declare(strict_types=1); + +$test = 'chemin'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +$n = count(explode(':', $GLOBALS['dossier_squelettes'])); + +$chemin = creer_chemin(); + +_chemin('toto'); + +$chemin1 = creer_chemin(); + +if (count($chemin1) !== (is_countable($chemin) ? count($chemin) : 0) + 1) { + die('Erreur ajout chemin par la fonction _chemin() : mauvais compte' . var_dump($chemin) . var_dump($chemin1)); +} + +if ($GLOBALS['dossier_squelettes']) { + // toto a été ajouté après les chemins de dossier squelettes + if ($chemin1[$n] !== 'toto/' && $chemin1[$n + 1] !== 'toto/') { + die('Erreur ajout chemin par la fonction _chemin() : avec dossier_squelettes' . var_dump($chemin) . var_dump( + $chemin1 + )); + } +} elseif (@is_dir(_DIR_RACINE . 'squelettes')) { + if ($chemin1[1] !== 'toto/') { + die('Erreur ajout chemin par la fonction _chemin() : sans dossier_squelettes avec répertoire squelettes' . var_dump( + $chemin + ) . var_dump($chemin1)); + } +} elseif ($chemin1[0] !== 'toto/') { + die('Erreur ajout chemin par la fonction _chemin() : sans dossier_squelettes sans répertoire squelettes' . var_dump( + $chemin + ) . var_dump($chemin1)); +} + +$GLOBALS['dossier_squelettes'] = 'titi:' . $GLOBALS['dossier_squelettes']; + +$chemin2 = creer_chemin(); + +if ((is_countable($chemin2) ? count($chemin2) : 0) === count($chemin1) || reset($chemin2) !== 'titi/') { + die('Erreur prise en compte dossier squelette' . var_dump($chemin1) . var_dump($chemin2)); +} + +echo 'OK'; diff --git a/tests/tests/legacy/unit/plugin/dir_plugins_suppl.php b/tests/tests/legacy/unit/plugin/dir_plugins_suppl.php new file mode 100644 index 0000000000..b3b4d8c669 --- /dev/null +++ b/tests/tests/legacy/unit/plugin/dir_plugins_suppl.php @@ -0,0 +1,210 @@ +<?php + +declare(strict_types=1); + +/** + * Test unitaire de prise en compte de la constante _DIR_PLUGINS_SUPPL par la fonction liste_plugin_files() du fichier + * ./inc/plugin.php + */ + +$test = '_DIR_PLUGINS_SUPPL'; + +$remonte = __DIR__ . '/'; +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; +find_in_path('./inc/plugin.php', '', true); + +// lancer le binz +echo test_dir_plugins_suppl(); + +function test_dir_plugins_suppl() +{ + // preparation: la constante est elle definie et comprend uniquement 1 reps suppl? + if (! defined('_DIR_PLUGINS_SUPPL')) { + define('_DIR_PLUGINS_SUPPL', _DIR_TMP . 'plug_sup/'); + } elseif (substr_count(_DIR_PLUGINS_SUPPL, ':') !== 0) { + return 'NA : la constante _DIR_PLUGINS_SUPPL definie dans mes_options.php ne doit contenir qu\'un seul chemin supplementaire ; actuellement sa valeur est "' . _DIR_PLUGINS_SUPPL . '"'; + } + + if (substr(_DIR_PLUGINS_SUPPL, -1) !== '/') { + return 'NA : la constante _DIR_PLUGINS_SUPPL doit terminer par un / ; actuellement sa valeur est "' . _DIR_PLUGINS_SUPPL . '"'; + } + // preparation: verifier qu'il existe au moins un dossier plugin par rep suppl (i.e. contenant un fichier paquet.xml)? + $Ta_effacer = []; + $Ta_retrouver = []; + + $existe_paquet = false; + + // le rep suppl n'existe pas; le creer + if (! is_dir(_DIR_RACINE . _DIR_PLUGINS_SUPPL)) { + if (! @mkdir(_DIR_RACINE . _DIR_PLUGINS_SUPPL)) { + return 'NA probleme de droits d\'ecriture 0, impossible de creer le dossier de _DIR_PLUGINS_SUPPL: "' . _DIR_PLUGINS_SUPPL . '" necessaire pour ce test'; + } + $Ta_effacer[] = _DIR_RACINE . _DIR_PLUGINS_SUPPL; + } + + // le rep suppl est vide: creer un dossier de plugin bidon (toto) et y copier un paquet.xml + if ((is_countable(scandir(_DIR_RACINE . _DIR_PLUGINS_SUPPL)) ? count( + scandir(_DIR_RACINE . _DIR_PLUGINS_SUPPL) + ) : 0) < 3) { + if (! @mkdir(_DIR_RACINE . _DIR_PLUGINS_SUPPL . 'toto')) { + nettoyage_plugins_suppl($Ta_effacer); + return 'NA probleme de droits d\ecriture 1, impossible de creer un dossier dans "' . _DIR_RACINE . _DIR_PLUGINS_SUPPL . '" necessaire pour ce test'; + } + $Ta_effacer[] = _DIR_RACINE . _DIR_PLUGINS_SUPPL . 'toto'; + + if (! @copy(_DIR_PLUGINS_DIST . 'dump/paquet.xml', _DIR_RACINE . _DIR_PLUGINS_SUPPL . 'toto/paquet.xml')) { + nettoyage_plugins_suppl($Ta_effacer); + return 'NA probleme de droits d\ecriture 2, impossible de creer un fichier dans "' . _DIR_RACINE . _DIR_PLUGINS_SUPPL . 'toto" necessaire pour ce test'; + } + $Ta_effacer[] = _DIR_RACINE . _DIR_PLUGINS_SUPPL . 'toto/paquet.xml'; + $Ta_retrouver[] = 'toto'; + + $existe_paquet = true; + } else { + if ($pointeur = opendir(_DIR_RACINE . _DIR_PLUGINS_SUPPL)) { + while (false !== ($rep = readdir($pointeur))) { + if ($rep === '.' || $rep === '..' || ! is_dir($rep)) { + continue; + } elseif ($pointeur = opendir(_DIR_RACINE . _DIR_PLUGINS_SUPPL . $rep)) { + while (false !== ($fichier = readdir($pointeur))) { + if ($fichier === 'paquet.xml') { + $Ta_retrouver[] = $rep; + $existe_paquet = true; + break; + } + } + } + } + } + + // tous les sous-dossiers sont scannes et toujours pas de paquet.xml: + // creer un dossier bidon et y copier un paquet.xml + if (! $existe_paquet) { + if (! in_array('toto', scandir(_DIR_RACINE . _DIR_PLUGINS_SUPPL), true) && ! @mkdir( + _DIR_RACINE . _DIR_PLUGINS_SUPPL . 'toto' + )) { + nettoyage_plugins_suppl($Ta_effacer); + return 'NA probleme de droits d\ecriture 3, impossible de creer un dossier dans "' . _DIR_RACINE . _DIR_PLUGINS_SUPPL . '" necessaire pour ce test'; + } + $Ta_effacer[] = _DIR_RACINE . _DIR_PLUGINS_SUPPL . 'toto'; + + if (! @copy(_DIR_PLUGINS_DIST . 'dump/paquet.xml', _DIR_RACINE . _DIR_PLUGINS_SUPPL . 'toto/paquet.xml')) { + nettoyage_plugins_suppl($Ta_effacer); + return 'NA probleme de droits d\ecriture 4, impossible de creer un fichier dans "' . _DIR_RACINE . _DIR_PLUGINS_SUPPL . 'toto" necessaire pour ce test'; + } + $Ta_retrouver[] = 'toto'; + $Ta_effacer[] = _DIR_RACINE . _DIR_PLUGINS_SUPPL . 'toto/paquet.xml'; + + $existe_paquet = true; + } + } + + // preparation: creer au moins un dossier plugin hors de _DIR_PLUGINS et _DIR_PLUGINS_SUPPL + $rep_non_suppl = ''; + if (substr_count(_DIR_PLUGINS_SUPPL, '/') > 1) { + $rep_non_suppl = substr(_DIR_PLUGINS_SUPPL, 0, strrpos(rtrim(_DIR_PLUGINS_SUPPL, '/'), '/')) . '/test_non_suppl'; + } else { + $rep_non_suppl = _DIR_TMP . 'test_non_suppl'; + } + + if ($rep_non_suppl === _DIR_PLUGINS_SUPPL) { + return 'NA : le dossier "' . $rep_non_suppl . '" ne doit pas faire partie des repertoires definis dans _DIR_PLUGINS_SUPPL pour que ce test fonctionne'; + } + + if (! is_dir($rep_non_suppl)) { + if (! @mkdir($rep_non_suppl)) { + nettoyage_plugins_suppl($Ta_effacer); + return 'NA probleme de droits d\ecriture 5, impossible de creer le dossier "' . $rep_non_suppl . '" necessaire pour ce test'; + } + $Ta_effacer[] = $rep_non_suppl; + } + + if (! file_exists($rep_non_suppl . '/paquet.xml')) { + if (! @copy(_DIR_PLUGINS_DIST . 'dump/paquet.xml', $rep_non_suppl . '/paquet.xml')) { + nettoyage_plugins_suppl($Ta_effacer); + return 'NA probleme de droits d\ecriture 6, impossible de creer un fichier dans "' . $rep_non_suppl . '" necessaire pour ce test'; + } + $Ta_effacer[] = $rep_non_suppl . '/paquet.xml'; + } + + // test 1: lancer liste_plugin_files() et recuperer l'array retourne + // verifier qu'on retrouve bien tous les rep suppl de _DIR_PLUGINS_SUPPL + $Tplugins_recups = liste_plugin_files(_DIR_PLUGINS_SUPPL); + + $Terr = []; + $mess_err = ''; + foreach ($Ta_retrouver as $rep) { + if (! in_array($rep, $Tplugins_recups, true)) { + $Terr[] = $rep; + } + } + + if ($Terr !== []) { + if (count($Terr) !== 1) { + $mess_err .= "<li>Les repertoires supplementaires de _DIR_PLUGINS_SUPPL suivants n'ont pas etes trouves par la fonction liste_plugin_files(): "; + } else { + $mess_err .= "<li>Le repertoire supplementaire de _DIR_PLUGINS_SUPPL suivant n'a pas ete trouve par la fonction liste_plugin_files(): "; + } + + $mess_err .= (implode(', ', $Terr)); + } + + // test 2: la liste des reps plugins trouves comprend t'elle des dossiers + // ni dans _DIR_PLUGINS ni dans _DIR_PLUGINS_SUPPL? + $Terr = []; + foreach ($Tplugins_recups as $rep_plug) { + if (! is_dir(_DIR_PLUGINS . $rep_plug) && is_dir( + _DIR_RACINE . $rep_plug + )) { // le rep existe mais pas dans _DIR_PLUGINS + $ok = false; + foreach ($Treps_suppl as $rep_suppl) { + if (substr_count($rep_plug, $rep_suppl) > 0) { + $ok = true; + break; + } + } + + if (! $ok) { + $Terr[] = $rep_plug; + } + } + } + + if ($Terr !== []) { + if (count($Terr) !== 1) { + $mess_err .= '<li>Les repertoires suivants ont etes trouves par la fonction liste_plugin_files(): '; + $mess_err .= (implode(', ', $Terr)); + $mess_err .= " alors qu'ils n'appartiennent ni a _DIR_PLUGINS ni a _DIR_PLUGINS_SUPPL"; + } else { + $mess_err .= '<li>Le repertoire suivant a ete trouve par la fonction liste_plugin_files(): '; + $mess_err .= (implode(', ', $Terr)); + $mess_err .= " alors qu'il n'appartient ni a _DIR_PLUGINS ni a _DIR_PLUGINS_SUPPL"; + } + } + + // sortie propre du test + nettoyage_plugins_suppl($Ta_effacer); + + if ($mess_err !== '') { + return '<ul>' . $mess_err . '</ul>'; + } + return 'OK'; +} + +// nettoyer tous les fichiers et dossiers crees pour ce test +function nettoyage_plugins_suppl($Ta_supprimer) +{ + // inverser l'odre des elements de l'array pour eviter d'essayer d'effacer des reps qui contiennent encore des fichiers + arsort($Ta_supprimer); + foreach ($Ta_supprimer as $a_suppr) { + if (is_dir($a_suppr)) { + rmdir($a_suppr); + } elseif (file_exists($a_suppr)) { + unlink($a_suppr); + } + } +} diff --git a/tests/tests/legacy/unit/propre/doublons_notes.html b/tests/tests/legacy/unit/propre/doublons_notes.html new file mode 100644 index 0000000000..5983992324 --- /dev/null +++ b/tests/tests/legacy/unit/propre/doublons_notes.html @@ -0,0 +1,29 @@ +[(#REM) + On cherche un article avec un document en note dans le texte, + et on veut qu'il soit pris par {doublons} + cf. http://trac.rezo.net/trac/spip/ticket/779 +] +#SET{ida,''} +#SET{idd,''} +<BOUCLE_r(ARTICLES){id_article==.*}{texte==\\\\[\\\\[.*<doc[0-9]+>.*\\\\]\\\\]}{statut==.*}{0,1}> + #SET{ida,#ID_ARTICLE} + #SET{idd,#TEXTE*|replace{^.*\x5b\x5b.*<doc}|replace{>.*$}|intval} +</BOUCLE_r> + +<BOUCLE_d(DOCUMENTS){id_document=#GET{idd}}{statut==.*}> + + <BOUCLE_a(ARTICLES){id_article=#GET{ida}}{statut==.*}> + [(#TEXTE|?)] + </BOUCLE_a> + + <BOUCLE_test(DOCUMENTS){id_document}{doublons}> + erreur, _test n'a pas doublonne ! (#ID_DOCUMENT) + </BOUCLE_test> + OK #_d:ID_DOCUMENT + <//B_test> + + +</BOUCLE_d> + [(#REM|creer_article_a_doublons_notes)] + Article de test créé, relancer le test ! +<//B_d> diff --git a/tests/tests/legacy/unit/propre/doublons_notes_fonctions.php b/tests/tests/legacy/unit/propre/doublons_notes_fonctions.php new file mode 100644 index 0000000000..a0aa1f4c64 --- /dev/null +++ b/tests/tests/legacy/unit/propre/doublons_notes_fonctions.php @@ -0,0 +1,23 @@ +<?php + +declare(strict_types=1); + +/* + Creation article de test pour doublons_notes.html + On cherche un document, on le met dans la note d'un texte, +*/ + +function creer_article_a_doublons_notes() +{ + $res = sql_query( + "SELECT id_document FROM spip_documents WHERE mode NOT IN ('logoon','logooff','vignette') ORDER BY rand() LIMIT 1" + ); + if ($a = sql_fetch($res)) { + [$doc] = array_values($a); + sql_query( + "REPLACE INTO spip_articles (id_article, titre, statut, texte) VALUES (-1, 'test pour doublons_notes.html', 'prepa', 'hello [[ xx <doc{$doc}> ]].')" + ); + } else { + die('NA il faut un document'); + } +} diff --git a/tests/tests/legacy/unit/propre/liens.php b/tests/tests/legacy/unit/propre/liens.php new file mode 100644 index 0000000000..03d809b9fb --- /dev/null +++ b/tests/tests/legacy/unit/propre/liens.php @@ -0,0 +1,186 @@ +<?php + +declare(strict_types=1); + +define('_ESPACE_PRIVE', 1); // pour tester le modele inexistant, qui sera sinon ignore + +$test = 'liens'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/texte'); + +include_spip('inc/lang'); + +$s = spip_query("SELECT * FROM spip_articles WHERE statut='publie' AND lang>'' LIMIT 0,1"); + +$t = sql_fetch($s); + +// on se met dans une autre langue que celle de l'article + +$la_langue = 'eo'; + +if ($t['lang'] === 'eo') { + $la_langue = 'fa'; +} + +lang_select($la_langue); + +$p0 = '[->' . $t['id_article'] . ']'; + +$p1 = '[bla {blabla}->url]'; // blabla ne peut pas etre un hreflang + +$p2 = '[bla{en}->url]'; + +$p3 = '[bla|bulle de savon{eo}->url]'; + +$p4 = '[bla|fa->url]'; // fa est hreflang ET title + +$p5 = '[bla|bulle de savon->url]'; + +$p6 = '[<multi>[fr]X[eo]Y[fa]Z</multi>->url]'; + +$p7 = '[uneancre<-] a [->www.monsite.tld]'; + +$p8 = 'un superbe www.monsite.tld, pas mal'; + +$p9 = 'un superbe http://www.monsite.tld, pas mal'; + +$p10 = 'un superbe https://www.monsite.tld, pas mal'; + +$p11 = '<flv|url=http://rezo.net/>'; + +$err = []; + +if (extraire_attribut(propre($p0), 'hreflang') !== $t['lang']) { + $err[] = "hreflang automatique errone dans {$p0} : " . PtoBR(propre($p0)); +} + +if (extraire_attribut(propre($p1), 'href') !== 'url') { + $err[] = "url mal extrait de {$p1}"; +} + +if (extraire_attribut(propre($p1), 'hreflang') === 'blabla') { + $err[] = "hreflang errone dans {$p1}"; +} + +if (supprimer_tags(propre($p1)) !== 'bla blabla') { + $err[] = "texte du lien abime dans {$p1}"; +} + +if (extraire_attribut(propre($p2), 'href') !== 'url') { + $err[] = "url mal extrait de {$p2}"; +} + +if (extraire_attribut(propre($p2), 'hreflang') !== 'en') { + $err[] = "hreflang errone dans {$p2}"; +} + +if (supprimer_tags(propre($p2)) !== 'bla') { + $err[] = "texte du lien abime dans {$p2}"; +} + +if (extraire_attribut(propre($p3), 'href') !== 'url') { + $err[] = "url mal extrait de {$p3}"; +} + +if (extraire_attribut(propre($p3), 'hreflang') !== 'eo') { + $err[] = "hreflang errone dans {$p3}"; +} + +if (extraire_attribut(propre($p3), 'title') !== 'bulle de savon') { + $err[] = "title errone dans {$p3}"; +} + +if (supprimer_tags(propre($p3)) !== 'bla') { + $err[] = "texte du lien abime dans {$p3}"; +} + +if (extraire_attribut(propre($p4), 'href') !== 'url') { + $err[] = "url mal extrait de {$p4}"; +} + +if (extraire_attribut(propre($p4), 'hreflang') !== 'fa') { + $err[] = "hreflang errone dans {$p4}"; +} + +if (extraire_attribut(propre($p4), 'title') !== 'fa') { + $err[] = "title errone dans {$p4}"; +} + +if (supprimer_tags(propre($p4)) !== 'bla') { + $err[] = "texte du lien abime dans {$p4}"; +} + +if (extraire_attribut(propre($p5), 'href') !== 'url') { + $err[] = "url mal extrait de {$p5}"; +} + +if (extraire_attribut(propre($p5), 'hreflang') !== null) { + $err[] = "hreflang errone dans {$p5}"; +} + +if (extraire_attribut(propre($p5), 'title') !== 'bulle de savon') { + $err[] = "title errone dans {$p5}"; +} + +if (supprimer_tags(propre($p5)) !== 'bla') { + $err[] = "texte du lien abime dans {$p5}"; +} + +if (supprimer_tags(propre($p6)) !== ($la_langue === 'eo' ? 'Y' : 'Z')) { + $err[] = "multi abime dans {$p6}"; +} + +# (('<multi>[fr]X[en]Y</multi>')); => pre_typo + +$balises_p7 = extraire_balises(propre($p7), 'a'); + +if ('http://www.monsite.tld' +!== $a = extraire_attribut(array_pop($balises_p7), 'href')) { + $err[] = $a . ': erreur sur le lien ' . $p7; +} + +if ('http://www.monsite.tld' +!== $a = extraire_attribut(extraire_balise(propre($p8), 'a'), 'href')) { + $err[] = $a . ': erreur sur le lien ' . $p8; +} + +if ('http://www.monsite.tld' +!== $a = extraire_attribut(extraire_balise(propre($p9), 'a'), 'href')) { + $err[] = $a . ': erreur sur le lien ' . $p9; +} + +if ('https://www.monsite.tld' +!== $a = extraire_attribut(extraire_balise(propre($p10), 'a'), 'href')) { + $err[] = $a . ': erreur sur le lien ' . $p10; +} + +if ('https://www.monsite.tld' +!== $a = extraire_attribut(extraire_balise(propre($p10), 'a'), 'href')) { + $err[] = $a . ': erreur sur le lien ' . $p10; +} + +if (! in_array( + $a = propre($p11), + [ + '<p><flv|url=http://rezo.net/></p>', + '<p><tt><flv|url=http://rezo.net/></tt></p>', + '<pre><flv|url=http://rezo.net/></pre>', + ], + true +)) { + $err[] = $a . ': erreur sur le modele ' . $p11; +} + +if ($err) { + var_dump($err); +} else { + echo 'OK'; +} diff --git a/tests/tests/legacy/unit/propre/liens_classes.php b/tests/tests/legacy/unit/propre/liens_classes.php new file mode 100644 index 0000000000..22ca4a452a --- /dev/null +++ b/tests/tests/legacy/unit/propre/liens_classes.php @@ -0,0 +1,72 @@ +<?php + +declare(strict_types=1); + +$err = []; + +$test = 'liens_classes'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/texte'); + +include_spip('inc/lang'); + +$id = sql_getfetsel('id_article', 'spip_articles', "statut='publie'", '', '', '0,1'); + +if (! $id) { + echo 'NA Necessite un article publie<br />'; +} + +$p0 = "[->art{$id}]"; + +if (! ($c = extraire_attribut(propre($p0), 'class')) || strpos($c, 'spip_in') === false || strpos( + $c, + 'spip_out' +) !== false) { + $err[] = "Classe {$c} errone dans {$p0} : " . PtoBR(propre($p0)); +} + +$id = sql_getfetsel('id_rubrique', 'spip_rubriques', "statut='publie'", '', '', '0,1'); + +if (! $id) { + echo 'NA Necessite une rubrique publiee<br />'; +} + +$p0 = "[->rub{$id}]"; + +if (! $c = extraire_attribut(propre($p0), 'class') || strpos($c, 'spip_in') === false || strpos( + $c, + 'spip_out' +) !== false) { + $err[] = "Classe {$c} errone dans {$p0} : " . PtoBR(propre($p0)); +} + +$id = sql_getfetsel('id_syndic', 'spip_syndic', "statut='publie'", '', '', '0,1'); + +if (! $id) { + echo 'NA Necessite un site publie<br />'; +} + +$p0 = "[->site{$id}]"; + +if (! $c = extraire_attribut(propre($p0), 'class') || strpos($c, 'spip_in') !== false || strpos( + $c, + 'spip_out' +) === false) { + $err[] = "Classe {$c} errone dans {$p0} : " . PtoBR(propre($p0)); +} + +// si le tableau $err est pas vide ca va pas + +if (count($err) > 0) { + echo '<dl><dt>' . implode('</dt><dt>', $err) . '</dt></dl>'; +} else { + echo 'OK'; +} diff --git a/tests/tests/legacy/unit/rubriques/creer_rubrique_nommee.html b/tests/tests/legacy/unit/rubriques/creer_rubrique_nommee.html new file mode 100644 index 0000000000..bfffbb1574 --- /dev/null +++ b/tests/tests/legacy/unit/rubriques/creer_rubrique_nommee.html @@ -0,0 +1,20 @@ +[(#REM) + + La fonction creer_rubrique_nommee('a/b/c/d') creee une arborescence et renvoie l'id_rubrique + Ici on en prend 10 au pif et on essaie de voir si on retombe bien dessus (attention, le + test est potentiellement "destructeur" (ou plutot "constructeur", puisqu'il creera des + rubriques superflues) si la fonction echoue, ou si deux rubriques soeurs portent le meme titre). + +] +<BOUCLE_r(RUBRIQUES){par hasard}{0,10}> +[(#SET{hier,''})] +<BOUCLE_h(HIERARCHIE){tout}> +[(#SET{hier,[(#GET{hier})][/(#TITRE**)]})] +</BOUCLE_h> +[(#GET{hier}|creer_rubrique_nommee|=={#ID_RUBRIQUE}|?{'', + [(#GET{hier}|htmlspecialchars)] + [(#SET{bug,1})] +})] +</B_h> +</BOUCLE_r> +[(#GET{bug}|?{'','OK'})] diff --git a/tests/tests/legacy/unit/xml/xmlhack.html b/tests/tests/legacy/unit/xml/xmlhack.html new file mode 100644 index 0000000000..839ecf4701 --- /dev/null +++ b/tests/tests/legacy/unit/xml/xmlhack.html @@ -0,0 +1,14 @@ +[(#REM) + + le hack xml repere dans le squelette la sequence "< ?xml" + et evite de l'executer en php + +] + +#CACHE{0}<!-- +filtre:spip_xml_parse +filtre:reset +filtre:reset +--> +<?xml version="1.0"[ encoding="(#CHARSET)"]?> +<tag>OK</tag> \ No newline at end of file diff --git a/tests/tests/legacy/unit/xml/xmlhack_fonctions.php b/tests/tests/legacy/unit/xml/xmlhack_fonctions.php new file mode 100644 index 0000000000..f53060ed3c --- /dev/null +++ b/tests/tests/legacy/unit/xml/xmlhack_fonctions.php @@ -0,0 +1,5 @@ +<?php + +declare(strict_types=1); + +include_spip('inc/xml'); diff --git a/tests/tests/legacy/unit/xml/xmlhack_inclure.html b/tests/tests/legacy/unit/xml/xmlhack_inclure.html new file mode 100644 index 0000000000..8b8017680c --- /dev/null +++ b/tests/tests/legacy/unit/xml/xmlhack_inclure.html @@ -0,0 +1 @@ +[(#INCLURE{fond=#DOSSIER_SQUELETTE/xmlhack})] \ No newline at end of file diff --git a/tests/tests/legacy/unit/xml/xmlhack_inclure_dyn.html b/tests/tests/legacy/unit/xml/xmlhack_inclure_dyn.html new file mode 100644 index 0000000000..ca0a29363e --- /dev/null +++ b/tests/tests/legacy/unit/xml/xmlhack_inclure_dyn.html @@ -0,0 +1 @@ +<INCLURE{fond=#DOSSIER_SQUELETTE/xmlhack}> \ No newline at end of file diff --git a/tests/tests/legacy/unit/xml/xmlhack_inclure_dyn_php.html b/tests/tests/legacy/unit/xml/xmlhack_inclure_dyn_php.html new file mode 100644 index 0000000000..0075b285c8 --- /dev/null +++ b/tests/tests/legacy/unit/xml/xmlhack_inclure_dyn_php.html @@ -0,0 +1 @@ +<INCLURE{fond=#DOSSIER_SQUELETTE/xmlhack_php}> \ No newline at end of file diff --git a/tests/tests/legacy/unit/xml/xmlhack_inclure_php.html b/tests/tests/legacy/unit/xml/xmlhack_inclure_php.html new file mode 100644 index 0000000000..8b9ba555e6 --- /dev/null +++ b/tests/tests/legacy/unit/xml/xmlhack_inclure_php.html @@ -0,0 +1 @@ +[(#INCLURE{fond=#DOSSIER_SQUELETTE/xmlhack_php})] \ No newline at end of file diff --git a/tests/tests/legacy/unit/xml/xmlhack_php.html b/tests/tests/legacy/unit/xml/xmlhack_php.html new file mode 100644 index 0000000000..c7f8c11df9 --- /dev/null +++ b/tests/tests/legacy/unit/xml/xmlhack_php.html @@ -0,0 +1,14 @@ +[(#REM) + + le hack xml repere dans le squelette la sequence "< ?xml" + et evite de l'executer en php + +] + +#CACHE{0}<!-- +filtre:spip_xml_parse +filtre:reset +filtre:reset +--> +<?xml version="1.0"[ encoding="(#CHARSET)"]?> +<tag><?php echo 'OK'; ?></tag> \ No newline at end of file diff --git a/tests/tests/legacy/unit/xml/xmlhack_php_fonctions.php b/tests/tests/legacy/unit/xml/xmlhack_php_fonctions.php new file mode 100644 index 0000000000..f53060ed3c --- /dev/null +++ b/tests/tests/legacy/unit/xml/xmlhack_php_fonctions.php @@ -0,0 +1,5 @@ +<?php + +declare(strict_types=1); + +include_spip('inc/xml'); diff --git a/tests/tests/legacy/unit/xml/xmlhack_recuperer_fond.php b/tests/tests/legacy/unit/xml/xmlhack_recuperer_fond.php new file mode 100644 index 0000000000..d7e4c0e131 --- /dev/null +++ b/tests/tests/legacy/unit/xml/xmlhack_recuperer_fond.php @@ -0,0 +1,53 @@ +<?php + +declare(strict_types=1); + +$test = 'xmlhack_recuperer_fond'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('public/assembler'); + +$dir = substr(dirname(__DIR__, 2), strlen(_SPIP_TEST_CHDIR) + 1); + +$out = recuperer_fond($dir . '/unit/xml/xmlhack'); + +// regarder si le hack a marche + +include_spip('inc/xml'); + +$tree = spip_xml_parse($out); + +$ok = reset($tree); + +$ok = reset($ok); + +if ($ok !== 'OK') { + echo '<dl> Erreur sur le xml produit (xmlhack) : ' . serialize($tree) . '</dl>'; +} + +$out = recuperer_fond($dir . '/unit/xml/xmlhack_php'); + +// regarder si le hack a marche + +include_spip('inc/xml'); + +$tree = spip_xml_parse($out); + +$ok1 = reset($tree); + +$ok1 = reset($ok1); + +if ($ok1 !== 'OK') { + echo '<dl> Erreur sur le xml produit (xmlhack_php) : ' . serialize($tree) . '</dl>'; +} + +if ($ok && $ok1) { + echo 'OK'; +} diff --git a/tests/tests/legacy/unit/z_todo/NA_echappements.php b/tests/tests/legacy/unit/z_todo/NA_echappements.php new file mode 100644 index 0000000000..d8d0f8acb4 --- /dev/null +++ b/tests/tests/legacy/unit/z_todo/NA_echappements.php @@ -0,0 +1,91 @@ +<?php + +declare(strict_types=1); + +$test = 'echapper'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/texte'); + +// liste de codes qui doivent etre preserves par des allers-retours d'echappement + +// $essai[][0] : texte original + +// $essai[][1] : resultat $no_transform=false + +// $essai[][2] : resultat $no_transform=true + +$essais = [ + ['avant<code>toto</code>apres', ',^avant<code[^>]*>toto</code>apres$,', ',^avant<code>toto</code>apres$,'], [ + 'avant<script>toto</script>\n\napres', + ',^avant<script>toto</script>\n\napres$,', + ',^avant<script>toto</script>\n\napres$,', + ], [ + 'toto<code>titi</code>tata<br>toto<script>titi</script>tata', + ",^toto<code[^>]*>titi</code>tata<br>toto<script>titi</script>\n\ntata$,", + ',^toto<code>titi</code>tata<br>toto<script>titi</script>tata$,', + ], [ + 'avant<script language="JavaScript" type="text/javascript">titi</script><noscript>notiti</noscript>apres', + ",^avant<script language=\"JavaScript\" type=\"text/javascript\">titi</script>\n\n<noscript>notiti</noscript>apres$,", + ",^avant<script language=\"JavaScript\" type=\"text/javascript\">titi</script>\n\n<noscript>notiti</noscript>apres$,", + ], ['avant <html>toto</html> apres', ',^avant toto apres$,', ',^avant <html>toto</html> apres$,'], [ + 'avant<html><div>toto</div></html>apres', + ",^avant<div>toto</div>\n\napres$,", + ',^avant<html><div>toto</div></html>apres$,', + ], ]; + +// une fonction de callback qui echappe les balises contenant des guillemets + +function echappe_balises_callback($matches) +{ + return str_replace('"', "'", code_echappement($matches[1], 'GUILL')); +} + +// hop ! on y va + +// Batterie 1 + +foreach ($essais as $i => $e) { + for ($no_transform = 0; $no_transform <= 1; ++$no_transform) { + $a = echappe_html($e[0], 'TEST', $no_transform); + $b = echappe_retour($a, 'TEST'); + if (! preg_match($c = $e[1 + $no_transform], $b)) { + $err[] = "<strong><br />Batterie 1.{$no_transform} #{$i}</strong>. Le code d'origine n'est pas préservé (\$no_transform={$no_transform}) :" + . htmlentities(" @--> {$e[0]} @--> {$a} @--> {$b} @--> ne v�rifie pas : {$c}"); + } + } +} + +// Batterie 2 + +foreach ($essais as $i => $e) { + for ($no_transform = 0; $no_transform <= 1; ++$no_transform) { + $a = echappe_html($e[0], 'TEST', $no_transform); + $x = preg_replace_callback('#(<[^>]+"[^>]*>)#Ums', 'echappe_balises_callback', $a); + $y = echappe_retour($x, 'GUILL'); + $b = echappe_retour($y, 'TEST'); + if (! preg_match($c = $e[1 + $no_transform], $b)) { + $err[] = "<strong><br />Batterie 2.{$no_transform} #{$i}</strong>. Le code d'origine n'est pas préservé (\$no_transform={$no_transform}) :" + . htmlentities(" @--> {$e[0]} @--> {$a} @--> {$x} @--> {$y} @--> {$b} @--> ne v�rifie pas : {$c}"); + } + } +} + +// si le tableau $err n'est pas vide ca va pas + +if ($err) { // + foreach ($err as $i => $val) { + $err[$i] = str_replace("\n", '\n', $val); + } + + echo '<dl>' . str_replace(htmlentities(' @--> '), '<br />--> ', implode("\n", $err)) . '</dl>'; +} else { + echo 'OK'; +} diff --git a/tests/tests/legacy/unit/z_todo/NA_email_valide.php b/tests/tests/legacy/unit/z_todo/NA_email_valide.php new file mode 100644 index 0000000000..fa0aa37e62 --- /dev/null +++ b/tests/tests/legacy/unit/z_todo/NA_email_valide.php @@ -0,0 +1,199 @@ +<?php declare(strict_types=1); + +$test = 'email_valide'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/filtres'); + +?> + + <p>Il existe une différence entre la définition générale (RFC 822) et l'usage réel qui est fait des adresses de courriel.</p> + + <p>Les registar et hébergeurs principaux ne respectent d'ailleurs pas cette définition alors même que ce sont eux qui permettent à la majorité des gens de définir leurs adresses mails et qui bien souvent servent de serveur SMTP. (Il ne m'est pas possible actuellement de tester d'autres serveurs SMTP).</p> + + <p>Selon Dreamhost :</p> + <ul> + <li>Un courriel commence par une lettre, un chiffre, un tiret, un tiret bas, un plus ou un &,</li> + <li>Un courriel peut contenir des caractères alphanum, des points, des tirets, des tirets bas, des plus, des &.</li> + </ul> + <p>L'adresse <em>&-_+.spip17&-_+.@domaine.com</em> est donc valide.</p> + + <p>Selon OVH :</p> + <ul> + <li>Un courriel commence par une lettre, un chiffre, un tiret ou un tiret bas,</li> + <li>Un courriel peut contenir des caractères alphanum, des points, des tirets ou des tirets bas.</li> + </ul> + <p>L'adresse <em>&-_+.spip17&-_+.@domaine.com</em> n'est donc pas valide et même rejetée par le serveur SMTP d'OVH. L'adresse -spip17_.@domaine.com est quant à elle validée.</p> + + + <p>De plus, il convient de faire le distingo entre un usage que je pense classique et majoritaire de SPIP : Internet, et un usage limité à une utilisation locale. Peut être que SPIP devrait avoir 2 regexp différentes pour ces 2 usages, deux fonctions ou 1 argument supplémentaire à l'actuelle.</p> + <p>Une utilisation locale permet des noms de domaines variés, et sans extension.</p> + + <p>Les noms de domaines publics (qui, je pense, sont majoritairement utilisés pour SPIP) quant à eux respectent des règles plus strictes :</p> + <ul> + <li>Un nom de domaine commence par une lettre ou un chiffre,</li> + <li>Un nom de domaine peut contenir des caractères alphanumériques, des tirets ou des points (cas des sous domaines),</li> + <li>Une extension de domaine <strong>public</strong> contient au moins 2 lettres, au plus 6. ( http://www.iana.org/domains/root/db/index.html )</li> + </ul> + + <p><strong>SPIP, de part son respect à la norme RFC 822 permet donc aujourd'hui l'usage d'adresses mails qui ne sont clairement pas valides dans notre utilisation quotidienne, que je pense majoritaire, de l'outil SPIP. Il est actuellement ainsi possible de valider les adresses :</strong></p> + <ul> + <li>Jun 20 21:29:32 <cerdic>"Par exemple, l'adresse complètement farfelue: #+^-`&%_=|/|_?=!§{}$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@mail.com est, suivant la norme, une adresse parfaitement valide."</li> + <li>utilisateur@domaine.f</li> + <li>utilisateur@domaine.frfrfrfrfrfr</li> + <li>d@d</li> + </ul> + <p>Qui à mon sens ne devraient pas l'être.</p> + + <p><em>Se pose donc peut être le cas des extensions de domaines arabes ou qui me seraient inconnus (et courants) de plus de 6 caractères, mais il me semble que les dommages collatéraux causés par l'utilisation d'une RegExp non respectueuse des standards mais beaucoup moins permissive (appliquée à un usage courant) sont moins importants que ceux de la RegExp actuelle bien trop permissive utilisée par SPIP. Je descendrais même personnellement à 4 pour l'extension, tant pis pour .travel et .museum... °_°</em></p> + + + <!-- /* Fonction d'origine de SPIP */ --> + <h1>Fonction email_valide() de SPIP</h1> + + <p>Ces mails sont valides, et bien reconnus.</p> + + <?php + $emails_valides = ['utilisateur@domaine.com', 'uti-lisa.teur@domai-ne.fr', '&-_+.spip17&-_+.@domaine.com']; + +echo '<ul>'; + +foreach ($emails_valides as $tests => $email) { + echo '<li>' . $email . ' -> passés par email_valide() -> ' . email_valide($email) . '</li>'; +} + +echo '</ul>'; + +?> + + <!-- // Emails qui ne devraient pas être valides --> + <p><strong>Ce mail est valide selon la RFC822 (mais à mon sens ne devrait pas l'être), et rejeté par SPIP</strong></p> + <?php +$emails_non_valides_mais_valides = ['#+^-`&%_=|/|_?=!§{}$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@mail.com']; + +echo '<ul style="font-weight:bold;">'; + +foreach ($emails_non_valides_mais_valides as $tests => $email) { + echo '<li>' . $email . ' -> passés par email_valide() -> ' . email_valide($email) . '</li>'; +} + +echo '</ul>'; + +?> + + + <!-- // Emails qui ne devraient pas être valides --> + <p><strong>Ces mails sont valides, mais à mon sens devraient être rejetés dans un usage classique :</strong></p> + <?php +$emails_non_valides_mais_valides = [ + 'utilisateur@domaine.f', + 'utilisateur@domaine.frfrfrfrfrfr', + 'd@d', + '&&?julien@domaine.fr', +]; + +echo '<ul style="font-weight:bold;">'; + +foreach ($emails_non_valides_mais_valides as $tests => $email) { + echo '<li>' . $email . ' -> passés par email_valide() -> ' . email_valide($email) . '</li>'; +} + +echo '</ul>'; + +?> + + <!-- // Emails effectivement rejetés --> + <p>Ces mails sont non valides, et filtrés correctement.</p> + <?php +$emails_non_valides_rejetes = ['utilisateurdomaine.f', 'utilis/@domaine', 'utilisateur@', '@domaine.fr']; + +echo '<ul>'; + +foreach ($emails_non_valides_rejetes as $tests => $email) { + echo '<li>' . $email . ' -> passés par email_valide() -> ' . email_valide($email) . '</li>'; +} + +echo '</ul>'; + +?> + + <!-- /* Suggestion d'expression régulière */ --> + <h1>Suggestion d'amélioration</h1> + + <p>Expression régulière proposée (respectant Dreamhost, plus permissif que OVH et excluant les extensions de domaine de plus de 4 caractères) :</p> + <p><strong>^([A-Za-z0-9]|&|+|_|-]){1}([A-Za-z0-9]|&|+|_|-|\.)*@[A-Za-z0-9]([A-Za-z0-9]|-|\.){2,}\.[A-Za-z]{2,4}$</strong></p> + + <?php +function email_public_valide($adresses) +{ + // Si c'est un spammeur autant arreter tout de suite + if (preg_match(",[\n\r].*(MIME|multipart|Content-),i", $adresses)) { + spip_log("Tentative d'injection de mail : {$adresses}"); + return false; + } + + foreach (explode(',', $adresses) as $v) { + // nettoyer certains formats + // "Marie Toto <Marie@toto.com>" + $adresse = trim(preg_replace(',^[^<>"]*<([^<>"]+)>$,i', '\\1', $v)); + // RFC 822 non respectée + if (! preg_match( + '#^([A-Za-z0-9]|\+|&|_|-|]){1}([A-Za-z0-9]|\+|&|_|-|\.)*@[A-Za-z0-9]([A-Za-z0-9]|-|\.){2,}\.[A-Za-z]{2,4}$#', + $adresse + )) { + return false; + } + } + + return $adresse; +} + +?> + + <p>Ces mails sont valides, et bien reconnus.</p> + + <?php +$emails_valides = [ + 'utilisateur@domaine.com', + 'uti-lisa.teur@domai-ne.fr', + '&-_+.spip17&-_+.@domaine.com', + '-@domaine.fr', +]; + +echo '<ul>'; + +foreach ($emails_valides as $tests => $email) { + echo '<li>' . $email . ' -> passés par email_public_valide() -> ' . email_public_valide($email) . '</li>'; +} + +echo '</ul>'; + +?> + + <!-- // Emails effectivement rejetés --> + <p>Ces mails sont non valides, et filtrés correctement.</p> + <?php +$emails_non_valides_rejetes = [ + '#+^-`&%_=|/|_?=!§{}$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@mail.com', + 'utilisateur@domaine.frfrfrfrfrfr', + 'd@d', + 'utilisateurdomaine.f', + 'utilis/@domaine', + 'utilisateur@', + '@domaine.fr', +]; + +echo '<ul>'; + +foreach ($emails_non_valides_rejetes as $tests => $email) { + echo '<li>' . $email . ' -> passés par email_public_valide() -> ' . email_public_valide($email) . '</li>'; +} + +echo '</ul>'; diff --git a/tests/tests/legacy/unit/z_todo/NA_email_valide_5322.php b/tests/tests/legacy/unit/z_todo/NA_email_valide_5322.php new file mode 100644 index 0000000000..f5995cf6f6 --- /dev/null +++ b/tests/tests/legacy/unit/z_todo/NA_email_valide_5322.php @@ -0,0 +1,115 @@ +<?php + +declare(strict_types=1); + +/** + * Lance la suite de tests de Dominic Sayers + * + * @link http://www.dominicsayers.com/isemail + * @link Norme 5322 : http://www.dominicsayers.com/isemail/isemail/RFC5322BNF.html + */ + +$test = 'email_valider_5322'; + +$remonte = __DIR__ . '/'; + +while (! is_file($remonte . 'test.inc')) { + $remonte .= '../'; +} + +require $remonte . 'test.inc'; + +include_spip('inc/filtres'); + +$err = false; + +$nb_positifs = 0; + +$faux_positifs = 0; + +$faux_negatifs = 0; + +function unitTest($email, $expected, $source = '', $comment = '') +{ + $diagnosis = email_valide($email); + $valid = ($diagnosis !== ''); + $not = ($valid) ? 'Valide' : 'Non valide'; + $comment = ($comment === '') ? ' ' : stripslashes("{$comment}"); + + $class = 'ok'; + if ($valid !== $expected) { + $GLOBALS['err'] = true; + $class = 'erreur'; + if ($valid) { + ++$GLOBALS['faux_positifs']; + } else { + ++$GLOBALS['faux_negatifs']; + } + } else { + ++$GLOBALS['nb_positifs']; + } + + return "<dd class='" . $class . "'><span class=\"address\"><em>{$email}</em></span> <br />\n" . + "<span class=\"valid\">{$not} (" . (($valid === $expected) ? 'OK' : 'erreur') . ')</span>' . + ($source ? "<span class=\"source\">Source : {$source}</span>" : '') . + (($comment !== ' ') ? "<span class=\"comment\">({$comment})</span>" : '') . + "</dd>\n"; +} + +$style = '<style type="text/css">' . + '.valid,.comment,.source {margin-left:20px;}' . + '.valid {display:inline-block;width:150px;}' . + '</style>'; + +$document = new DOMDocument(); + +$document->load(__DIR__ . '/email_valide_5322.xml'); + +$suite = $document->getElementsByTagName('tests') + ->item(0); + +if ($suite->hasAttribute('version')) { + $version = $suite->getAttribute('version'); + $entete = "<h3>Suite de tests de validité des adresses email -- version {$version}</h3>\n"; +} + +$testList = $document->getElementsByTagName('test'); + +for ($i = 0; $i < $testList->length; ++$i) { + $tagList = $testList->item($i) +->childNodes; + + $address = ''; + $valid = ''; + $comment = ''; + + for ($j = 0; $j < $tagList->length; ++$j) { + $node = $tagList->item($j); + if ($node->nodeType === XML_ELEMENT_NODE) { + $name = $node->nodeName; + ${$name} = $node->nodeValue; + } + } + + $expected = $valid === 'true'; + $needles = ['\\0', '\\', '"', '$', chr(9), chr(10), chr(13)]; + $substitutes = [chr(0), '\\\\', '\\"', '\\$', '\t', '\n', '\r']; + $address = str_replace($needles, $substitutes, $address); + $comment = str_replace($needles, $substitutes, $comment); + $source = str_replace($needles, $substitutes, $source); + + $php .= "\$tests[] = unitTest(\"{$address}\", {$valid}, \"{$source}\", \"{$comment}\");\n"; +} + +eval($php); + +// si le tableau $err n'est pas vide ca va pas + +if ($GLOBALS['err']) { + echo $style; + echo $entete; + echo '<p><strong>Taux de succès</strong> : ' . ((int) (100 * $nb_positifs / $testList->length)) . " % ( {$faux_positifs} faux positifs et {$faux_negatifs} faux negatifs )</p>"; + echo "<dl>\n" . implode("\n", $tests) . '</dl>'; +} else { + echo 'OK'; +} diff --git a/tests/tests/legacy/unit/z_todo/email_valide_5322.xml b/tests/tests/legacy/unit/z_todo/email_valide_5322.xml new file mode 100644 index 0000000000..a87cd08a3d --- /dev/null +++ b/tests/tests/legacy/unit/z_todo/email_valide_5322.xml @@ -0,0 +1,1739 @@ +<?xml version="1.0" encoding="utf-8"?> +<tests version="1.9"> + <test> + <address>first.last@example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>1</id> + </test> + <test> + <address>1234567890123456789012345678901234567890123456789012345678901234@example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>2</id> + </test> + <test> + <address>first.last@sub.do,com</address> + <valid>false</valid> + <comment>Mistyped comma instead of dot (replaces old #3 which was the same as #57)</comment> + <source>Rob <bob@bob.com></source> + <id>3</id> + </test> + <test> + <address>"first\"last"@example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>4</id> + </test> + <test> + <address>first\@last@example.com</address> + <valid>false</valid> + <comment>Escaping can only happen within a quoted string</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>5</id> + </test> + <test> + <address>"first@last"@example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>6</id> + </test> + <test> + <address>"first\\last"@example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>7</id> + </test> + <test> + <address>x@x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x234</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>8</id> + </test> + <test> + <address>123456789012345678901234567890123456789012345678901234567890@12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.123456789012345678901234567890123456789012345678901234567890123.example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>9</id> + </test> + <test> + <address>first.last@[12.34.56.78]</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>10</id> + </test> + <test> + <address>first.last@[IPv6:::12.34.56.78]</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>11</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:3333::4444:12.34.56.78]</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>12</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.56.78]</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>13</id> + </test> + <test> + <address>first.last@[IPv6:::1111:2222:3333:4444:5555:6666]</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>14</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:3333::4444:5555:6666]</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>15</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:3333:4444:5555:6666::]</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>16</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888]</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>17</id> + </test> + <test> + <address>first.last@x23456789012345678901234567890123456789012345678901234567890123.example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>18</id> + </test> + <test> + <address>first.last@1xample.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>19</id> + </test> + <test> + <address>first.last@123.example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>20</id> + </test> + <test> + <address>123456789012345678901234567890123456789012345678901234567890@12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.1234.example.com</address> + <valid>false</valid> + <comment>Entire address is longer than 256 characters</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>21</id> + </test> + <test> + <address>first.last</address> + <valid>false</valid> + <comment>No @</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>22</id> + </test> + <test> + <address>12345678901234567890123456789012345678901234567890123456789012345@example.com</address> + <valid>false</valid> + <comment>Local part more than 64 characters</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>23</id> + </test> + <test> + <address>.first.last@example.com</address> + <valid>false</valid> + <comment>Local part starts with a dot</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>24</id> + </test> + <test> + <address>first.last.@example.com</address> + <valid>false</valid> + <comment>Local part ends with a dot</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>25</id> + </test> + <test> + <address>first..last@example.com</address> + <valid>false</valid> + <comment>Local part has consecutive dots</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>26</id> + </test> + <test> + <address>"first"last"@example.com</address> + <valid>false</valid> + <comment>Local part contains unescaped excluded characters</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>27</id> + </test> + <test> + <address>"first\last"@example.com</address> + <valid>true</valid> + <comment>Any character can be escaped in a quoted string</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>28</id> + </test> + <test> + <address>"""@example.com</address> + <valid>false</valid> + <comment>Local part contains unescaped excluded characters</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>29</id> + </test> + <test> + <address>"\"@example.com</address> + <valid>false</valid> + <comment>Local part cannot end with a backslash</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>30</id> + </test> + <test> + <address>""@example.com</address> + <valid>false</valid> + <comment>Local part is effectively empty</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>31</id> + </test> + <test> + <address>first\\@last@example.com</address> + <valid>false</valid> + <comment>Local part contains unescaped excluded characters</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>32</id> + </test> + <test> + <address>first.last@</address> + <valid>false</valid> + <comment>No domain</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>33</id> + </test> + <test> + <address>x@x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456</address> + <valid>false</valid> + <comment>Domain exceeds 255 chars</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>34</id> + </test> + <test> + <address>first.last@[.12.34.56.78]</address> + <valid>false</valid> + <comment>Only char that can precede IPv4 address is ':'</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>35</id> + </test> + <test> + <address>first.last@[12.34.56.789]</address> + <valid>false</valid> + <comment>Can't be interpreted as IPv4 so IPv6 tag is missing</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>36</id> + </test> + <test> + <address>first.last@[::12.34.56.78]</address> + <valid>false</valid> + <comment>IPv6 tag is missing</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>37</id> + </test> + <test> + <address>first.last@[IPv5:::12.34.56.78]</address> + <valid>false</valid> + <comment>IPv6 tag is wrong</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>38</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:3333::4444:5555:12.34.56.78]</address> + <valid>false</valid> + <comment>Too many IPv6 groups (4 max)</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>39</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:3333:4444:5555:12.34.56.78]</address> + <valid>false</valid> + <comment>Not enough IPv6 groups</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>40</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:12.34.56.78]</address> + <valid>false</valid> + <comment>Too many IPv6 groups (6 max)</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>41</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777]</address> + <valid>false</valid> + <comment>Not enough IPv6 groups</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>42</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999]</address> + <valid>false</valid> + <comment>Too many IPv6 groups (8 max)</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>43</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222::3333::4444:5555:6666]</address> + <valid>false</valid> + <comment>Too many '::' (can be none or one)</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>44</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:3333::4444:5555:6666:7777]</address> + <valid>false</valid> + <comment>Too many IPv6 groups (6 max)</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>45</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:333x::4444:5555]</address> + <valid>false</valid> + <comment>x is not valid in an IPv6 address</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>46</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:33333::4444:5555]</address> + <valid>false</valid> + <comment>33333 is not a valid group in an IPv6 address</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>47</id> + </test> + <test> + <address>first.last@example.123</address> + <valid>false</valid> + <comment>TLD can't be all digits</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>48</id> + </test> + <test> + <address>first.last@com</address> + <valid>false</valid> + <comment>Mail host must be second- or lower level</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>49</id> + </test> + <test> + <address>first.last@-xample.com</address> + <valid>false</valid> + <comment>Label can't begin with a hyphen</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>50</id> + </test> + <test> + <address>first.last@exampl-.com</address> + <valid>false</valid> + <comment>Label can't end with a hyphen</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>51</id> + </test> + <test> + <address>first.last@x234567890123456789012345678901234567890123456789012345678901234.example.com</address> + <valid>false</valid> + <comment>Label can't be longer than 63 octets</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>52</id> + </test> + <test> + <address>"Abc\@def"@example.com</address> + <valid>true</valid> + <source>RFC3696 (February 2004)</source> + <sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink> + <id>53</id> + </test> + <test> + <address>"Fred\ Bloggs"@example.com</address> + <valid>true</valid> + <source>RFC3696 (as amended by erratum 2005-07-09)</source> + <sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&eid=246</sourcelink> + <id>54</id> + </test> + <test> + <address>"Joe.\\Blow"@example.com</address> + <valid>true</valid> + <source>RFC3696 (as amended by erratum 2005-07-09)</source> + <sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&eid=246</sourcelink> + <id>55</id> + </test> + <test> + <address>"Abc@def"@example.com</address> + <valid>true</valid> + <source>RFC3696 (as amended by erratum 2005-07-09)</source> + <sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&eid=246</sourcelink> + <id>56</id> + </test> + <test> + <address>"Fred Bloggs"@example.com</address> + <valid>true</valid> + <source>RFC3696 (February 2004)</source> + <sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink> + <id>57</id> + </test> + <test> + <address>user+mailbox@example.com</address> + <valid>true</valid> + <source>RFC3696 (February 2004)</source> + <sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink> + <id>58</id> + </test> + <test> + <address>customer/department=shipping@example.com</address> + <valid>true</valid> + <source>RFC3696 (February 2004)</source> + <sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink> + <id>59</id> + </test> + <test> + <address>$A12345@example.com</address> + <valid>true</valid> + <source>RFC3696 (February 2004)</source> + <sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink> + <id>60</id> + </test> + <test> + <address>!def!xyz%abc@example.com</address> + <valid>true</valid> + <source>RFC3696 (February 2004)</source> + <sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink> + <id>61</id> + </test> + <test> + <address>_somename@example.com</address> + <valid>true</valid> + <source>RFC3696 (February 2004)</source> + <sourcelink>http://tools.ietf.org/html/rfc3696#section-3</sourcelink> + <id>62</id> + </test> + <test> + <address>dclo@us.ibm.com</address> + <valid>true</valid> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>63</id> + </test> + <test> + <address>abc\@def@example.com</address> + <valid>false</valid> + <comment>This example from RFC3696 was corrected in an erratum</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>64</id> + </test> + <test> + <address>abc\\@example.com</address> + <valid>false</valid> + <comment>This example from RFC3696 was corrected in an erratum</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>65</id> + </test> + <test> + <address>peter.piper@example.com</address> + <valid>true</valid> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>66</id> + </test> + <test> + <address>Doug\ \"Ace\"\ Lovell@example.com</address> + <valid>false</valid> + <comment>Escaping can only happen in a quoted string</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>67</id> + </test> + <test> + <address>"Doug \"Ace\" L."@example.com</address> + <valid>true</valid> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>68</id> + </test> + <test> + <address>abc@def@example.com</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>69</id> + </test> + <test> + <address>abc\\@def@example.com</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>70</id> + </test> + <test> + <address>abc\@example.com</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>71</id> + </test> + <test> + <address>@example.com</address> + <valid>false</valid> + <comment>No local part</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>72</id> + </test> + <test> + <address>doug@</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>73</id> + </test> + <test> + <address>"qu@example.com</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>74</id> + </test> + <test> + <address>ote"@example.com</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>75</id> + </test> + <test> + <address>.dot@example.com</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>76</id> + </test> + <test> + <address>dot.@example.com</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>77</id> + </test> + <test> + <address>two..dot@example.com</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>78</id> + </test> + <test> + <address>"Doug "Ace" L."@example.com</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>79</id> + </test> + <test> + <address>Doug\ \"Ace\"\ L\.@example.com</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>80</id> + </test> + <test> + <address>hello world@example.com</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>81</id> + </test> + <test> + <address>gatsby@f.sc.ot.t.f.i.tzg.era.l.d.</address> + <valid>false</valid> + <comment>Doug Lovell says this should fail</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>82</id> + </test> + <test> + <valid>true</valid> + <address>test@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>83</id> + </test> + <test> + <valid>true</valid> + <address>TEST@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>84</id> + </test> + <test> + <valid>true</valid> + <address>1234567890@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>85</id> + </test> + <test> + <valid>true</valid> + <address>test+test@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>86</id> + </test> + <test> + <valid>true</valid> + <address>test-test@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>87</id> + </test> + <test> + <valid>true</valid> + <address>t*est@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>88</id> + </test> + <test> + <valid>true</valid> + <address>+1~1+@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>89</id> + </test> + <test> + <valid>true</valid> + <address>{_test_}@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>90</id> + </test> + <test> + <valid>true</valid> + <address>"[[ test ]]"@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>91</id> + </test> + <test> + <valid>true</valid> + <address>test.test@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>92</id> + </test> + <test> + <valid>true</valid> + <address>"test.test"@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>93</id> + </test> + <test> + <valid>true</valid> + <address>test."test"@example.com</address> + <comment>Obsolete form, but documented in RFC2822</comment> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>94</id> + </test> + <test> + <valid>true</valid> + <address>"test@test"@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>95</id> + </test> + <test> + <valid>true</valid> + <address>test@123.123.123.x123</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>96</id> + </test> + <test> + <valid>false</valid> + <address>test@123.123.123.123</address> + <comment>Top Level Domain won't be all-numeric (see RFC3696 Section 2). I disagree with Dave Child on this one.</comment> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>97</id> + </test> + <test> + <valid>true</valid> + <address>test@[123.123.123.123]</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>98</id> + </test> + <test> + <valid>true</valid> + <address>test@example.example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>99</id> + </test> + <test> + <valid>true</valid> + <address>test@example.example.example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>100</id> + </test> + <test> + <valid>false</valid> + <address>test.example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>101</id> + </test> + <test> + <valid>false</valid> + <address>test.@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>102</id> + </test> + <test> + <valid>false</valid> + <address>test..test@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>103</id> + </test> + <test> + <valid>false</valid> + <address>.test@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>104</id> + </test> + <test> + <valid>false</valid> + <address>test@test@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>105</id> + </test> + <test> + <valid>false</valid> + <address>test@@example.com</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>106</id> + </test> + <test> + <valid>false</valid> + <address>-- test --@example.com</address> + <comment>No spaces allowed in local part</comment> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>107</id> + </test> + <test> + <valid>false</valid> + <address>[test]@example.com</address> + <comment>Square brackets only allowed within quotes</comment> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>108</id> + </test> + <test> + <valid>true</valid> + <address>"test\test"@example.com</address> + <comment>Any character can be escaped in a quoted string</comment> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>109</id> + </test> + <test> + <valid>false</valid> + <address>"test"test"@example.com</address> + <comment>Quotes cannot be nested</comment> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>110</id> + </test> + <test> + <valid>false</valid> + <address>()[]\;:,><@example.com</address> + <comment>Disallowed Characters</comment> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>111</id> + </test> + <test> + <valid>false</valid> + <comment>Dave Child says so</comment> + <address>test@.</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>112</id> + </test> + <test> + <valid>false</valid> + <comment>Dave Child says so</comment> + <address>test@example.</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>113</id> + </test> + <test> + <valid>false</valid> + <comment>Dave Child says so</comment> + <address>test@.org</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>114</id> + </test> + <test> + <valid>false</valid> + <address>test@123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012.com</address> + <comment>255 characters is maximum length for domain. This is 256.</comment> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>115</id> + </test> + <test> + <valid>false</valid> + <comment>Dave Child says so</comment> + <address>test@example</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>116</id> + </test> + <test> + <valid>false</valid> + <comment>Dave Child says so</comment> + <address>test@[123.123.123.123</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>117</id> + </test> + <test> + <valid>false</valid> + <comment>Dave Child says so</comment> + <address>test@123.123.123.123]</address> + <source>Dave Child</source> + <sourcelink>http://code.google.com/p/php-email-address-validation/</sourcelink> + <id>118</id> + </test> + <test> + <address>NotAnEmail</address> + <valid>false</valid> + <comment>Phil Haack says so</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>119</id> + </test> + <test> + <address>@NotAnEmail</address> + <valid>false</valid> + <comment>Phil Haack says so</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>120</id> + </test> + <test> + <address>"test\\blah"@example.com</address> + <valid>true</valid> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>121</id> + </test> + <test> + <address>"test\blah"@example.com</address> + <valid>true</valid> + <comment>Any character can be escaped in a quoted string</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>122</id> + </test> + <test> + <address>"test\ blah"@example.com</address> + <valid>true</valid> + <comment>Quoted string specifically excludes carriage returns unless escaped</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>123</id> + </test> + <test> + <address>"test blah"@example.com</address> + <valid>false</valid> + <comment>Quoted string specifically excludes carriage returns</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>124</id> + </test> + <test> + <address>"test\"blah"@example.com</address> + <valid>true</valid> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>125</id> + </test> + <test> + <address>"test"blah"@example.com</address> + <valid>false</valid> + <comment>Phil Haack says so</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>126</id> + </test> + <test> + <address>customer/department@example.com</address> + <valid>true</valid> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>127</id> + </test> + <test> + <address>_Yosemite.Sam@example.com</address> + <valid>true</valid> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>128</id> + </test> + <test> + <address>~@example.com</address> + <valid>true</valid> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>129</id> + </test> + <test> + <address>.wooly@example.com</address> + <valid>false</valid> + <comment>Phil Haack says so</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>130</id> + </test> + <test> + <address>wo..oly@example.com</address> + <valid>false</valid> + <comment>Phil Haack says so</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>131</id> + </test> + <test> + <address>pootietang.@example.com</address> + <valid>false</valid> + <comment>Phil Haack says so</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>132</id> + </test> + <test> + <address>.@example.com</address> + <valid>false</valid> + <comment>Phil Haack says so</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>133</id> + </test> + <test> + <address>"Austin@Powers"@example.com</address> + <valid>true</valid> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>134</id> + </test> + <test> + <address>Ima.Fool@example.com</address> + <valid>true</valid> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>135</id> + </test> + <test> + <address>"Ima.Fool"@example.com</address> + <valid>true</valid> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>136</id> + </test> + <test> + <address>"Ima Fool"@example.com</address> + <valid>true</valid> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>137</id> + </test> + <test> + <address>Ima Fool@example.com</address> + <valid>false</valid> + <comment>Phil Haack says so</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>138</id> + </test> + <test> + <address>phil.h\@\@ck@haacked.com</address> + <valid>false</valid> + <comment>Escaping can only happen in a quoted string</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>139</id> + </test> + <test> + <address>"first"."last"@example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>140</id> + </test> + <test> + <address>"first".middle."last"@example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>141</id> + </test> + <test> + <address>"first\\"last"@example.com</address> + <valid>false</valid> + <comment>Contains an unescaped quote</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>142</id> + </test> + <test> + <address>"first".last@example.com</address> + <valid>true</valid> + <comment>obs-local-part form as described in RFC 2822</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>143</id> + </test> + <test> + <address>first."last"@example.com</address> + <valid>true</valid> + <comment>obs-local-part form as described in RFC 2822</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>144</id> + </test> + <test> + <address>"first"."middle"."last"@example.com</address> + <valid>true</valid> + <comment>obs-local-part form as described in RFC 2822</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>145</id> + </test> + <test> + <address>"first.middle"."last"@example.com</address> + <valid>true</valid> + <comment>obs-local-part form as described in RFC 2822</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>146</id> + </test> + <test> + <address>"first.middle.last"@example.com</address> + <valid>true</valid> + <comment>obs-local-part form as described in RFC 2822</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>147</id> + </test> + <test> + <address>"first..last"@example.com</address> + <valid>true</valid> + <comment>obs-local-part form as described in RFC 2822</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>148</id> + </test> + <test> + <address>foo@[\1.2.3.4]</address> + <valid>false</valid> + <comment>RFC 5321 specifies the syntax for address-literal and does not allow escaping</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>149</id> + </test> + <test> + <address>"first\\\"last"@example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>150</id> + </test> + <test> + <address>first."mid\dle"."last"@example.com</address> + <valid>true</valid> + <comment>Backslash can escape anything but must escape something</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>151</id> + </test> + <test> + <address>Test. Folding. Whitespace@example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>152</id> + </test> + <test> + <address>first."".last@example.com</address> + <valid>false</valid> + <comment>Contains a zero-length element</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>153</id> + </test> + <test> + <address>first\last@example.com</address> + <valid>false</valid> + <comment>Unquoted string must be an atom</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>154</id> + </test> + <test> + <address>Abc\@def@example.com</address> + <valid>false</valid> + <comment>Was incorrectly given as a valid address in the original RFC3696</comment> + <source>RFC3696 erratum 246</source> + <sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&eid=246</sourcelink> + <id>155</id> + </test> + <test> + <address>Fred\ Bloggs@example.com</address> + <valid>false</valid> + <comment>Was incorrectly given as a valid address in the original RFC3696</comment> + <source>RFC3696 erratum 246</source> + <sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&eid=246</sourcelink> + <id>156</id> + </test> + <test> + <address>Joe.\\Blow@example.com</address> + <valid>false</valid> + <comment>Was incorrectly given as a valid address in the original RFC3696</comment> + <source>RFC3696 erratum 246</source> + <sourcelink>http://www.rfc-editor.org/errata_search.php?rfc=3696&eid=246</sourcelink> + <id>157</id> + </test> + <test> + <address>first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.567.89]</address> + <valid>false</valid> + <comment>IPv4 part contains an invalid octet</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>158</id> + </test> + <test> + <address>"test\ blah"@example.com</address> + <valid>false</valid> + <comment>Folding white space can't appear within a quoted pair</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>159</id> + </test> + <test> + <address>"test blah"@example.com</address> + <valid>true</valid> + <comment>This is a valid quoted string with folding white space</comment> + <source>Phil Haack</source> + <sourcelink>http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx</sourcelink> + <id>160</id> + </test> + <test> + <address>{^c\@**Dog^}@cartoon.com</address> + <valid>false</valid> + <comment>This is a throwaway example from Doug Lovell's article. Actually it's not a valid address.</comment> + <source>Doug Lovell (LinuxJournal, June 2007)</source> + <sourcelink>http://www.linuxjournal.com/article/9585</sourcelink> + <id>161</id> + </test> + <test> + <address>(foo)cal(bar)@(baz)iamcal.com(quux)</address> + <valid>true</valid> + <comment>A valid address containing comments</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>162</id> + </test> + <test> + <address>cal@iamcal(woo).(yay)com</address> + <valid>true</valid> + <comment>A valid address containing comments</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>163</id> + </test> + <test> + <address>"foo"(yay)@(hoopla)[1.2.3.4]</address> + <valid>false</valid> + <comment>Address literal can't be commented (RFC5321)</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>164</id> + </test> + <test> + <address>cal(woo(yay)hoopla)@iamcal.com</address> + <valid>true</valid> + <comment>A valid address containing comments</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>165</id> + </test> + <test> + <address>cal(foo\@bar)@iamcal.com</address> + <valid>true</valid> + <comment>A valid address containing comments</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>166</id> + </test> + <test> + <address>cal(foo\)bar)@iamcal.com</address> + <valid>true</valid> + <comment>A valid address containing comments and an escaped parenthesis</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>167</id> + </test> + <test> + <address>cal(foo(bar)@iamcal.com</address> + <valid>false</valid> + <comment>Unclosed parenthesis in comment</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>168</id> + </test> + <test> + <address>cal(foo)bar)@iamcal.com</address> + <valid>false</valid> + <comment>Too many closing parentheses</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>169</id> + </test> + <test> + <address>cal(foo\)@iamcal.com</address> + <valid>false</valid> + <comment>Backslash at end of comment has nothing to escape</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>170</id> + </test> + <test> + <address>first().last@example.com</address> + <valid>true</valid> + <comment>A valid address containing an empty comment</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>171</id> + </test> + <test> + <address>first.( middle )last@example.com</address> + <valid>true</valid> + <comment>Comment with folding white space</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>172</id> + </test> + <test> + <address>first(12345678901234567890123456789012345678901234567890)last@(1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890)example.com</address> + <valid>false</valid> + <comment>Too long with comments, not too long without</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>173</id> + </test> + <test> + <address>first(Welcome to the ("wonderful" (!)) world of email)@example.com</address> + <valid>true</valid> + <comment>Silly example from my blog post</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>174</id> + </test> + <test> + <address>pete(his account)@silly.test(his host)</address> + <valid>true</valid> + <comment>Canonical example from RFC5322</comment> + <source>RFC 5322</source> + <sourcelink>http://tools.ietf.org/html/rfc5322</sourcelink> + <id>175</id> + </test> + <test> + <address>c@(Chris's host.)public.example</address> + <valid>true</valid> + <comment>Canonical example from RFC5322</comment> + <source>RFC 5322</source> + <sourcelink>http://tools.ietf.org/html/rfc5322</sourcelink> + <id>176</id> + </test> + <test> + <address>jdoe@machine(comment). example</address> + <valid>true</valid> + <comment>Canonical example from RFC5322</comment> + <source>RFC 5322</source> + <sourcelink>http://tools.ietf.org/html/rfc5322</sourcelink> + <id>177</id> + </test> + <test> + <address>1234 @ local(blah) .machine .example</address> + <valid>true</valid> + <comment>Canonical example from RFC5322</comment> + <source>RFC 5322</source> + <sourcelink>http://tools.ietf.org/html/rfc5322</sourcelink> + <id>178</id> + </test> + <test> + <address>first(middle)last@example.com</address> + <valid>false</valid> + <comment>Can't have a comment or white space except at an element boundary</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>179</id> + </test> + <test> + <address>first(abc.def).last@example.com</address> + <valid>true</valid> + <comment>Comment can contain a dot</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>180</id> + </test> + <test> + <address>first(a"bc.def).last@example.com</address> + <valid>true</valid> + <comment>Comment can contain double quote</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>181</id> + </test> + <test> + <address>first.(")middle.last(")@example.com</address> + <valid>true</valid> + <comment>Comment can contain a quote</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>182</id> + </test> + <test> + <address>first(abc("def".ghi).mno)middle(abc("def".ghi).mno).last@(abc("def".ghi).mno)example(abc("def".ghi).mno).(abc("def".ghi).mno)com(abc("def".ghi).mno)</address> + <valid>false</valid> + <comment>Can't have comments or white space except at an element boundary</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>183</id> + </test> + <test> + <address>first(abc\(def)@example.com</address> + <valid>true</valid> + <comment>Comment can contain quoted-pair</comment> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>184</id> + </test> + <test> + <address>first.last@x(1234567890123456789012345678901234567890123456789012345678901234567890).com</address> + <valid>true</valid> + <comment>Label is longer than 63 octets, but not with comment removed</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>185</id> + </test> + <test> + <address>a(a(b(c)d(e(f))g)h(i)j)@example.com</address> + <valid>true</valid> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>186</id> + </test> + <test> + <address>a(a(b(c)d(e(f))g)(h(i)j)@example.com</address> + <valid>false</valid> + <comment>Braces are not properly matched</comment> + <source>Cal Henderson</source> + <sourcelink>http://code.iamcal.com/php/rfc822/</sourcelink> + <id>187</id> + </test> + <test> + <address>name.lastname@domain.com</address> + <valid>true</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>188</id> + </test> + <test> + <address>.@</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>189</id> + </test> + <test> + <address>a@b</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>190</id> + </test> + <test> + <address>@bar.com</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>191</id> + </test> + <test> + <address>@@bar.com</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>192</id> + </test> + <test> + <address>a@bar.com</address> + <valid>true</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>193</id> + </test> + <test> + <address>aaa.com</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>194</id> + </test> + <test> + <address>aaa@.com</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>195</id> + </test> + <test> + <address>aaa@.123</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>196</id> + </test> + <test> + <address>aaa@[123.123.123.123]</address> + <valid>true</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>197</id> + </test> + <test> + <address>aaa@[123.123.123.123]a</address> + <valid>false</valid> + <comment>extra data outside ip</comment> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>198</id> + </test> + <test> + <address>aaa@[123.123.123.333]</address> + <valid>false</valid> + <comment>not a valid IP</comment> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>199</id> + </test> + <test> + <address>a@bar.com.</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>200</id> + </test> + <test> + <address>a@bar</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>201</id> + </test> + <test> + <address>a-b@bar.com</address> + <valid>true</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>202</id> + </test> + <test> + <address>+@b.c</address> + <valid>true</valid> + <comment>TLDs can be any length</comment> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>203</id> + </test> + <test> + <address>+@b.com</address> + <valid>true</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>204</id> + </test> + <test> + <address>a@-b.com</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>205</id> + </test> + <test> + <address>a@b-.com</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>206</id> + </test> + <test> + <address>-@..com</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>207</id> + </test> + <test> + <address>-@a..com</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>208</id> + </test> + <test> + <address>a@b.co-foo.uk</address> + <valid>true</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>209</id> + </test> + <test> + <address>"hello my name is"@stutter.com</address> + <valid>true</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>210</id> + </test> + <test> + <address>"Test \"Fail\" Ing"@example.com</address> + <valid>true</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>211</id> + </test> + <test> + <address>valid@special.museum</address> + <valid>true</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>212</id> + </test> + <test> + <address>invalid@special.museum-</address> + <valid>false</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>213</id> + </test> + <test> + <address>shaitan@my-domain.thisisminekthx</address> + <valid>true</valid> + <comment>Disagree with Paul Gregg here</comment> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>214</id> + </test> + <test> + <address>test@...........com</address> + <valid>false</valid> + <comment>......</comment> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>215</id> + </test> + <test> + <address>foobar@192.168.0.1</address> + <valid>false</valid> + <comment>ip need to be []</comment> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>216</id> + </test> + <test> + <address>"Joe\\Blow"@example.com</address> + <valid>true</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>217</id> + </test> + <test> + <address>Invalid \ Folding \ Whitespace@example.com</address> + <valid>false</valid> + <source>Paul Gregg</source> + <comment>This isn't FWS so Dominic Sayers says it's invalid</comment> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>218</id> + </test> + <test> + <address>HM2Kinsists@(that comments are allowed)this.is.ok</address> + <valid>true</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>219</id> + </test> + <test> + <address>user%uucp!path@somehost.edu</address> + <valid>true</valid> + <source>Paul Gregg</source> + <sourcelink>http://pgregg.com/projects/php/code/showvalidemail.php</sourcelink> + <id>220</id> + </test> + <test> + <address>"first(last)"@example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>221</id> + </test> + <test> + <address> ( x ) first ( x ) . ( x) last ( x ) @example.com</address> + <valid>true</valid> + <source>Dominic Sayers</source> + <sourcelink>http://www.dominicsayers.com/isemail</sourcelink> + <id>222</id> + </test> + <test> + <address>test. obs@syntax.com</address> + <valid>true</valid> + <comment>obs-fws allows multiple lines</comment> + <source>George Pollard</source> + <sourcelink>http://porg.es/blog/properly-validating-e-mail-addresses</sourcelink> + <id>223</id> + </test> + <test> + <address>test. obs@syntax.com</address> + <valid>true</valid> + <comment>obs-fws allows multiple lines (test 2: space before break)</comment> + <source>George Pollard</source> + <sourcelink>http://porg.es/blog/properly-validating-e-mail-addresses</sourcelink> + <id>224</id> + </test> + <test> + <address>test. obs@syntax.com</address> + <valid>false</valid> + <comment>obs-fws must have at least one WSP per line</comment> + <source>George Pollard</source> + <sourcelink>http://porg.es/blog/properly-validating-e-mail-addresses</sourcelink> + <id>225</id> + </test> + <test> + <address>"null \\0"@char.com</address> + <valid>true</valid> + <comment>can have escaped null character</comment> + <source>George Pollard</source> + <sourcelink>http://porg.es/blog/properly-validating-e-mail-addresses</sourcelink> + <id>226</id> + </test> + <test> + <address>"null \0"@char.com</address> + <valid>false</valid> + <comment>cannot have unescaped null character</comment> + <source>George Pollard</source> + <sourcelink>http://porg.es/blog/properly-validating-e-mail-addresses</sourcelink> + <id>227</id> + </test> + <test> + <address>null\\0@char.com</address> + <valid>false</valid> + <comment>escaped null must be in quoted string</comment> + <source>George Pollard</source> + <sourcelink>http://porg.es/blog/properly-validating-e-mail-addresses</sourcelink> + <id>228</id> + </test> + <test> + <address>cdburgess+!#$%&'*-/=?+_{}|~test@gmail.com</address> + <valid>true</valid> + <comment>Example given in comments</comment> + <source>http://www.dominicsayers.com/isemail/#comment-30024957</source> + <sourcelink>cdburgess</sourcelink> + <id>229</id> + </test> +</tests> diff --git a/tests/utils/rector/config/set/spip_test_essais_migration.php b/tests/utils/rector/config/set/spip_test_essais_migration.php new file mode 100644 index 0000000000..02a0470985 --- /dev/null +++ b/tests/utils/rector/config/set/spip_test_essais_migration.php @@ -0,0 +1,12 @@ +<?php +declare (strict_types=1); +namespace RectorPrefix202209; + +use Rector\Config\RectorConfig; +use Utils\Rector\Rector\RefactorSpipTestsEssais; +use Utils\Rector\Rector\MoveSpipTestsEssais; + +return static function (RectorConfig $rectorConfig) : void { + $rectorConfig->rule(RefactorSpipTestsEssais::class); + $rectorConfig->rule(MoveSpipTestsEssais::class); +}; diff --git a/tests/utils/rector/src/Rector/MoveSpipTestsEssais.php b/tests/utils/rector/src/Rector/MoveSpipTestsEssais.php new file mode 100644 index 0000000000..4dfc442dd8 --- /dev/null +++ b/tests/utils/rector/src/Rector/MoveSpipTestsEssais.php @@ -0,0 +1,82 @@ +<?php + +declare(strict_types=1); + +namespace Utils\Rector\Rector; + +use PhpParser\Node; +use PhpParser\Node\Name\FullyQualified; +use PhpParser\Node\Stmt\ClassLike; +use Rector\Core\Rector\AbstractRector; +use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; +use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; +use Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector; + +final class MoveSpipTestsEssais extends AbstractRector +{ + private RemovedAndAddedFilesCollector $removedAndAddedFilesCollector; + + public function __construct(RemovedAndAddedFilesCollector $removedAndAddedFilesCollector) + { + $this->removedAndAddedFilesCollector = $removedAndAddedFilesCollector; + } + + /** + * This method helps other to understand the rule and to generate documentation. + */ + public function getRuleDefinition(): RuleDefinition + { + return new RuleDefinition( + 'Move PHPUnit essais/*.php to another directory.', + [ + new CodeSample( + <<<CODESAMPLE + // essais/some_dir/some_file.php + namespace Spip\Core\Tests\Something; + class SomeWhatTest { + } + CODESAMPLE, + <<<CODESAMPLE + // Something/SomeWhatTest.php + namespace Spip\Core\Tests\Something; + class SomeWhatTest { + } + CODESAMPLE, + ), + ] + ); + } + + /** + * @return array<class-string<Node>> + */ + public function getNodeTypes(): array + { + return [ClassLike::class]; + } + + /** @see https://github.com/rectorphp/rector/blob/main/rules/Restoration/Rector/ClassLike/UpdateFileNameByClassNameFileSystemRector.php */ + public function refactor(Node $node): ?Node + { + $className = $this->getName($node); + if ($className === null) { + return null; + } + + $classShortName = $this->nodeNameResolver->getShortName($className); + $filePath = $this->file->getFilePath(); + $basename = \pathinfo($filePath, \PATHINFO_FILENAME); + if ($classShortName === $basename) { + return null; + } + + $ns = new FullyQualified($className); + $newPath = str_replace('\\', '/', $ns->slice(3)->toString()); + + // no match → rename file + $newFileLocation = \dirname($filePath, 3) . \DIRECTORY_SEPARATOR . $newPath . '.php'; + + $this->removedAndAddedFilesCollector->addMovedFile($this->file, $newFileLocation); + return null; + } +} diff --git a/tests/utils/rector/src/Rector/RefactorSpipTestsEssais.php b/tests/utils/rector/src/Rector/RefactorSpipTestsEssais.php new file mode 100644 index 0000000000..663efb5b8f --- /dev/null +++ b/tests/utils/rector/src/Rector/RefactorSpipTestsEssais.php @@ -0,0 +1,336 @@ +<?php + +declare(strict_types=1); + +namespace Utils\Rector\Rector; + +use PhpParser\Builder\Class_ as ClassBuilder; +use PhpParser\BuilderFactory; +use PhpParser\Node; +use PhpParser\Node\Arg; +use PhpParser\Node\Expr\Assign; +use PhpParser\Node\Expr\FuncCall; +use PhpParser\Node\Expr\MethodCall; +use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Identifier; +use PhpParser\Node\Name; +use PhpParser\Node\Name\FullyQualified; +use PhpParser\Node\Stmt\Namespace_; +use PhpParser\Node\Stmt\ClassLike; +use PhpParser\Node\Stmt\Else_; +use PhpParser\Node\Stmt\Expression; +use PhpParser\Node\Stmt\Function_; +use PhpParser\Node\Stmt\If_; +use PhpParser\Node\Stmt\Return_; +use Rector\Core\Rector\AbstractRector; +use Rector\TypeDeclaration\ValueObject\AssignToVariable; +use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; +use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; +use RectorPrefix202209\Symfony\Component\String\UnicodeString; + +final class RefactorSpipTestsEssais extends AbstractRector +{ + private string $namespaceFrom = 'Spip\\Core\\Tests'; + private string $namespaceTo = 'Spip\\Core\\Tests'; + private array $moves = [ + 'ConnectSql' => 'Sql\\Objets', + 'Filtres' => 'Filtre', + 'FiltresMime' => 'Filtre\\Mime', + 'FiltresMini' => 'Filtre\\Mini', + 'Json' => 'Format\\Json', + 'Xml' => 'Format\\Xml', + ]; + private BuilderFactory $builderFactory; + + public function __construct( + BuilderFactory $builderFactory, + ) { + $this->builderFactory = $builderFactory; + } + + public function getRuleDefinition(): RuleDefinition + { + return new RuleDefinition( + 'Move essais/*.php to PHPUnit.', + [ + new CodeSample( + <<<CODESAMPLE + function test_connect_sql_id_table_objet(...\$args) { + return id_table_objet(...\$args); + } + // ... + CODESAMPLE, + <<<CODESAMPLE + class IdTableObjetTest extends TestCase { + function testIdTableObjet(\$expected, ...\$args) { + \$this->expectEquals(\$expected, id_table_objet(...\$args)); + } + // ... + } + CODESAMPLE, + ), + ] + ); + } + + /** + * @return array<class-string<Node>> + */ + public function getNodeTypes(): array + { + return [Namespace_::class]; + } + + public function refactor(Node $node): ?Node + { + if ($this->shouldSkip($node)) { + return null; + } + + $fqdn = $this->generateFqdn(); + $this->changeNodeNamespace($node, $fqdn->slice(0, -1)->toString()); + + $uses = $this->nodeFactory->createUsesFromNames(['PHPUnit\\Framework\\TestCase']); + + $classBuilder = $this->builderFactory->class($fqdn->getLast()); + $classBuilder->extend('TestCase'); + + $this->generateMethodSetUpBeforeClass($node, $classBuilder); + $this->generateMethodSetUp($node, $classBuilder); + $this->generateMethodTearDown($node, $classBuilder); + $this->generateMethodTest($node, $classBuilder); + $this->generateMethodProvider($node, $classBuilder); + + $class = $classBuilder->getNode(); + $class->namespacedName = new FullyQualified($this->getName($node) . '\\' . $fqdn->getLast()); + + // s’il en reste… c’est un problème + if ($node->stmts) { + throw new \Exception('Zut, on n’a pas mangé tous les stmts…'); + } + + $node->stmts = [ + ...$uses, + $class, + ]; + + return $node; + + } + + private function shouldSkip(Node $node): bool { + // Skip if a class is already there. + foreach ($node->stmts as $stmt) { + if ($stmt instanceof ClassLike) { + return true; + } + } + return false; + } + + private function toCamelCase(string $str): string { + $str = new UnicodeString($str); + return $str->camel()->toString(); + } + + private function generateFqdn(): FullyQualified + { + $filePath = $this->file->getFilePath(); + $dirname = basename(\pathinfo($filePath, \PATHINFO_DIRNAME)); + $basename = \pathinfo($filePath, \PATHINFO_FILENAME); + + $dir = ucfirst($this->toCamelCase($dirname)); + $file = ucfirst($this->toCamelCase($basename)) . 'Test'; + + $newDir = $this->moves[$dir] ?? $dir; + + return new FullyQualified($this->namespaceTo . "\\$newDir\\$file"); + } + + private function changeNodeNamespace(Node $node, string $namespace): void { + $this->isChangedInNamespaces[$namespace] = \true; + $node->name = new Name($namespace); + } + + private function generateMethodSetUpBeforeClass(Node $node, ClassBuilder $classBuilder): void + { + $stmts = []; + foreach ($node->stmts as $key => $stmt) { + if ($stmt instanceof Expression) { + $stmts[] = $stmt; + unset($node->stmts[$key]); + } + } + if (!$stmts) { + return; + } + + $method = $this->builderFactory->method('setUpBeforeClass'); + $method + ->makePublic() + ->makeStatic() + ->setReturnType(new Identifier('void')) + ->addStmts($stmts); + + $classBuilder->addStmt($method->getNode()); + } + + private function generateMethodSetUp(Node $node, ClassBuilder $classBuilder): void + { + $stmts = []; + foreach ($node->stmts as $key => $stmt) { + if (!$stmt instanceof Function_) { + continue; + } + $name = $stmt->name->toString(); + if (!str_starts_with($name, 'pretest_')) { + continue; + } + $stmts = [...$stmts, ...$stmt->stmts]; + unset($node->stmts[$key]); + } + if (!$stmts) { + return; + } + + $method = $this->builderFactory->method('setUp'); + $method + ->makePublic() + ->setReturnType(new Identifier('void')) + ->addStmts($stmts); + + $classBuilder->addStmt($method->getNode()); + } + + + private function generateMethodTearDown(Node $node, ClassBuilder $classBuilder): void + { + $stmts = []; + foreach ($node->stmts as $key => $stmt) { + if (!$stmt instanceof Function_) { + continue; + } + $name = $stmt->name->toString(); + if (!str_starts_with($name, 'posttest_')) { + continue; + } + $stmts = [...$stmts, ...$stmt->stmts]; + unset($node->stmts[$key]); + } + if (!$stmts) { + return; + } + + $method = $this->builderFactory->method('tearDown'); + $method + ->makePublic() + ->setReturnType(new Identifier('void')) + ->addStmts($stmts); + + $classBuilder->addStmt($method->getNode()); + } + + private function generateMethodTest(Node $node, ClassBuilder $classBuilder): void + { + foreach ($node->stmts as $key => $stmt) { + if (!$stmt instanceof Function_) { + continue; + } + $name = $stmt->name->toString(); + if (!str_starts_with($name, 'test_')) { + continue; + } + + $newName = $this->toCamelCase($name); + $method = $this->builderFactory->method($newName); + $method + ->makePublic() + ->setReturnType(new Identifier('void')) + ->addStmts($this->transformTestMethodContent($stmt->stmts)); + + $param = $this->builderFactory->param('expected'); + $method->addParam($param->getNode()); + + $param = $this->builderFactory->param('args'); + $param->makeVariadic(); + $method->addParam($param->getNode()); + + $method->setDocComment("/** @dataProvider provider" . ucfirst(substr($newName, 4)) . ' */'); + + $classBuilder->addStmt($method->getNode()); + unset($node->stmts[$key]); + } + } + + /** + * @param Node[] $nodes + * @return Node[] + */ + private function transformTestMethodContent(array $nodes): array { + foreach ($nodes as $key => $node) { + if ($node instanceof Return_) { + // ...$args + # new Arg(new Variable('args'), false, true); + $expected = new Variable('expected'); + $actual = new Variable('actual'); + $assignActual = new Assign($actual, $node->expr); + $callAssertSame = new MethodCall(new Variable('this'), 'assertSame', [ + new Arg($expected), + new Arg($actual), + ]); + $callAssertEquals = new MethodCall(new Variable('this'), 'assertEquals', [ + new Arg($expected), + new Arg($actual), + ]); + + array_splice($nodes, $key, 1, [$assignActual, $callAssertSame, $callAssertEquals]); + + // if (is_array($expected)) ... + /* + if (false) { + $cond = new FuncCall(new Name('is_array'), [ + new Arg($expected), + ]); + + $if = new If_($cond); + + $callAssertContains = new MethodCall(new Variable('this'), 'assertContains', [ + new Arg($actual), + new Arg($expected), + ]); + + $if->stmts = [new Expression($callAssertContains)]; + $if->else = new Else_([ + new Expression($assignActual), + new Expression($callAssertSame), + new Expression($callAssertEquals), + ]); + $nodes[$key] = $if; + }*/ + } + } + return $nodes; + } + + private function generateMethodProvider(Node $node, ClassBuilder $classBuilder): void + { + foreach ($node->stmts as $key => $stmt) { + if (!$stmt instanceof Function_) { + continue; + } + $name = $stmt->name->toString(); + if (!str_starts_with($name, 'essais_')) { + continue; + } + $newName = $this->toCamelCase(str_replace('essais_', 'provider_', $name)); + $method = $this->builderFactory->method($newName); + $method + ->makePublic() + ->setReturnType(new Identifier('array')) + ->addStmts($stmt->stmts); + + $classBuilder->addStmt($method->getNode()); + unset($node->stmts[$key]); + } + } +} diff --git a/tests/utils/rector/src/Rector/Set/ValueObject/SpipTestSetList.php b/tests/utils/rector/src/Rector/Set/ValueObject/SpipTestSetList.php new file mode 100644 index 0000000000..64aaac2f9b --- /dev/null +++ b/tests/utils/rector/src/Rector/Set/ValueObject/SpipTestSetList.php @@ -0,0 +1,13 @@ +<?php + +declare (strict_types=1); +namespace Utils\Rector\Rector\Set\ValueObject; + +use Rector\Set\Contract\SetListInterface; +/** + * @api + */ +final class SpipTestSetList implements SetListInterface +{ + public const ESSAIS_MIGRATION = __DIR__ . '/../../../../config/set/spip_test_essais_migration.php'; +} -- GitLab