@@ -10,12 +10,12 @@ discard block |
||
| 10 | 10 | class FormulaireTest extends SquelettesTestCase |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Test pour `#FORMULAIRE_` |
|
| 15 | - */ |
|
| 16 | - public function testBaliseFormulaire_(): void { |
|
| 17 | - $templating = Templating::fromString([ |
|
| 18 | - 'fonctions' => <<<PHP |
|
| 13 | + /** |
|
| 14 | + * Test pour `#FORMULAIRE_` |
|
| 15 | + */ |
|
| 16 | + public function testBaliseFormulaire_(): void { |
|
| 17 | + $templating = Templating::fromString([ |
|
| 18 | + 'fonctions' => <<<PHP |
|
| 19 | 19 | function formulaire_inscription_present(\$page) { |
| 20 | 20 | if (trim(\$page) === '') { |
| 21 | 21 | return '#FORMULAIRE_{inscription} ne renvoie rien'; |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | return 'OK'; |
| 24 | 24 | } |
| 25 | 25 | PHP, |
| 26 | - ]); |
|
| 26 | + ]); |
|
| 27 | 27 | |
| 28 | - $skel = <<<SPIP |
|
| 28 | + $skel = <<<SPIP |
|
| 29 | 29 | #FORMULAIRE_{inscription,6forum,''} |
| 30 | 30 | #FILTRE{formulaire_inscription_present} |
| 31 | 31 | SPIP; |
| 32 | - $this->assertOkTemplate($templating, $skel); |
|
| 33 | - } |
|
| 32 | + $this->assertOkTemplate($templating, $skel); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | } |
@@ -9,47 +9,47 @@ |
||
| 9 | 9 | |
| 10 | 10 | class ExposeTest extends SquelettesTestCase |
| 11 | 11 | { |
| 12 | - public static function setUpBeforeClass(): void { |
|
| 13 | - include_spip('base/abstract_sql'); |
|
| 14 | - } |
|
| 15 | - |
|
| 16 | - public function testExposerRubrique(): void { |
|
| 17 | - $id_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', [ |
|
| 18 | - 'id_parent=' . sql_quote(0), |
|
| 19 | - 'statut=' . sql_quote('publie'), |
|
| 20 | - ]); |
|
| 21 | - |
|
| 22 | - $id_seconde_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', [ |
|
| 23 | - 'id_parent=' . sql_quote(0), |
|
| 24 | - 'statut=' . sql_quote('publie'), |
|
| 25 | - 'id_rubrique != ' . (int) $id_rubrique, |
|
| 26 | - ]); |
|
| 27 | - |
|
| 28 | - if (!$id_rubrique || !$id_seconde_rubrique) { |
|
| 29 | - $this->markTestSkipped('Vous devez avoir au moins 2 rubriques racines publiees pour tester #EXPOSE...'); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - $this->assertOkCode( |
|
| 33 | - "<BOUCLE_racine(RUBRIQUES){racine}> |
|
| 12 | + public static function setUpBeforeClass(): void { |
|
| 13 | + include_spip('base/abstract_sql'); |
|
| 14 | + } |
|
| 15 | + |
|
| 16 | + public function testExposerRubrique(): void { |
|
| 17 | + $id_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', [ |
|
| 18 | + 'id_parent=' . sql_quote(0), |
|
| 19 | + 'statut=' . sql_quote('publie'), |
|
| 20 | + ]); |
|
| 21 | + |
|
| 22 | + $id_seconde_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', [ |
|
| 23 | + 'id_parent=' . sql_quote(0), |
|
| 24 | + 'statut=' . sql_quote('publie'), |
|
| 25 | + 'id_rubrique != ' . (int) $id_rubrique, |
|
| 26 | + ]); |
|
| 27 | + |
|
| 28 | + if (!$id_rubrique || !$id_seconde_rubrique) { |
|
| 29 | + $this->markTestSkipped('Vous devez avoir au moins 2 rubriques racines publiees pour tester #EXPOSE...'); |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + $this->assertOkCode( |
|
| 33 | + "<BOUCLE_racine(RUBRIQUES){racine}> |
|
| 34 | 34 | [(#EXPOSE{ON,''}|oui)ok] |
| 35 | 35 | </BOUCLE_racine>", |
| 36 | - [ |
|
| 37 | - 'id_rubrique' => $id_rubrique, |
|
| 38 | - ] |
|
| 39 | - ); |
|
| 36 | + [ |
|
| 37 | + 'id_rubrique' => $id_rubrique, |
|
| 38 | + ] |
|
| 39 | + ); |
|
| 40 | 40 | |
| 41 | - $this->assertOkCode( |
|
| 42 | - "<BOUCLE_racine(RUBRIQUES){racine}{id_rubrique!=#ENV{id_rubrique}}{0,1}> |
|
| 41 | + $this->assertOkCode( |
|
| 42 | + "<BOUCLE_racine(RUBRIQUES){racine}{id_rubrique!=#ENV{id_rubrique}}{0,1}> |
|
| 43 | 43 | [(#EXPOSE{ON,''}|non)ok] |
| 44 | 44 | </BOUCLE_racine>", |
| 45 | - [ |
|
| 46 | - 'id_rubrique' => $id_rubrique, |
|
| 47 | - ] |
|
| 48 | - ); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - #[Depends('testExposerRubrique')] |
|
| 52 | - public function testExposerRubriqueInclus(): void { |
|
| 53 | - $this->assertOkSquelette(__DIR__ . '/data/balise_expose.html'); |
|
| 54 | - } |
|
| 45 | + [ |
|
| 46 | + 'id_rubrique' => $id_rubrique, |
|
| 47 | + ] |
|
| 48 | + ); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + #[Depends('testExposerRubrique')] |
|
| 52 | + public function testExposerRubriqueInclus(): void { |
|
| 53 | + $this->assertOkSquelette(__DIR__ . '/data/balise_expose.html'); |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -15,14 +15,14 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function testExposerRubrique(): void { |
| 17 | 17 | $id_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', [ |
| 18 | - 'id_parent=' . sql_quote(0), |
|
| 19 | - 'statut=' . sql_quote('publie'), |
|
| 18 | + 'id_parent='.sql_quote(0), |
|
| 19 | + 'statut='.sql_quote('publie'), |
|
| 20 | 20 | ]); |
| 21 | 21 | |
| 22 | 22 | $id_seconde_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', [ |
| 23 | - 'id_parent=' . sql_quote(0), |
|
| 24 | - 'statut=' . sql_quote('publie'), |
|
| 25 | - 'id_rubrique != ' . (int) $id_rubrique, |
|
| 23 | + 'id_parent='.sql_quote(0), |
|
| 24 | + 'statut='.sql_quote('publie'), |
|
| 25 | + 'id_rubrique != '.(int) $id_rubrique, |
|
| 26 | 26 | ]); |
| 27 | 27 | |
| 28 | 28 | if (!$id_rubrique || !$id_seconde_rubrique) { |
@@ -50,6 +50,6 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | #[Depends('testExposerRubrique')] |
| 52 | 52 | public function testExposerRubriqueInclus(): void { |
| 53 | - $this->assertOkSquelette(__DIR__ . '/data/balise_expose.html'); |
|
| 53 | + $this->assertOkSquelette(__DIR__.'/data/balise_expose.html'); |
|
| 54 | 54 | } |
| 55 | 55 | } |
@@ -9,19 +9,19 @@ discard block |
||
| 9 | 9 | class DoublonsTest extends SquelettesTestCase |
| 10 | 10 | { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Test pour la gestion de `#DOUBLONS` |
|
| 14 | - * |
|
| 15 | - * `#DOUBLONS{mots}` ou `#DOUBLONS{mots,famille}` |
|
| 16 | - * donne l'etat des doublons `(MOTS)` à cet endroit |
|
| 17 | - * sous forme de tableau d'id_mot `array(1,2,3,...)` |
|
| 18 | - * |
|
| 19 | - * `#DOUBLONS` tout seul donne la liste brute de tous les doublons |
|
| 20 | - * `#DOUBLONS*{mots}` donne la chaine brute `",1,2,3,..."` |
|
| 21 | - * (changera si la gestion des doublons evolue) |
|
| 22 | - */ |
|
| 23 | - public function testBaliseDoublons(): void { |
|
| 24 | - $skel = <<<SPIP |
|
| 12 | + /** |
|
| 13 | + * Test pour la gestion de `#DOUBLONS` |
|
| 14 | + * |
|
| 15 | + * `#DOUBLONS{mots}` ou `#DOUBLONS{mots,famille}` |
|
| 16 | + * donne l'etat des doublons `(MOTS)` à cet endroit |
|
| 17 | + * sous forme de tableau d'id_mot `array(1,2,3,...)` |
|
| 18 | + * |
|
| 19 | + * `#DOUBLONS` tout seul donne la liste brute de tous les doublons |
|
| 20 | + * `#DOUBLONS*{mots}` donne la chaine brute `",1,2,3,..."` |
|
| 21 | + * (changera si la gestion des doublons evolue) |
|
| 22 | + */ |
|
| 23 | + public function testBaliseDoublons(): void { |
|
| 24 | + $skel = <<<SPIP |
|
| 25 | 25 | #SET{d,''} |
| 26 | 26 | <BOUCLE_t(ARTICLES) />[(#TOTAL_BOUCLE|<{2}|?{NA})]<//B_t> |
| 27 | 27 | <BOUCLE_a(ARTICLES){par hasard}{0,2}{doublons test}> |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | [(#DOUBLONS*{articles,test}|=={#GET{d}}|?{'','erreur doublons*'})] |
| 36 | 36 | OK |
| 37 | 37 | SPIP; |
| 38 | - $this->assertOkCode($skel); |
|
| 39 | - } |
|
| 38 | + $this->assertOkCode($skel); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | } |
@@ -9,17 +9,17 @@ |
||
| 9 | 9 | |
| 10 | 10 | class BaliseDynamiquePhraserTest 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 | - public function testBaliseDynamiquePhraser(): void { |
|
| 17 | - $skel = <<<SPIP |
|
| 16 | + public function testBaliseDynamiquePhraser(): void { |
|
| 17 | + $skel = <<<SPIP |
|
| 18 | 18 | <BOUCLE_rub(RUBRIQUES){0,1}> |
| 19 | 19 | [<div>(#FORMULAIRE_TEST_PHRASEUR{#SELF})</div>] |
| 20 | 20 | </BOUCLE_rub> |
| 21 | 21 | #FILTRE{textebrut} |
| 22 | 22 | SPIP; |
| 23 | - $this->assertOkCode($skel); |
|
| 24 | - } |
|
| 23 | + $this->assertOkCode($skel); |
|
| 24 | + } |
|
| 25 | 25 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | class BaliseDynamiquePhraserTest 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 | public function testBaliseDynamiquePhraser(): void { |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | class FiltreTest extends SquelettesTestCase |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - public function testFiltre(): void { |
|
| 16 | - $loader = new StringLoader([ |
|
| 17 | - 'fonctions' => <<<PHP |
|
| 15 | + public function testFiltre(): void { |
|
| 16 | + $loader = new StringLoader([ |
|
| 17 | + 'fonctions' => <<<PHP |
|
| 18 | 18 | function strip_non(string \$texte): string { |
| 19 | 19 | return str_replace('NON', '', \$texte); |
| 20 | 20 | } |
@@ -23,18 +23,18 @@ discard block |
||
| 23 | 23 | return str_replace('ON', '', \$texte); |
| 24 | 24 | } |
| 25 | 25 | PHP, |
| 26 | - 'apres_code' => <<<SPIP |
|
| 26 | + 'apres_code' => <<<SPIP |
|
| 27 | 27 | [(#FILTRE{strip_non})] |
| 28 | 28 | [(#FILTRE{strip_on})] |
| 29 | 29 | SPIP, |
| 30 | - ]); |
|
| 31 | - $templating = new Templating($loader); |
|
| 32 | - $this->assertOk($templating->render('NONONOK')); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - public function testFiltreNommageExplicite(): void { |
|
| 36 | - $loader = new StringLoader([ |
|
| 37 | - 'fonctions' => <<<PHP |
|
| 30 | + ]); |
|
| 31 | + $templating = new Templating($loader); |
|
| 32 | + $this->assertOk($templating->render('NONONOK')); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + public function testFiltreNommageExplicite(): void { |
|
| 36 | + $loader = new StringLoader([ |
|
| 37 | + 'fonctions' => <<<PHP |
|
| 38 | 38 | function filtre_remove_non_dist(string \$texte): string { |
| 39 | 39 | return str_replace('NON', '', \$texte); |
| 40 | 40 | } |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | return str_replace('ON', '', \$texte); |
| 44 | 44 | } |
| 45 | 45 | PHP, |
| 46 | - 'apres_code' => <<<SPIP |
|
| 46 | + 'apres_code' => <<<SPIP |
|
| 47 | 47 | [(#FILTRE{remove_non})] |
| 48 | 48 | [(#FILTRE{remove_on})] |
| 49 | 49 | SPIP, |
| 50 | - ]); |
|
| 51 | - $templating = new Templating($loader); |
|
| 52 | - $this->assertOk($templating->render('NONONOK')); |
|
| 53 | - } |
|
| 50 | + ]); |
|
| 51 | + $templating = new Templating($loader); |
|
| 52 | + $this->assertOk($templating->render('NONONOK')); |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -12,19 +12,19 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class MimeTypeTest extends SquelettesTestCase |
| 14 | 14 | { |
| 15 | - public function testMimeTypeDocumentJpg() { |
|
| 16 | - $templating = Templating::fromString(); |
|
| 17 | - $result = $templating->render( |
|
| 18 | - "<BOUCLE_d(DOCUMENTS){extension IN jpg}{0,1}> |
|
| 15 | + public function testMimeTypeDocumentJpg() { |
|
| 16 | + $templating = Templating::fromString(); |
|
| 17 | + $result = $templating->render( |
|
| 18 | + "<BOUCLE_d(DOCUMENTS){extension IN jpg}{0,1}> |
|
| 19 | 19 | [(#MIME_TYPE|match{^image/jpeg$}|?{OK, erreur mime_type : #MIME_TYPE})] |
| 20 | 20 | </BOUCLE_d> |
| 21 | 21 | NA Ce test ne fonctionne que s'il y a au moins un document jpg dans le site ! |
| 22 | 22 | <//B_d>" |
| 23 | - ); |
|
| 24 | - if ($this->isNa($result)) { |
|
| 25 | - $this->markTestSkipped($result); |
|
| 26 | - } |
|
| 23 | + ); |
|
| 24 | + if ($this->isNa($result)) { |
|
| 25 | + $this->markTestSkipped($result); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - $this->assertOkCode($result); |
|
| 29 | - } |
|
| 28 | + $this->assertOkCode($result); |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -8,11 +8,11 @@ |
||
| 8 | 8 | |
| 9 | 9 | class ValTest extends SquelettesTestCase |
| 10 | 10 | { |
| 11 | - public function testBaliseVal(): void { |
|
| 12 | - $this->assertEmptyCode('#VAL'); |
|
| 13 | - $this->assertEmptyCode('#VAL{}'); |
|
| 14 | - $this->assertEmptyCode("#VAL{''}"); |
|
| 15 | - $this->assertOkCode('#VAL{ok}'); |
|
| 16 | - $this->assertEqualsCode('1', '#VAL{1}'); |
|
| 17 | - } |
|
| 11 | + public function testBaliseVal(): void { |
|
| 12 | + $this->assertEmptyCode('#VAL'); |
|
| 13 | + $this->assertEmptyCode('#VAL{}'); |
|
| 14 | + $this->assertEmptyCode("#VAL{''}"); |
|
| 15 | + $this->assertOkCode('#VAL{ok}'); |
|
| 16 | + $this->assertEqualsCode('1', '#VAL{1}'); |
|
| 17 | + } |
|
| 18 | 18 | } |
@@ -8,28 +8,28 @@ |
||
| 8 | 8 | |
| 9 | 9 | class SessionTest extends SquelettesTestCase |
| 10 | 10 | { |
| 11 | - public static function setUpBeforeClass(): void { |
|
| 12 | - include_spip('inc/session'); |
|
| 13 | - spip_tests_loger_webmestre(); |
|
| 14 | - } |
|
| 11 | + public static function setUpBeforeClass(): void { |
|
| 12 | + include_spip('inc/session'); |
|
| 13 | + spip_tests_loger_webmestre(); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - public static function tearDownAfterClass(): void { |
|
| 17 | - spip_tests_deloger_webmestre(); |
|
| 18 | - } |
|
| 16 | + public static function tearDownAfterClass(): void { |
|
| 17 | + spip_tests_deloger_webmestre(); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - public function testVisiteurSession(): void { |
|
| 21 | - $id_auteur = session_get('id_auteur'); |
|
| 22 | - $this->assertEqualsCode("$id_auteur", '[(#SESSION{id_auteur})]'); |
|
| 23 | - } |
|
| 20 | + public function testVisiteurSession(): void { |
|
| 21 | + $id_auteur = session_get('id_auteur'); |
|
| 22 | + $this->assertEqualsCode("$id_auteur", '[(#SESSION{id_auteur})]'); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function testSessionSet(): void { |
|
| 26 | - session_set('bonbon', null); |
|
| 27 | - $this->assertEqualsCode('1----', '1--#HTTP_HEADER{Content-type: text/html}[(#SESSION{bonbon})]--'); |
|
| 28 | - $this->assertEqualsCode('2----', '2--#HTTP_HEADER{Content-type: text/html}[(#SESSION_SET{bonbon,caramel})]--'); |
|
| 29 | - $this->assertEqualsCode('3--caramel--', '3--#HTTP_HEADER{Content-type: text/html}[(#SESSION{bonbon})]--'); |
|
| 30 | - $this->assertEqualsCode('4----', '4--#HTTP_HEADER{Content-type: text/html}[(#SESSION_SET{bonbon,miel})]--'); |
|
| 31 | - $this->assertEqualsCode('5--miel--', '5--#HTTP_HEADER{Content-type: text/html}[(#SESSION{bonbon})]--'); |
|
| 32 | - $this->assertEqualsCode('6----', '6--#HTTP_HEADER{Content-type: text/html}[(#SESSION_SET{bonbon,#NULL})]--'); |
|
| 33 | - $this->assertEqualsCode('7----', '7--#HTTP_HEADER{Content-type: text/html}[(#SESSION{bonbon})]--'); |
|
| 34 | - } |
|
| 25 | + public function testSessionSet(): void { |
|
| 26 | + session_set('bonbon', null); |
|
| 27 | + $this->assertEqualsCode('1----', '1--#HTTP_HEADER{Content-type: text/html}[(#SESSION{bonbon})]--'); |
|
| 28 | + $this->assertEqualsCode('2----', '2--#HTTP_HEADER{Content-type: text/html}[(#SESSION_SET{bonbon,caramel})]--'); |
|
| 29 | + $this->assertEqualsCode('3--caramel--', '3--#HTTP_HEADER{Content-type: text/html}[(#SESSION{bonbon})]--'); |
|
| 30 | + $this->assertEqualsCode('4----', '4--#HTTP_HEADER{Content-type: text/html}[(#SESSION_SET{bonbon,miel})]--'); |
|
| 31 | + $this->assertEqualsCode('5--miel--', '5--#HTTP_HEADER{Content-type: text/html}[(#SESSION{bonbon})]--'); |
|
| 32 | + $this->assertEqualsCode('6----', '6--#HTTP_HEADER{Content-type: text/html}[(#SESSION_SET{bonbon,#NULL})]--'); |
|
| 33 | + $this->assertEqualsCode('7----', '7--#HTTP_HEADER{Content-type: text/html}[(#SESSION{bonbon})]--'); |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -10,71 +10,71 @@ |
||
| 10 | 10 | |
| 11 | 11 | class IntroductionTest extends SquelettesTestCase |
| 12 | 12 | { |
| 13 | - public function testArticleLongExiste(): void { |
|
| 14 | - $templating = Templating::fromString(); |
|
| 15 | - $id_article = $this->getIdArticleLong(); |
|
| 16 | - $code = '<BOUCLE_a(ARTICLES){id_article}{tout}>OK</BOUCLE_a>NA<//B_a>'; |
|
| 17 | - $result = $templating->render($code, ['id_article' => $id_article]); |
|
| 18 | - if ($this->isNA($result)) { |
|
| 19 | - $this->markTestSkipped($result); |
|
| 20 | - } |
|
| 13 | + public function testArticleLongExiste(): void { |
|
| 14 | + $templating = Templating::fromString(); |
|
| 15 | + $id_article = $this->getIdArticleLong(); |
|
| 16 | + $code = '<BOUCLE_a(ARTICLES){id_article}{tout}>OK</BOUCLE_a>NA<//B_a>'; |
|
| 17 | + $result = $templating->render($code, ['id_article' => $id_article]); |
|
| 18 | + if ($this->isNA($result)) { |
|
| 19 | + $this->markTestSkipped($result); |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - $this->assertOK($result); |
|
| 23 | - } |
|
| 22 | + $this->assertOK($result); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - #[Depends('testArticleLongExiste')] |
|
| 26 | - public function testCoupeIntroduction(): void { |
|
| 27 | - $templating = Templating::fromString(); |
|
| 28 | - $id_article = $this->getIdArticleLong(); |
|
| 29 | - $code = '<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION</BOUCLE_a>'; |
|
| 30 | - $result = $templating->render($code, ['id_article' => $id_article]); |
|
| 31 | - $suite = ' (...)'; |
|
| 32 | - $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); |
|
| 33 | - } |
|
| 25 | + #[Depends('testArticleLongExiste')] |
|
| 26 | + public function testCoupeIntroduction(): void { |
|
| 27 | + $templating = Templating::fromString(); |
|
| 28 | + $id_article = $this->getIdArticleLong(); |
|
| 29 | + $code = '<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION</BOUCLE_a>'; |
|
| 30 | + $result = $templating->render($code, ['id_article' => $id_article]); |
|
| 31 | + $suite = ' (...)'; |
|
| 32 | + $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - #[Depends('testArticleLongExiste')] |
|
| 36 | - public function testCoupeIntroductionSuite(): void { |
|
| 37 | - $templating = Templating::fromString(); |
|
| 38 | - $id_article = $this->getIdArticleLong(); |
|
| 39 | - $code = '<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION{…}</BOUCLE_a>'; |
|
| 40 | - $result = $templating->render($code, ['id_article' => $id_article]); |
|
| 41 | - $suite = '…'; |
|
| 42 | - $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); |
|
| 35 | + #[Depends('testArticleLongExiste')] |
|
| 36 | + public function testCoupeIntroductionSuite(): void { |
|
| 37 | + $templating = Templating::fromString(); |
|
| 38 | + $id_article = $this->getIdArticleLong(); |
|
| 39 | + $code = '<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION{…}</BOUCLE_a>'; |
|
| 40 | + $result = $templating->render($code, ['id_article' => $id_article]); |
|
| 41 | + $suite = '…'; |
|
| 42 | + $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); |
|
| 43 | 43 | |
| 44 | - $code = '<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION{#ENV{suite}}</BOUCLE_a>'; |
|
| 45 | - $result = $templating->render($code, [ |
|
| 46 | - 'id_article' => $id_article, |
|
| 47 | - 'suite' => $suite, |
|
| 48 | - ]); |
|
| 49 | - $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); |
|
| 50 | - } |
|
| 44 | + $code = '<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION{#ENV{suite}}</BOUCLE_a>'; |
|
| 45 | + $result = $templating->render($code, [ |
|
| 46 | + 'id_article' => $id_article, |
|
| 47 | + 'suite' => $suite, |
|
| 48 | + ]); |
|
| 49 | + $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - #[Depends('testCoupeIntroduction')] |
|
| 53 | - public function testCoupeIntroductionConstante(): void { |
|
| 54 | - $id_article = $this->getIdArticleLong(); |
|
| 55 | - $templating = Templating::fromString([ |
|
| 56 | - 'fonctions' => " |
|
| 52 | + #[Depends('testCoupeIntroduction')] |
|
| 53 | + public function testCoupeIntroductionConstante(): void { |
|
| 54 | + $id_article = $this->getIdArticleLong(); |
|
| 55 | + $templating = Templating::fromString([ |
|
| 56 | + 'fonctions' => " |
|
| 57 | 57 | if (!defined('_INTRODUCTION_SUITE')) { |
| 58 | 58 | define('_INTRODUCTION_SUITE', '!!!'); |
| 59 | 59 | } |
| 60 | 60 | ", |
| 61 | - ]); |
|
| 62 | - $code = '#CACHE{0}<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION</BOUCLE_a>'; |
|
| 63 | - $result = $templating->render($code, ['id_article' => $id_article]); |
|
| 64 | - $suite = _INTRODUCTION_SUITE; |
|
| 65 | - $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); |
|
| 66 | - } |
|
| 61 | + ]); |
|
| 62 | + $code = '#CACHE{0}<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION</BOUCLE_a>'; |
|
| 63 | + $result = $templating->render($code, ['id_article' => $id_article]); |
|
| 64 | + $suite = _INTRODUCTION_SUITE; |
|
| 65 | + $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - protected function getIdArticleLong(): int { |
|
| 69 | - include_spip('base/abstract_sql'); |
|
| 70 | - $id_article = sql_getfetsel( |
|
| 71 | - 'id_article', |
|
| 72 | - 'spip_articles', |
|
| 73 | - "descriptif='' AND LENGTH(CONCAT(chapo, texte)) > 520 AND texte!='' AND LENGTH(chapo) > 100", |
|
| 74 | - '', |
|
| 75 | - 'id_article', |
|
| 76 | - '0,1' |
|
| 77 | - ); |
|
| 78 | - return intval($id_article); |
|
| 79 | - } |
|
| 68 | + protected function getIdArticleLong(): int { |
|
| 69 | + include_spip('base/abstract_sql'); |
|
| 70 | + $id_article = sql_getfetsel( |
|
| 71 | + 'id_article', |
|
| 72 | + 'spip_articles', |
|
| 73 | + "descriptif='' AND LENGTH(CONCAT(chapo, texte)) > 520 AND texte!='' AND LENGTH(chapo) > 100", |
|
| 74 | + '', |
|
| 75 | + 'id_article', |
|
| 76 | + '0,1' |
|
| 77 | + ); |
|
| 78 | + return intval($id_article); |
|
| 79 | + } |
|
| 80 | 80 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $code = '<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION</BOUCLE_a>'; |
| 30 | 30 | $result = $templating->render($code, ['id_article' => $id_article]); |
| 31 | 31 | $suite = ' (...)'; |
| 32 | - $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); |
|
| 32 | + $this->assertMatchesRegularExpression('#'.preg_quote($suite.'</p>', '#').'$#', $result); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | #[Depends('testArticleLongExiste')] |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | $code = '<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION{…}</BOUCLE_a>'; |
| 40 | 40 | $result = $templating->render($code, ['id_article' => $id_article]); |
| 41 | 41 | $suite = '…'; |
| 42 | - $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); |
|
| 42 | + $this->assertMatchesRegularExpression('#'.preg_quote($suite.'</p>', '#').'$#', $result); |
|
| 43 | 43 | |
| 44 | 44 | $code = '<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION{#ENV{suite}}</BOUCLE_a>'; |
| 45 | 45 | $result = $templating->render($code, [ |
| 46 | 46 | 'id_article' => $id_article, |
| 47 | 47 | 'suite' => $suite, |
| 48 | 48 | ]); |
| 49 | - $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); |
|
| 49 | + $this->assertMatchesRegularExpression('#'.preg_quote($suite.'</p>', '#').'$#', $result); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | #[Depends('testCoupeIntroduction')] |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $code = '#CACHE{0}<BOUCLE_a(ARTICLES){id_article}{tout}{0,1}>#INTRODUCTION</BOUCLE_a>'; |
| 63 | 63 | $result = $templating->render($code, ['id_article' => $id_article]); |
| 64 | 64 | $suite = _INTRODUCTION_SUITE; |
| 65 | - $this->assertMatchesRegularExpression('#' . preg_quote($suite . '</p>', '#') . '$#', $result); |
|
| 65 | + $this->assertMatchesRegularExpression('#'.preg_quote($suite.'</p>', '#').'$#', $result); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | protected function getIdArticleLong(): int { |