@@ -11,27 +11,27 @@ discard block |
||
| 11 | 11 | class OrigineTraductionTest extends SquelettesTestCase |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | - /** Un article non traduit est bien {origine_traduction} */ |
|
| 15 | - public function testArticleTraduitEstOrigineTraduction(): void { |
|
| 16 | - $templating = Templating::fromString(); |
|
| 17 | - $result = $templating->render(<<<SPIP |
|
| 14 | + /** Un article non traduit est bien {origine_traduction} */ |
|
| 15 | + public function testArticleTraduitEstOrigineTraduction(): void { |
|
| 16 | + $templating = Templating::fromString(); |
|
| 17 | + $result = $templating->render(<<<SPIP |
|
| 18 | 18 | <BOUCLE_t(ARTICLES)/>[(#TOTAL_BOUCLE|<{2}|?{NA il faut des articles})]<//B_t> |
| 19 | 19 | <BOUCLE_ori(ARTICLES){origine_traduction}{id_trad=0}{0,1}> </BOUCLE_ori> |
| 20 | 20 | Erreur boucle origine |
| 21 | 21 | <//B_ori> |
| 22 | 22 | ok |
| 23 | 23 | SPIP); |
| 24 | - if ($this->isNa($result)) { |
|
| 25 | - $this->markTestSkipped($result); |
|
| 26 | - } |
|
| 24 | + if ($this->isNa($result)) { |
|
| 25 | + $this->markTestSkipped($result); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - $this->assertOk($result); |
|
| 29 | - } |
|
| 28 | + $this->assertOk($result); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** Un article traduit n'a qu'une traduction qui est {origine_traduction} */ |
|
| 32 | - public function testArticleTraduitAUneSeuleTraductionOrigineTraduction(): void { |
|
| 33 | - $templating = Templating::fromString(); |
|
| 34 | - $result = $templating->render(<<<SPIP |
|
| 31 | + /** Un article traduit n'a qu'une traduction qui est {origine_traduction} */ |
|
| 32 | + public function testArticleTraduitAUneSeuleTraductionOrigineTraduction(): void { |
|
| 33 | + $templating = Templating::fromString(); |
|
| 34 | + $result = $templating->render(<<<SPIP |
|
| 35 | 35 | <BOUCLE_ori2(ARTICLES){id_trad>0}{origine_traduction}> |
| 36 | 36 | <BOUCLE_casse(ARTICLES){traduction}{origine_traduction}{!id_article}> |
| 37 | 37 | Boum ! #ID_ARTICLE ne devrait pas etre origine |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | <//B_ori2> |
| 42 | 42 | OK |
| 43 | 43 | SPIP); |
| 44 | - if ($this->isNa($result)) { |
|
| 45 | - $this->markTestSkipped($result); |
|
| 46 | - } |
|
| 44 | + if ($this->isNa($result)) { |
|
| 45 | + $this->markTestSkipped($result); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - $this->assertOk($result); |
|
| 49 | - } |
|
| 48 | + $this->assertOk($result); |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -10,58 +10,58 @@ |
||
| 10 | 10 | |
| 11 | 11 | class DoublonsTest extends SquelettesTestCase |
| 12 | 12 | { |
| 13 | - public function testCritereDoublons(): void { |
|
| 14 | - $this->assertOkCode( |
|
| 15 | - ' |
|
| 13 | + public function testCritereDoublons(): void { |
|
| 14 | + $this->assertOkCode( |
|
| 15 | + ' |
|
| 16 | 16 | <BOUCLE_a(ARTICLES){statut=.*}{doublons}></BOUCLE_a> |
| 17 | 17 | <BOUCLE_b(ARTICLES){statut=.*}{tout}{doublons}{0,1}>Erreur doublons articles</BOUCLE_b> |
| 18 | 18 | ok<//B_b> |
| 19 | 19 | ' |
| 20 | - ); |
|
| 21 | - $this->assertOkCode( |
|
| 22 | - ' |
|
| 20 | + ); |
|
| 21 | + $this->assertOkCode( |
|
| 22 | + ' |
|
| 23 | 23 | <BOUCLE_a(ARTICLES){doublons}></BOUCLE_a> |
| 24 | 24 | <BOUCLE_b(ARTICLES){doublons}{0,1}>Erreur doublons articles</BOUCLE_b> |
| 25 | 25 | ok<//B_b> |
| 26 | 26 | ' |
| 27 | - ); |
|
| 28 | - } |
|
| 27 | + ); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public function testCritereDoublonsMultiplesBoucles(): void { |
|
| 31 | - $this->assertOkSquelette(__DIR__ . '/data/doublons.html'); |
|
| 32 | - } |
|
| 30 | + public function testCritereDoublonsMultiplesBoucles(): void { |
|
| 31 | + $this->assertOkSquelette(__DIR__ . '/data/doublons.html'); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - public function testDoublonsAuteurs(): void { |
|
| 35 | - $templating = Templating::fromString(); |
|
| 36 | - $n = $templating->render('<BOUCLE_a(AUTEURS)>#COMPTEUR_BOUCLE</BOUCLE_a>'); |
|
| 34 | + public function testDoublonsAuteurs(): void { |
|
| 35 | + $templating = Templating::fromString(); |
|
| 36 | + $n = $templating->render('<BOUCLE_a(AUTEURS)>#COMPTEUR_BOUCLE</BOUCLE_a>'); |
|
| 37 | 37 | |
| 38 | - if ($n <= 1) { |
|
| 39 | - $this->markTestSkipped('Il faut au moins 2 auteurs ayant publie sur le site !'); |
|
| 40 | - } |
|
| 38 | + if ($n <= 1) { |
|
| 39 | + $this->markTestSkipped('Il faut au moins 2 auteurs ayant publie sur le site !'); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $this->assertOkCode(' |
|
| 42 | + $this->assertOkCode(' |
|
| 43 | 43 | <BOUCLE_a(AUTEURS){doublons}></BOUCLE_a> |
| 44 | 44 | <BOUCLE_b(AUTEURS){doublons}{0,1}>Erreur doublons Auteurs</BOUCLE_b>OK<//B_b> |
| 45 | 45 | '); |
| 46 | - } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - #[Depends('testDoublonsAuteurs')] |
|
| 49 | - public function testDoublonsNommesAuteurs(): void { |
|
| 50 | - $this->assertOkCode(' |
|
| 48 | + #[Depends('testDoublonsAuteurs')] |
|
| 49 | + public function testDoublonsNommesAuteurs(): void { |
|
| 50 | + $this->assertOkCode(' |
|
| 51 | 51 | <BOUCLE_a(AUTEURS){doublons polisson}></BOUCLE_a> |
| 52 | 52 | <BOUCLE_b(AUTEURS){doublons polisson}{0,1}>Erreur doublons Auteurs</BOUCLE_b>OK<//B_b> |
| 53 | 53 | '); |
| 54 | - $this->assertOkCode(' |
|
| 54 | + $this->assertOkCode(' |
|
| 55 | 55 | <BOUCLE_a(AUTEURS){1/2}{doublons kakis}></BOUCLE_a> |
| 56 | 56 | <BOUCLE_b(AUTEURS){2/2}{doublons kokos}></BOUCLE_b> |
| 57 | 57 | <BOUCLE_c(AUTEURS){doublons kakis}{0,1}>ok</BOUCLE_c>Erreur doubles doublons Auteurs<//B_c> |
| 58 | 58 | '); |
| 59 | - $this->assertOkCode(' |
|
| 59 | + $this->assertOkCode(' |
|
| 60 | 60 | <BOUCLE_a(AUTEURS){1/2}{doublons kakis}></BOUCLE_a> |
| 61 | 61 | <BOUCLE_b(AUTEURS){2/2}{doublons kokos}></BOUCLE_b> |
| 62 | 62 | <BOUCLE_c(AUTEURS){doublons kakis}{0,1}> </BOUCLE_c>Erreur doubles doublons Auteurs<//B_c> |
| 63 | 63 | <BOUCLE_d(AUTEURS){doublons kokos}{0,1}> </BOUCLE_d>Erreur doubles doublons Auteurs<//B_d> |
| 64 | 64 | <BOUCLE_e(AUTEURS){doublons kakis}{doublons kokos}{0,1}>Erreur doubles doublons Auteurs</BOUCLE_e>OK<//B_e> |
| 65 | 65 | '); |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function testCritereDoublonsMultiplesBoucles(): void { |
| 31 | - $this->assertOkSquelette(__DIR__ . '/data/doublons.html'); |
|
| 31 | + $this->assertOkSquelette(__DIR__.'/data/doublons.html'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function testDoublonsAuteurs(): void { |
@@ -11,10 +11,10 @@ discard block |
||
| 11 | 11 | class TraductionTest extends SquelettesTestCase |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | - /** Un article sans trad */ |
|
| 15 | - public function testArticleSansTraduction(): void { |
|
| 16 | - $templating = Templating::fromString(); |
|
| 17 | - $result = $templating->render(<<<SPIP |
|
| 14 | + /** Un article sans trad */ |
|
| 15 | + public function testArticleSansTraduction(): void { |
|
| 16 | + $templating = Templating::fromString(); |
|
| 17 | + $result = $templating->render(<<<SPIP |
|
| 18 | 18 | <BOUCLE_principale(ARTICLES){id_trad=0}{0,1}> |
| 19 | 19 | <BOUCLE_check(ARTICLES){traduction}> </BOUCLE_check> |
| 20 | 20 | boucle check: le critere {traduction} a echoue |
@@ -25,17 +25,17 @@ discard block |
||
| 25 | 25 | <//B_principale> |
| 26 | 26 | ok |
| 27 | 27 | SPIP); |
| 28 | - if ($this->isNa($result)) { |
|
| 29 | - $this->markTestSkipped($result); |
|
| 30 | - } |
|
| 28 | + if ($this->isNa($result)) { |
|
| 29 | + $this->markTestSkipped($result); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - $this->assertOk($result); |
|
| 33 | - } |
|
| 32 | + $this->assertOk($result); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** un article et ses traductions */ |
|
| 36 | - public function testArticleAvecTraductions(): void { |
|
| 37 | - $templating = Templating::fromString(); |
|
| 38 | - $result = $templating->render(<<<SPIP |
|
| 35 | + /** un article et ses traductions */ |
|
| 36 | + public function testArticleAvecTraductions(): void { |
|
| 37 | + $templating = Templating::fromString(); |
|
| 38 | + $result = $templating->render(<<<SPIP |
|
| 39 | 39 | <BOUCLE_s(ARTICLES){id_trad>0}{0,1}> |
| 40 | 40 | <BOUCLE_t(ARTICLES){traduction}> </BOUCLE_t> |
| 41 | 41 | </BOUCLE_s> |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | <//B_s> |
| 44 | 44 | ok |
| 45 | 45 | SPIP); |
| 46 | - if ($this->isNa($result)) { |
|
| 47 | - $this->markTestSkipped($result); |
|
| 48 | - } |
|
| 46 | + if ($this->isNa($result)) { |
|
| 47 | + $this->markTestSkipped($result); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - $this->assertOk($result); |
|
| 51 | - } |
|
| 50 | + $this->assertOk($result); |
|
| 51 | + } |
|
| 52 | 52 | } |
@@ -10,18 +10,18 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class BrancheTest extends SquelettesTestCase |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Un test pour le critere {branche} |
|
| 15 | - * |
|
| 16 | - * verifie : |
|
| 17 | - * - une rubrique est dans sa branche |
|
| 18 | - * - sa fille est dans sa branche |
|
| 19 | - * - elle n'est pas dans la branche de sa fille |
|
| 20 | - * - que la boucle documents compile sans erreur |
|
| 21 | - * - que la boucle articles compile sans erreur |
|
| 22 | - */ |
|
| 23 | - public function testCritereBranche(): void { |
|
| 24 | - $this->assertOkCode(<<<SPIP |
|
| 13 | + /** |
|
| 14 | + * Un test pour le critere {branche} |
|
| 15 | + * |
|
| 16 | + * verifie : |
|
| 17 | + * - une rubrique est dans sa branche |
|
| 18 | + * - sa fille est dans sa branche |
|
| 19 | + * - elle n'est pas dans la branche de sa fille |
|
| 20 | + * - que la boucle documents compile sans erreur |
|
| 21 | + * - que la boucle articles compile sans erreur |
|
| 22 | + */ |
|
| 23 | + public function testCritereBranche(): void { |
|
| 24 | + $this->assertOkCode(<<<SPIP |
|
| 25 | 25 | <BOUCLE_a(RUBRIQUES){id_parent>0}> |
| 26 | 26 | <BOUCLE_b(RUBRIQUES){id_rubrique=#ID_PARENT}> |
| 27 | 27 | <BOUCLE_d(RUBRIQUES){branche}{id_rubrique}> |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | </BOUCLE_a> |
| 41 | 41 | ok |
| 42 | 42 | SPIP); |
| 43 | - } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public function testCompileBoucle(): void { |
|
| 46 | - $this->assertOkCode(<<<SPIP |
|
| 45 | + public function testCompileBoucle(): void { |
|
| 46 | + $this->assertOkCode(<<<SPIP |
|
| 47 | 47 | <BOUCLE_art(ARTICLES){branche}{0,1}> </BOUCLE_art> |
| 48 | 48 | <BOUCLE_docs(DOCUMENTS){branche}{0,1}> </BOUCLE_docs> |
| 49 | 49 | OK |
| 50 | 50 | SPIP); |
| 51 | - } |
|
| 51 | + } |
|
| 52 | 52 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $id_document = sql_getfetsel( |
| 51 | 51 | 'id_document', |
| 52 | 52 | 'spip_documents', |
| 53 | - sql_in('mode', ['logoon','logooff','vignette'], 'not'), |
|
| 53 | + sql_in('mode', ['logoon', 'logooff', 'vignette'], 'not'), |
|
| 54 | 54 | orderby: 'rand()', |
| 55 | 55 | limit: '0,1' |
| 56 | 56 | ); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | 'id_article' => -1, |
| 62 | 62 | 'titre' => 'test pour doublons_notes.html', |
| 63 | 63 | 'statut' => 'prepa', |
| 64 | - 'texte' => 'hello [[ xx <doc' . $id_document . '> ]].' |
|
| 64 | + 'texte' => 'hello [[ xx <doc'.$id_document.'> ]].' |
|
| 65 | 65 | ]; |
| 66 | 66 | $id_article = sql_getfetsel('id_article', 'spip_articles', 'id_article = -1'); |
| 67 | 67 | if ($id_article === null) { |
@@ -10,19 +10,19 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class DoublonsNotesTest extends SquelettesTestCase |
| 12 | 12 | { |
| 13 | - public static function tearDownAfterClass(): void { |
|
| 14 | - sql_delete('spip_articles', 'id_article = -1'); |
|
| 15 | - } |
|
| 13 | + public static function tearDownAfterClass(): void { |
|
| 14 | + sql_delete('spip_articles', 'id_article = -1'); |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * On cherche un article avec un document en note dans le texte, |
|
| 19 | - * et on veut qu'il soit pris par {doublons} |
|
| 20 | - * cf. https://git.spip.net/spip/spip/issues/779 |
|
| 21 | - */ |
|
| 22 | - public function testCritereDoublonsNotes(): void { |
|
| 23 | - $id_document = $this->creer_article_a_doublons_notes(); |
|
| 17 | + /** |
|
| 18 | + * On cherche un article avec un document en note dans le texte, |
|
| 19 | + * et on veut qu'il soit pris par {doublons} |
|
| 20 | + * cf. https://git.spip.net/spip/spip/issues/779 |
|
| 21 | + */ |
|
| 22 | + public function testCritereDoublonsNotes(): void { |
|
| 23 | + $id_document = $this->creer_article_a_doublons_notes(); |
|
| 24 | 24 | |
| 25 | - $this->assertOkCode(<<<SPIP |
|
| 25 | + $this->assertOkCode(<<<SPIP |
|
| 26 | 26 | <BOUCLE_d(DOCUMENTS){id_document=#ENV{id_document}}{statut==.*}> |
| 27 | 27 | <BOUCLE_a(ARTICLES){id_article=-1}{statut==.*}>[(#TEXTE|?)]</BOUCLE_a> |
| 28 | 28 | <BOUCLE_test(DOCUMENTS){id_document}{doublons}> |
@@ -34,41 +34,41 @@ discard block |
||
| 34 | 34 | erreur, pas de document |
| 35 | 35 | <//B_d> |
| 36 | 36 | SPIP, |
| 37 | - [ |
|
| 38 | - 'id_article' => -1, |
|
| 39 | - 'id_document' => $id_document, |
|
| 40 | - ] |
|
| 41 | - ); |
|
| 42 | - } |
|
| 37 | + [ |
|
| 38 | + 'id_article' => -1, |
|
| 39 | + 'id_document' => $id_document, |
|
| 40 | + ] |
|
| 41 | + ); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Creation article de test pour doublons_notes.html |
|
| 46 | - * On cherche un document, on le met dans la note d'un texte, |
|
| 47 | - * @return int id_document |
|
| 48 | - */ |
|
| 49 | - private function creer_article_a_doublons_notes(): int { |
|
| 50 | - $id_document = sql_getfetsel( |
|
| 51 | - 'id_document', |
|
| 52 | - 'spip_documents', |
|
| 53 | - sql_in('mode', ['logoon','logooff','vignette'], 'not'), |
|
| 54 | - orderby: 'rand()', |
|
| 55 | - limit: '0,1' |
|
| 56 | - ); |
|
| 57 | - if (!$id_document) { |
|
| 58 | - $this->markTestSkipped('Il faut un document'); |
|
| 59 | - } |
|
| 60 | - $data = [ |
|
| 61 | - 'id_article' => -1, |
|
| 62 | - 'titre' => 'test pour doublons_notes.html', |
|
| 63 | - 'statut' => 'prepa', |
|
| 64 | - 'texte' => 'hello [[ xx <doc' . $id_document . '> ]].' |
|
| 65 | - ]; |
|
| 66 | - $id_article = sql_getfetsel('id_article', 'spip_articles', 'id_article = -1'); |
|
| 67 | - if ($id_article === null) { |
|
| 68 | - sql_insertq('spip_articles', $data); |
|
| 69 | - } else { |
|
| 70 | - sql_updateq('spip_articles', $data, ['id_article = -1']); |
|
| 71 | - } |
|
| 72 | - return (int) $id_document; |
|
| 73 | - } |
|
| 44 | + /** |
|
| 45 | + * Creation article de test pour doublons_notes.html |
|
| 46 | + * On cherche un document, on le met dans la note d'un texte, |
|
| 47 | + * @return int id_document |
|
| 48 | + */ |
|
| 49 | + private function creer_article_a_doublons_notes(): int { |
|
| 50 | + $id_document = sql_getfetsel( |
|
| 51 | + 'id_document', |
|
| 52 | + 'spip_documents', |
|
| 53 | + sql_in('mode', ['logoon','logooff','vignette'], 'not'), |
|
| 54 | + orderby: 'rand()', |
|
| 55 | + limit: '0,1' |
|
| 56 | + ); |
|
| 57 | + if (!$id_document) { |
|
| 58 | + $this->markTestSkipped('Il faut un document'); |
|
| 59 | + } |
|
| 60 | + $data = [ |
|
| 61 | + 'id_article' => -1, |
|
| 62 | + 'titre' => 'test pour doublons_notes.html', |
|
| 63 | + 'statut' => 'prepa', |
|
| 64 | + 'texte' => 'hello [[ xx <doc' . $id_document . '> ]].' |
|
| 65 | + ]; |
|
| 66 | + $id_article = sql_getfetsel('id_article', 'spip_articles', 'id_article = -1'); |
|
| 67 | + if ($id_article === null) { |
|
| 68 | + sql_insertq('spip_articles', $data); |
|
| 69 | + } else { |
|
| 70 | + sql_updateq('spip_articles', $data, ['id_article = -1']); |
|
| 71 | + } |
|
| 72 | + return (int) $id_document; |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -10,83 +10,83 @@ |
||
| 10 | 10 | |
| 11 | 11 | class OperatorRegexpLikeTest extends SquelettesTestCase |
| 12 | 12 | { |
| 13 | - private function getArticle(): string { |
|
| 14 | - $templating = Templating::fromString(); |
|
| 15 | - return $templating->render(<<<SPIP |
|
| 13 | + private function getArticle(): string { |
|
| 14 | + $templating = Templating::fromString(); |
|
| 15 | + return $templating->render(<<<SPIP |
|
| 16 | 16 | <BOUCLE_a(ARTICLES){titre>=A}{titre<=Z}{0,1}>#ID_ARTICLE:[(#TITRE|substr{0,1})]</BOUCLE_a> |
| 17 | 17 | NA Ce test exige un article ayant un titre qui commence par une lettre A-Z |
| 18 | 18 | <//B_a> |
| 19 | 19 | SPIP); |
| 20 | - } |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - /** @return array{id_article: int, starts_with: string} */ |
|
| 23 | - private function getArticleIdTitle(): array { |
|
| 24 | - $result = $this->getArticle(); |
|
| 25 | - [$id_article, $starts_with] = explode(':', trim($result)); |
|
| 26 | - return [ |
|
| 27 | - 'id_article' => (int) $id_article, |
|
| 28 | - 'starts_with' => $starts_with |
|
| 29 | - ]; |
|
| 30 | - } |
|
| 22 | + /** @return array{id_article: int, starts_with: string} */ |
|
| 23 | + private function getArticleIdTitle(): array { |
|
| 24 | + $result = $this->getArticle(); |
|
| 25 | + [$id_article, $starts_with] = explode(':', trim($result)); |
|
| 26 | + return [ |
|
| 27 | + 'id_article' => (int) $id_article, |
|
| 28 | + 'starts_with' => $starts_with |
|
| 29 | + ]; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - public function testHasArticle(): void { |
|
| 33 | - $result = $this->getArticle(); |
|
| 34 | - if ($this->isNa($result)) { |
|
| 35 | - $this->markTestSkipped($result); |
|
| 36 | - } |
|
| 37 | - [$id_article, $starts_with] = explode(':', trim($result)); |
|
| 38 | - $id_article = (int) $id_article; |
|
| 32 | + public function testHasArticle(): void { |
|
| 33 | + $result = $this->getArticle(); |
|
| 34 | + if ($this->isNa($result)) { |
|
| 35 | + $this->markTestSkipped($result); |
|
| 36 | + } |
|
| 37 | + [$id_article, $starts_with] = explode(':', trim($result)); |
|
| 38 | + $id_article = (int) $id_article; |
|
| 39 | 39 | |
| 40 | - $this->assertGreaterThan(0, $id_article); |
|
| 41 | - } |
|
| 40 | + $this->assertGreaterThan(0, $id_article); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - #[Depends('testHasArticle')] |
|
| 44 | - public function testLike(): void { |
|
| 45 | - $art = $this->getArticleIdTitle(); |
|
| 46 | - $contexte = [ |
|
| 47 | - 'id_article' => $art['id_article'], |
|
| 48 | - 'like' => $art['starts_with'] . '%', |
|
| 49 | - ]; |
|
| 50 | - $this->assertOkCode(<<<SPIP |
|
| 43 | + #[Depends('testHasArticle')] |
|
| 44 | + public function testLike(): void { |
|
| 45 | + $art = $this->getArticleIdTitle(); |
|
| 46 | + $contexte = [ |
|
| 47 | + 'id_article' => $art['id_article'], |
|
| 48 | + 'like' => $art['starts_with'] . '%', |
|
| 49 | + ]; |
|
| 50 | + $this->assertOkCode(<<<SPIP |
|
| 51 | 51 | <BOUCLE_b(ARTICLES){titre like #ENV{like}}{id_article}>ok</BOUCLE_b> |
| 52 | 52 | Echec de {titre like #ENV{like}} |
| 53 | 53 | <//B_b> |
| 54 | 54 | SPIP, |
| 55 | - $contexte |
|
| 56 | - ); |
|
| 57 | - $this->assertOkCode(<<<SPIP |
|
| 55 | + $contexte |
|
| 56 | + ); |
|
| 57 | + $this->assertOkCode(<<<SPIP |
|
| 58 | 58 | <BOUCLE_c(ARTICLES){titre !like #ENV{like}}{id_article}> </BOUCLE_c> |
| 59 | 59 | Echec de {titre !like #ENV{like}} |
| 60 | 60 | </B_c> |
| 61 | 61 | ok |
| 62 | 62 | <//B_c> |
| 63 | 63 | SPIP, |
| 64 | - $contexte |
|
| 65 | - ); |
|
| 66 | - } |
|
| 64 | + $contexte |
|
| 65 | + ); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - #[Depends('testHasArticle')] |
|
| 69 | - public function testRegexp(): void { |
|
| 70 | - $art = $this->getArticleIdTitle(); |
|
| 71 | - $contexte = [ |
|
| 72 | - 'id_article' => $art['id_article'], |
|
| 73 | - 'regexp' => '^' . $art['starts_with'], |
|
| 74 | - ]; |
|
| 75 | - $this->assertOkCode(<<<SPIP |
|
| 68 | + #[Depends('testHasArticle')] |
|
| 69 | + public function testRegexp(): void { |
|
| 70 | + $art = $this->getArticleIdTitle(); |
|
| 71 | + $contexte = [ |
|
| 72 | + 'id_article' => $art['id_article'], |
|
| 73 | + 'regexp' => '^' . $art['starts_with'], |
|
| 74 | + ]; |
|
| 75 | + $this->assertOkCode(<<<SPIP |
|
| 76 | 76 | <BOUCLE_b(ARTICLES){titre == #ENV{regexp}}{id_article}>ok</BOUCLE_b> |
| 77 | 77 | Echec de {titre == #ENV{regexp}} |
| 78 | 78 | <//B_b> |
| 79 | 79 | SPIP, |
| 80 | - $contexte |
|
| 81 | - ); |
|
| 82 | - $this->assertOkCode(<<<SPIP |
|
| 80 | + $contexte |
|
| 81 | + ); |
|
| 82 | + $this->assertOkCode(<<<SPIP |
|
| 83 | 83 | <BOUCLE_c(ARTICLES){titre !== #ENV{regexp}}{id_article}> </BOUCLE_c> |
| 84 | 84 | Echec de {titre !== #GET{regexp}} |
| 85 | 85 | </B_c> |
| 86 | 86 | ok |
| 87 | 87 | <//B_c> |
| 88 | 88 | SPIP, |
| 89 | - $contexte |
|
| 90 | - ); |
|
| 91 | - } |
|
| 89 | + $contexte |
|
| 90 | + ); |
|
| 91 | + } |
|
| 92 | 92 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $art = $this->getArticleIdTitle(); |
| 46 | 46 | $contexte = [ |
| 47 | 47 | 'id_article' => $art['id_article'], |
| 48 | - 'like' => $art['starts_with'] . '%', |
|
| 48 | + 'like' => $art['starts_with'].'%', |
|
| 49 | 49 | ]; |
| 50 | 50 | $this->assertOkCode(<<<SPIP |
| 51 | 51 | <BOUCLE_b(ARTICLES){titre like #ENV{like}}{id_article}>ok</BOUCLE_b> |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $art = $this->getArticleIdTitle(); |
| 71 | 71 | $contexte = [ |
| 72 | 72 | 'id_article' => $art['id_article'], |
| 73 | - 'regexp' => '^' . $art['starts_with'], |
|
| 73 | + 'regexp' => '^'.$art['starts_with'], |
|
| 74 | 74 | ]; |
| 75 | 75 | $this->assertOkCode(<<<SPIP |
| 76 | 76 | <BOUCLE_b(ARTICLES){titre == #ENV{regexp}}{id_article}>ok</BOUCLE_b> |
@@ -8,65 +8,65 @@ |
||
| 8 | 8 | |
| 9 | 9 | class IntroductionTest extends SquelettesTestCase |
| 10 | 10 | { |
| 11 | - public static function setUpBeforeClass(): void { |
|
| 12 | - include_spip('inc/filtres'); |
|
| 13 | - include_spip('public/composer'); |
|
| 14 | - } |
|
| 11 | + public static function setUpBeforeClass(): void { |
|
| 12 | + include_spip('inc/filtres'); |
|
| 13 | + include_spip('public/composer'); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - public function testPresenceFiltre(): void { |
|
| 17 | - $introduction = $this->getFilterIntroduction(); |
|
| 18 | - if ($introduction !== 'filtre_introduction_dist') { |
|
| 19 | - $this->markTestIncomplete(sprintf("Careful: filter %s is not 'filtre_introduction_dist'", $introduction)); |
|
| 20 | - } |
|
| 16 | + public function testPresenceFiltre(): void { |
|
| 17 | + $introduction = $this->getFilterIntroduction(); |
|
| 18 | + if ($introduction !== 'filtre_introduction_dist') { |
|
| 19 | + $this->markTestIncomplete(sprintf("Careful: filter %s is not 'filtre_introduction_dist'", $introduction)); |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - $this->assertEquals('<p>ok</p>', propre('ok')); |
|
| 23 | - $this->assertEquals('<p>ok</p>', $introduction('ok', '', 100, '')); |
|
| 24 | - } |
|
| 22 | + $this->assertEquals('<p>ok</p>', propre('ok')); |
|
| 23 | + $this->assertEquals('<p>ok</p>', $introduction('ok', '', 100, '')); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * la description seule ressort avec propre() sans passer par couper() or couper() enleve les balises <p> et consoeur, |
|
| 28 | - * il faut en tenir compte dans la coupe du texte, meme si le texte est plus petit |
|
| 29 | - */ |
|
| 30 | - public function testDescriptifRetourneSiPresent(): void { |
|
| 31 | - $introduction = $this->getFilterIntroduction(); |
|
| 32 | - $this->assertEquals( |
|
| 33 | - propre('description petite'), |
|
| 34 | - $introduction('description petite', 'description plus longue', 100, '') |
|
| 35 | - ); |
|
| 36 | - } |
|
| 26 | + /** |
|
| 27 | + * la description seule ressort avec propre() sans passer par couper() or couper() enleve les balises <p> et consoeur, |
|
| 28 | + * il faut en tenir compte dans la coupe du texte, meme si le texte est plus petit |
|
| 29 | + */ |
|
| 30 | + public function testDescriptifRetourneSiPresent(): void { |
|
| 31 | + $introduction = $this->getFilterIntroduction(); |
|
| 32 | + $this->assertEquals( |
|
| 33 | + propre('description petite'), |
|
| 34 | + $introduction('description petite', 'description plus longue', 100, '') |
|
| 35 | + ); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * couper en plus... |
|
| 40 | - */ |
|
| 41 | - public function testTexteNonCoupeSiPetit(): void { |
|
| 42 | - $introduction = $this->getFilterIntroduction(); |
|
| 43 | - $this->assertEquals( |
|
| 44 | - paragrapher(couper(propre('description plus longue'), 100), true), |
|
| 45 | - $introduction('', 'description plus longue', 100, '') |
|
| 46 | - ); |
|
| 47 | - } |
|
| 38 | + /** |
|
| 39 | + * couper en plus... |
|
| 40 | + */ |
|
| 41 | + public function testTexteNonCoupeSiPetit(): void { |
|
| 42 | + $introduction = $this->getFilterIntroduction(); |
|
| 43 | + $this->assertEquals( |
|
| 44 | + paragrapher(couper(propre('description plus longue'), 100), true), |
|
| 45 | + $introduction('', 'description plus longue', 100, '') |
|
| 46 | + ); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function testTexteCoupe(): void { |
|
| 50 | - $introduction = $this->getFilterIntroduction(); |
|
| 51 | - $this->assertEquals( |
|
| 52 | - paragrapher(couper(propre('description plus longue'), 10), true), |
|
| 53 | - $introduction('', 'description plus longue', 10, '') |
|
| 54 | - ); |
|
| 55 | - $this->assertNotEquals( |
|
| 56 | - paragrapher(couper(propre('description plus longue'), 20), true), |
|
| 57 | - $introduction('', 'description plus longue', 10, '') |
|
| 58 | - ); |
|
| 59 | - } |
|
| 49 | + public function testTexteCoupe(): void { |
|
| 50 | + $introduction = $this->getFilterIntroduction(); |
|
| 51 | + $this->assertEquals( |
|
| 52 | + paragrapher(couper(propre('description plus longue'), 10), true), |
|
| 53 | + $introduction('', 'description plus longue', 10, '') |
|
| 54 | + ); |
|
| 55 | + $this->assertNotEquals( |
|
| 56 | + paragrapher(couper(propre('description plus longue'), 20), true), |
|
| 57 | + $introduction('', 'description plus longue', 10, '') |
|
| 58 | + ); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function testTexteAvecBaliseIntro(): void { |
|
| 62 | - $introduction = $this->getFilterIntroduction(); |
|
| 63 | - $this->assertEquals( |
|
| 64 | - paragrapher(couper(propre('plus'), 100), true), |
|
| 65 | - $introduction('', 'description <intro>plus</intro> longue', 100, '') |
|
| 66 | - ); |
|
| 67 | - } |
|
| 61 | + public function testTexteAvecBaliseIntro(): void { |
|
| 62 | + $introduction = $this->getFilterIntroduction(); |
|
| 63 | + $this->assertEquals( |
|
| 64 | + paragrapher(couper(propre('plus'), 100), true), |
|
| 65 | + $introduction('', 'description <intro>plus</intro> longue', 100, '') |
|
| 66 | + ); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - private function getFilterIntroduction(): string { |
|
| 70 | - return chercher_filtre('introduction'); |
|
| 71 | - } |
|
| 69 | + private function getFilterIntroduction(): string { |
|
| 70 | + return chercher_filtre('introduction'); |
|
| 71 | + } |
|
| 72 | 72 | } |
@@ -8,74 +8,74 @@ |
||
| 8 | 8 | |
| 9 | 9 | class LogiquesTest extends SquelettesTestCase |
| 10 | 10 | { |
| 11 | - public function testOui(): void { |
|
| 12 | - $this->assertNotOkCode('[(#VAL|oui)ok]'); |
|
| 13 | - $this->assertOkCode('[(#VAL{1}|oui)ok]'); |
|
| 14 | - $this->assertOkCode("[(#VAL{' '}|oui)ok]"); |
|
| 15 | - } |
|
| 11 | + public function testOui(): void { |
|
| 12 | + $this->assertNotOkCode('[(#VAL|oui)ok]'); |
|
| 13 | + $this->assertOkCode('[(#VAL{1}|oui)ok]'); |
|
| 14 | + $this->assertOkCode("[(#VAL{' '}|oui)ok]"); |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - public function testYes(): void { |
|
| 18 | - $this->assertNotOkCode('[(#VAL|yes)ok]'); |
|
| 19 | - $this->assertOkCode('[(#VAL{1}|yes)ok]'); |
|
| 20 | - $this->assertOkCode("[(#VAL{' '}|yes)ok]"); |
|
| 21 | - } |
|
| 17 | + public function testYes(): void { |
|
| 18 | + $this->assertNotOkCode('[(#VAL|yes)ok]'); |
|
| 19 | + $this->assertOkCode('[(#VAL{1}|yes)ok]'); |
|
| 20 | + $this->assertOkCode("[(#VAL{' '}|yes)ok]"); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function testNon(): void { |
|
| 24 | - $this->assertOkCode('[(#VAL|non)ok]'); |
|
| 25 | - $this->assertNotOkCode('[(#VAL{1}|non)ok]'); |
|
| 26 | - $this->assertNotOkCode("[(#VAL{' '}|non)ok]"); |
|
| 27 | - } |
|
| 23 | + public function testNon(): void { |
|
| 24 | + $this->assertOkCode('[(#VAL|non)ok]'); |
|
| 25 | + $this->assertNotOkCode('[(#VAL{1}|non)ok]'); |
|
| 26 | + $this->assertNotOkCode("[(#VAL{' '}|non)ok]"); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - public function testNot(): void { |
|
| 30 | - $this->assertOkCode('[(#VAL|not)ok]'); |
|
| 31 | - $this->assertNotOkCode('[(#VAL{1}|not)ok]'); |
|
| 32 | - $this->assertNotOkCode("[(#VAL{' '}|not)ok]"); |
|
| 33 | - } |
|
| 29 | + public function testNot(): void { |
|
| 30 | + $this->assertOkCode('[(#VAL|not)ok]'); |
|
| 31 | + $this->assertNotOkCode('[(#VAL{1}|not)ok]'); |
|
| 32 | + $this->assertNotOkCode("[(#VAL{' '}|not)ok]"); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - public function testEt(): void { |
|
| 36 | - $this->assertOkCode('[(#VAL{1}|et{#VAL{1}})ok]'); |
|
| 37 | - $this->assertOkCode('[(#VAL{0}|et{#VAL{0}}|non)ok]'); |
|
| 38 | - $this->assertOkCode('[(#VAL{1}|et{#VAL{0}}|non)ok]'); |
|
| 39 | - $this->assertOkCode('[(#VAL{0}|et{#VAL{1}}|non)ok]'); |
|
| 40 | - } |
|
| 35 | + public function testEt(): void { |
|
| 36 | + $this->assertOkCode('[(#VAL{1}|et{#VAL{1}})ok]'); |
|
| 37 | + $this->assertOkCode('[(#VAL{0}|et{#VAL{0}}|non)ok]'); |
|
| 38 | + $this->assertOkCode('[(#VAL{1}|et{#VAL{0}}|non)ok]'); |
|
| 39 | + $this->assertOkCode('[(#VAL{0}|et{#VAL{1}}|non)ok]'); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function testAnd(): void { |
|
| 43 | - $this->assertOkCode('[(#VAL{1}|and{#VAL{1}})ok]'); |
|
| 44 | - $this->assertOkCode('[(#VAL{0}|and{#VAL{0}}|non)ok]'); |
|
| 45 | - $this->assertOkCode('[(#VAL{1}|and{#VAL{0}}|non)ok]'); |
|
| 46 | - $this->assertOkCode('[(#VAL{0}|and{#VAL{1}}|non)ok]'); |
|
| 47 | - } |
|
| 42 | + public function testAnd(): void { |
|
| 43 | + $this->assertOkCode('[(#VAL{1}|and{#VAL{1}})ok]'); |
|
| 44 | + $this->assertOkCode('[(#VAL{0}|and{#VAL{0}}|non)ok]'); |
|
| 45 | + $this->assertOkCode('[(#VAL{1}|and{#VAL{0}}|non)ok]'); |
|
| 46 | + $this->assertOkCode('[(#VAL{0}|and{#VAL{1}}|non)ok]'); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function testOu(): void { |
|
| 50 | - $this->assertOkCode('[(#VAL{1}|ou{#VAL{1}})ok]'); |
|
| 51 | - $this->assertOkCode('[(#VAL{0}|ou{#VAL{0}}|non)ok]'); |
|
| 52 | - $this->assertOkCode('[(#VAL{1}|ou{#VAL{0}})ok]'); |
|
| 53 | - $this->assertOkCode('[(#VAL{0}|ou{#VAL{1}})ok]'); |
|
| 54 | - } |
|
| 49 | + public function testOu(): void { |
|
| 50 | + $this->assertOkCode('[(#VAL{1}|ou{#VAL{1}})ok]'); |
|
| 51 | + $this->assertOkCode('[(#VAL{0}|ou{#VAL{0}}|non)ok]'); |
|
| 52 | + $this->assertOkCode('[(#VAL{1}|ou{#VAL{0}})ok]'); |
|
| 53 | + $this->assertOkCode('[(#VAL{0}|ou{#VAL{1}})ok]'); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - public function testOr(): void { |
|
| 57 | - $this->assertOkCode('[(#VAL{1}|or{#VAL{1}})ok]'); |
|
| 58 | - $this->assertOkCode('[(#VAL{0}|or{#VAL{0}}|non)ok]'); |
|
| 59 | - $this->assertOkCode('[(#VAL{1}|or{#VAL{0}})ok]'); |
|
| 60 | - $this->assertOkCode('[(#VAL{0}|or{#VAL{1}})ok]'); |
|
| 61 | - } |
|
| 56 | + public function testOr(): void { |
|
| 57 | + $this->assertOkCode('[(#VAL{1}|or{#VAL{1}})ok]'); |
|
| 58 | + $this->assertOkCode('[(#VAL{0}|or{#VAL{0}}|non)ok]'); |
|
| 59 | + $this->assertOkCode('[(#VAL{1}|or{#VAL{0}})ok]'); |
|
| 60 | + $this->assertOkCode('[(#VAL{0}|or{#VAL{1}})ok]'); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - public function testXou(): void { |
|
| 64 | - $this->assertOkCode('[(#VAL{1}|xou{#VAL{1}}|non)ok]'); |
|
| 65 | - $this->assertOkCode('[(#VAL{0}|xou{#VAL{0}}|non)ok]'); |
|
| 66 | - $this->assertOkCode('[(#VAL{1}|xou{#VAL{0}})ok]'); |
|
| 67 | - $this->assertOkCode('[(#VAL{0}|xou{#VAL{1}})ok]'); |
|
| 68 | - } |
|
| 63 | + public function testXou(): void { |
|
| 64 | + $this->assertOkCode('[(#VAL{1}|xou{#VAL{1}}|non)ok]'); |
|
| 65 | + $this->assertOkCode('[(#VAL{0}|xou{#VAL{0}}|non)ok]'); |
|
| 66 | + $this->assertOkCode('[(#VAL{1}|xou{#VAL{0}})ok]'); |
|
| 67 | + $this->assertOkCode('[(#VAL{0}|xou{#VAL{1}})ok]'); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - public function testXor(): void { |
|
| 71 | - $this->assertOkCode('[(#VAL{1}|xor{#VAL{1}}|non)ok]'); |
|
| 72 | - $this->assertOkCode('[(#VAL{0}|xor{#VAL{0}}|non)ok]'); |
|
| 73 | - $this->assertOkCode('[(#VAL{1}|xor{#VAL{0}})ok]'); |
|
| 74 | - $this->assertOkCode('[(#VAL{0}|xor{#VAL{1}})ok]'); |
|
| 75 | - } |
|
| 70 | + public function testXor(): void { |
|
| 71 | + $this->assertOkCode('[(#VAL{1}|xor{#VAL{1}}|non)ok]'); |
|
| 72 | + $this->assertOkCode('[(#VAL{0}|xor{#VAL{0}}|non)ok]'); |
|
| 73 | + $this->assertOkCode('[(#VAL{1}|xor{#VAL{0}})ok]'); |
|
| 74 | + $this->assertOkCode('[(#VAL{0}|xor{#VAL{1}})ok]'); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - public function testSinon(): void { |
|
| 78 | - $this->assertOkCode('[(#VAL|sinon{a}|=={a}|oui)ok]'); |
|
| 79 | - $this->assertOkCode('[(#VAL|non|sinon{a}|=={" "}|oui)ok]'); |
|
| 80 | - } |
|
| 77 | + public function testSinon(): void { |
|
| 78 | + $this->assertOkCode('[(#VAL|sinon{a}|=={a}|oui)ok]'); |
|
| 79 | + $this->assertOkCode('[(#VAL|non|sinon{a}|=={" "}|oui)ok]'); |
|
| 80 | + } |
|
| 81 | 81 | } |
@@ -9,26 +9,26 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class BaliseDynamiqueLangTest extends SquelettesTestCase |
| 11 | 11 | { |
| 12 | - public static function setUpBeforeClass(): void { |
|
| 13 | - $GLOBALS['dossier_squelettes'] = self::relativePath(__DIR__ . '/data/squelettes'); |
|
| 14 | - } |
|
| 12 | + public static function setUpBeforeClass(): void { |
|
| 13 | + $GLOBALS['dossier_squelettes'] = self::relativePath(__DIR__ . '/data/squelettes'); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Vérifie que la langue est transmise dans une balise dynamique |
|
| 18 | - * |
|
| 19 | - * - On part d’une `#LANG` (spip_lang) fixée dans le fichier _fonctions |
|
| 20 | - * - On trouve un article d’une autre langue |
|
| 21 | - * - On appelle une balise dynamique, qui vérifiera que spip_lang a été mis à jour dedans |
|
| 22 | - */ |
|
| 23 | - public function testBaliseDynamiqueLang(): void { |
|
| 24 | - $templating = Templating::fromString([ |
|
| 25 | - 'fonctions' => <<<PHP |
|
| 16 | + /** |
|
| 17 | + * Vérifie que la langue est transmise dans une balise dynamique |
|
| 18 | + * |
|
| 19 | + * - On part d’une `#LANG` (spip_lang) fixée dans le fichier _fonctions |
|
| 20 | + * - On trouve un article d’une autre langue |
|
| 21 | + * - On appelle une balise dynamique, qui vérifiera que spip_lang a été mis à jour dedans |
|
| 22 | + */ |
|
| 23 | + public function testBaliseDynamiqueLang(): void { |
|
| 24 | + $templating = Templating::fromString([ |
|
| 25 | + 'fonctions' => <<<PHP |
|
| 26 | 26 | // placer une langue globale arbitraire |
| 27 | 27 | \$GLOBALS['spip_lang'] = 'ar'; |
| 28 | 28 | PHP, |
| 29 | - ]); |
|
| 29 | + ]); |
|
| 30 | 30 | |
| 31 | - $skel = <<<SPIP |
|
| 31 | + $skel = <<<SPIP |
|
| 32 | 32 | <BOUCLE_art(ARTICLES){lang!=#LANG}{0,1}> |
| 33 | 33 | #FORMULAIRE_TEST_DYN_LANG{#LANG} |
| 34 | 34 | </BOUCLE_art> |
@@ -36,26 +36,26 @@ discard block |
||
| 36 | 36 | <//B_art> |
| 37 | 37 | SPIP; |
| 38 | 38 | |
| 39 | - $this->assertOkTemplate($templating, $skel); |
|
| 40 | - } |
|
| 39 | + $this->assertOkTemplate($templating, $skel); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Vérifie que la langue est transmise dans une balise dynamique depuis un modèle |
|
| 45 | - * |
|
| 46 | - * - On part d’une `#LANG` (spip_lang) fixée dans le fichier _fonctions |
|
| 47 | - * - On trouve un article d’une autre langue |
|
| 48 | - * - On appelle une balise dynamique via un modèle, qui vérifiera que spip_lang a été mis à jour dedans |
|
| 49 | - */ |
|
| 50 | - public function testBaliseDynamiqueLangModele(): void { |
|
| 51 | - $templating = Templating::fromString([ |
|
| 52 | - 'fonctions' => <<<PHP |
|
| 43 | + /** |
|
| 44 | + * Vérifie que la langue est transmise dans une balise dynamique depuis un modèle |
|
| 45 | + * |
|
| 46 | + * - On part d’une `#LANG` (spip_lang) fixée dans le fichier _fonctions |
|
| 47 | + * - On trouve un article d’une autre langue |
|
| 48 | + * - On appelle une balise dynamique via un modèle, qui vérifiera que spip_lang a été mis à jour dedans |
|
| 49 | + */ |
|
| 50 | + public function testBaliseDynamiqueLangModele(): void { |
|
| 51 | + $templating = Templating::fromString([ |
|
| 52 | + 'fonctions' => <<<PHP |
|
| 53 | 53 | // placer une langue globale arbitraire |
| 54 | 54 | \$GLOBALS['spip_lang'] = 'ar'; |
| 55 | 55 | PHP, |
| 56 | - ]); |
|
| 56 | + ]); |
|
| 57 | 57 | |
| 58 | - $skel = <<<SPIP |
|
| 58 | + $skel = <<<SPIP |
|
| 59 | 59 | <BOUCLE_art(ARTICLES){lang!=#LANG}{0,1}> |
| 60 | 60 | [(#VAL{'<formulaire|test_dyn_lang|t='}|concat{#LANG,'>'}|propre|interdire_scripts)] |
| 61 | 61 | </BOUCLE_art> |
@@ -64,6 +64,6 @@ discard block |
||
| 64 | 64 | #FILTRE{textebrut} |
| 65 | 65 | SPIP; |
| 66 | 66 | |
| 67 | - $this->assertOkTemplate($templating, $skel); |
|
| 68 | - } |
|
| 67 | + $this->assertOkTemplate($templating, $skel); |
|
| 68 | + } |
|
| 69 | 69 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | class BaliseDynamiqueLangTest extends SquelettesTestCase |
| 11 | 11 | { |
| 12 | 12 | public static function setUpBeforeClass(): void { |
| 13 | - $GLOBALS['dossier_squelettes'] = self::relativePath(__DIR__ . '/data/squelettes'); |
|
| 13 | + $GLOBALS['dossier_squelettes'] = self::relativePath(__DIR__.'/data/squelettes'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /** |