@@ -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 | /** |
@@ -8,18 +8,18 @@ |
||
| 8 | 8 | |
| 9 | 9 | class ConstTest extends SquelettesTestCase |
| 10 | 10 | { |
| 11 | - public function testBaliseConstVide(): void { |
|
| 12 | - $this->assertEmptyCode('#CONST'); |
|
| 13 | - $this->assertEmptyCode("#CONST{''}"); |
|
| 14 | - } |
|
| 11 | + public function testBaliseConstVide(): void { |
|
| 12 | + $this->assertEmptyCode('#CONST'); |
|
| 13 | + $this->assertEmptyCode("#CONST{''}"); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - public function testBaliseConstInconnue(): void { |
|
| 17 | - $this->assertEmptyCode("#CONST{'une_constante_inconnue'}"); |
|
| 18 | - } |
|
| 16 | + public function testBaliseConstInconnue(): void { |
|
| 17 | + $this->assertEmptyCode("#CONST{'une_constante_inconnue'}"); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - public function testBaliseConstExistante(): void { |
|
| 21 | - $this->assertEqualsCode(_DIR_CACHE, "#CONST{'_DIR_CACHE'}"); |
|
| 22 | - $this->assertEqualsCode(_DIR_CACHE, '#CONST{_DIR_CACHE}'); |
|
| 23 | - $this->assertEqualsCode(_DIR_CACHE, '#SET{c,_DIR_CACHE}#CONST{#GET{c}}'); |
|
| 24 | - } |
|
| 20 | + public function testBaliseConstExistante(): void { |
|
| 21 | + $this->assertEqualsCode(_DIR_CACHE, "#CONST{'_DIR_CACHE'}"); |
|
| 22 | + $this->assertEqualsCode(_DIR_CACHE, '#CONST{_DIR_CACHE}'); |
|
| 23 | + $this->assertEqualsCode(_DIR_CACHE, '#SET{c,_DIR_CACHE}#CONST{#GET{c}}'); |
|
| 24 | + } |
|
| 25 | 25 | } |
@@ -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 { |