Skip to content
Extraits de code Groupes Projets
Valider 565155ce rédigé par marcimat's avatar marcimat Validation de marcimat
Parcourir les fichiers

tests: Critère Traduction en PHPUnit

parent cb0095f7
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
<?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);
}
}
[(#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})]
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter