From 565155ce7fa76d0998f7842a076263bf000e0dd8 Mon Sep 17 00:00:00 2001 From: Matthieu Marcillaud <marcimat@rezo.net> Date: Sun, 9 Jul 2023 13:07:54 +0200 Subject: [PATCH] =?UTF-8?q?tests:=20Crit=C3=A8re=20Traduction=20en=20PHPUn?= =?UTF-8?q?it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Squelettes/Critere/TraductionTest.php | 52 +++++++++++++++++++ .../legacy/unit/criteres/traduction.html | 40 -------------- 2 files changed, 52 insertions(+), 40 deletions(-) create mode 100644 ecrire/tests/Squelettes/Critere/TraductionTest.php delete mode 100644 ecrire/tests/legacy/unit/criteres/traduction.html diff --git a/ecrire/tests/Squelettes/Critere/TraductionTest.php b/ecrire/tests/Squelettes/Critere/TraductionTest.php new file mode 100644 index 0000000000..3f49cdfa44 --- /dev/null +++ b/ecrire/tests/Squelettes/Critere/TraductionTest.php @@ -0,0 +1,52 @@ +<?php + +declare(strict_types=1); + +namespace Spip\Test\Squelettes\Critere; + +use PHPUnit\Framework\Attributes\Depends; +use Spip\Test\SquelettesTestCase; +use Spip\Test\Templating; + +class TraductionTest extends SquelettesTestCase +{ + + /** Un article sans trad */ + public function testArticleSansTraduction(): void { + $templating = Templating::fromString(); + $result = $templating->render(<<<SPIP + <BOUCLE_principale(ARTICLES){id_trad=0}{0,1}> + <BOUCLE_check(ARTICLES){traduction}> </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> + ok + SPIP); + if ($this->isNa($result)) { + $this->markTestSkipped($result); + } + + $this->assertOk($result); + } + + /** un article et ses traductions */ + public function testArticleAvecTraductions(): void { + $templating = Templating::fromString(); + $result = $templating->render(<<<SPIP + <BOUCLE_s(ARTICLES){id_trad>0}{0,1}> + <BOUCLE_t(ARTICLES){traduction}> </BOUCLE_t> + </BOUCLE_s> + NA Le test 2 necessite un article publie et traduit + <//B_s> + ok + SPIP); + if ($this->isNa($result)) { + $this->markTestSkipped($result); + } + + $this->assertOk($result); + } +} diff --git a/ecrire/tests/legacy/unit/criteres/traduction.html b/ecrire/tests/legacy/unit/criteres/traduction.html deleted file mode 100644 index cd39f3d5cc..0000000000 --- a/ecrire/tests/legacy/unit/criteres/traduction.html +++ /dev/null @@ -1,40 +0,0 @@ -[(#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})] - -- GitLab