diff --git a/ecrire/tests/Squelettes/Critere/TraductionTest.php b/ecrire/tests/Squelettes/Critere/TraductionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3f49cdfa44b7acd239a02c9d312a268f4590ab45 --- /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 cd39f3d5ccd28fe39b75769ef81fd700e39bed0c..0000000000000000000000000000000000000000 --- 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})] -