@@ -8,8 +8,8 @@ |
||
| 8 | 8 | |
| 9 | 9 | class SelfTest extends SquelettesTestCase |
| 10 | 10 | { |
| 11 | - public function testBaliseSelf(): never { |
|
| 12 | - $this->assertEqualsCode('./', '#SELF'); |
|
| 13 | - $this->markTestIncomplete('More tests needed, but requires SPIP evolution with RequestInterface or so'); |
|
| 14 | - } |
|
| 11 | + public function testBaliseSelf(): never { |
|
| 12 | + $this->assertEqualsCode('./', '#SELF'); |
|
| 13 | + $this->markTestIncomplete('More tests needed, but requires SPIP evolution with RequestInterface or so'); |
|
| 14 | + } |
|
| 15 | 15 | } |
@@ -9,19 +9,19 @@ |
||
| 9 | 9 | |
| 10 | 10 | class LesauteursTest extends SquelettesTestCase |
| 11 | 11 | { |
| 12 | - public function testLesAuteursRenvoieQqc(): void { |
|
| 13 | - $templating = Templating::fromString(); |
|
| 14 | - $result = $templating->render( |
|
| 15 | - "<BOUCLE_a(ARTICLES){id_auteur>0}{0,1}> |
|
| 12 | + public function testLesAuteursRenvoieQqc(): void { |
|
| 13 | + $templating = Templating::fromString(); |
|
| 14 | + $result = $templating->render( |
|
| 15 | + "<BOUCLE_a(ARTICLES){id_auteur>0}{0,1}> |
|
| 16 | 16 | [(#LESAUTEURS|?{OK,'LESAUTEURS a echoue'})] |
| 17 | 17 | </BOUCLE_a> |
| 18 | 18 | NA Ce test ne fonctionne que s'il existe un article ayant un auteur ! |
| 19 | 19 | <//B_a>" |
| 20 | - ); |
|
| 21 | - if ($this->isNa($result)) { |
|
| 22 | - $this->markTestSkipped($result); |
|
| 23 | - } |
|
| 20 | + ); |
|
| 21 | + if ($this->isNa($result)) { |
|
| 22 | + $this->markTestSkipped($result); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - $this->assertOk($result); |
|
| 26 | - } |
|
| 25 | + $this->assertOk($result); |
|
| 26 | + } |
|
| 27 | 27 | } |
@@ -9,65 +9,65 @@ |
||
| 9 | 9 | |
| 10 | 10 | class InclureStatiqueTest extends SquelettesTestCase |
| 11 | 11 | { |
| 12 | - public function testInclureInlineNormal(): void { |
|
| 13 | - $dir = $this->relativePath(__DIR__); |
|
| 14 | - $this->assertEqualsCode('Hello World', '#INCLURE{fond=' . $dir . '/data/texte_hello_world}'); |
|
| 15 | - $this->assertEqualsCode('Hello World', '[(#INCLURE{fond=' . $dir . '/data/texte_hello_world})]'); |
|
| 16 | - } |
|
| 12 | + public function testInclureInlineNormal(): void { |
|
| 13 | + $dir = $this->relativePath(__DIR__); |
|
| 14 | + $this->assertEqualsCode('Hello World', '#INCLURE{fond=' . $dir . '/data/texte_hello_world}'); |
|
| 15 | + $this->assertEqualsCode('Hello World', '[(#INCLURE{fond=' . $dir . '/data/texte_hello_world})]'); |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function testInclureDouble(): void { |
|
| 19 | - $dir = $this->relativePath(__DIR__); |
|
| 20 | - $this->assertEqualsCode( |
|
| 21 | - 'Hello WorldHello World', |
|
| 22 | - '#INCLURE{fond=' . $dir . '/data/texte_hello_world}' |
|
| 23 | - . '#INCLURE{fond=' . $dir . '/data/texte_hello_world}' |
|
| 24 | - ); |
|
| 25 | - $this->assertEqualsCode( |
|
| 26 | - 'Hello WorldHello World', |
|
| 27 | - ' |
|
| 18 | + public function testInclureDouble(): void { |
|
| 19 | + $dir = $this->relativePath(__DIR__); |
|
| 20 | + $this->assertEqualsCode( |
|
| 21 | + 'Hello WorldHello World', |
|
| 22 | + '#INCLURE{fond=' . $dir . '/data/texte_hello_world}' |
|
| 23 | + . '#INCLURE{fond=' . $dir . '/data/texte_hello_world}' |
|
| 24 | + ); |
|
| 25 | + $this->assertEqualsCode( |
|
| 26 | + 'Hello WorldHello World', |
|
| 27 | + ' |
|
| 28 | 28 | #INCLURE{fond=' . $dir . '/data/texte_hello_world}' |
| 29 | - . '#INCLURE{fond=' . $dir . '/data/texte_hello_world}' |
|
| 30 | - ); |
|
| 31 | - } |
|
| 29 | + . '#INCLURE{fond=' . $dir . '/data/texte_hello_world}' |
|
| 30 | + ); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - public function testInclureArray(): void { |
|
| 34 | - $dir = $this->relativePath(__DIR__); |
|
| 35 | - $array = '#LISTE{ |
|
| 33 | + public function testInclureArray(): void { |
|
| 34 | + $dir = $this->relativePath(__DIR__); |
|
| 35 | + $array = '#LISTE{ |
|
| 36 | 36 | ' . $dir . '/data/texte_hello_world, |
| 37 | 37 | ' . $dir . '/data/texte_hello_world, |
| 38 | 38 | ' . $dir . '/data/texte_hello_world}'; |
| 39 | - $this->assertEqualsCode('Hello WorldHello WorldHello World', "#INCLURE{fond={$array}}"); |
|
| 40 | - } |
|
| 39 | + $this->assertEqualsCode('Hello WorldHello WorldHello World', "#INCLURE{fond={$array}}"); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function testInclureOldParam(): void { |
|
| 43 | - $dir = $this->relativePath(__DIR__); |
|
| 44 | - $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test}{test=Kitty})]'); |
|
| 45 | - $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test}{test=Kitty})]'); |
|
| 46 | - } |
|
| 42 | + public function testInclureOldParam(): void { |
|
| 43 | + $dir = $this->relativePath(__DIR__); |
|
| 44 | + $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test}{test=Kitty})]'); |
|
| 45 | + $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test}{test=Kitty})]'); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - public function testInclureNormalParam(): void { |
|
| 49 | - $dir = $this->relativePath(__DIR__); |
|
| 50 | - $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test, test=Kitty})]'); |
|
| 51 | - $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test, test=Kitty})]'); |
|
| 52 | - } |
|
| 48 | + public function testInclureNormalParam(): void { |
|
| 49 | + $dir = $this->relativePath(__DIR__); |
|
| 50 | + $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test, test=Kitty})]'); |
|
| 51 | + $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test, test=Kitty})]'); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - public function testInclureArrayParam(): void { |
|
| 55 | - $dir = $this->relativePath(__DIR__); |
|
| 56 | - $array = '#LISTE{ |
|
| 54 | + public function testInclureArrayParam(): void { |
|
| 55 | + $dir = $this->relativePath(__DIR__); |
|
| 56 | + $array = '#LISTE{ |
|
| 57 | 57 | ' . $dir . '/data/balise_env_test, |
| 58 | 58 | ' . $dir . '/data/texte_hello_world, |
| 59 | 59 | ' . $dir . '/data/balise_env_test}'; |
| 60 | - $this->assertEqualsCode('KittyHello WorldKitty', "[(#INCLURE{fond={$array}, test=Kitty})]"); |
|
| 61 | - $this->assertEqualsCode('KittyHello WorldKitty', "[(#INCLURE{fond={$array}, test=Kitty})]"); |
|
| 62 | - } |
|
| 60 | + $this->assertEqualsCode('KittyHello WorldKitty', "[(#INCLURE{fond={$array}, test=Kitty})]"); |
|
| 61 | + $this->assertEqualsCode('KittyHello WorldKitty', "[(#INCLURE{fond={$array}, test=Kitty})]"); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Un inclure manquant doit creer une erreur de compilation pour SPIP qui ne doivent pas s'afficher dans le public si |
|
| 66 | - * visiteur |
|
| 67 | - */ |
|
| 68 | - public function testInclureManquantGenereErreurCompilation(): void { |
|
| 69 | - $templating = Templating::fromString(); |
|
| 70 | - $infos = $templating->rawRender('#CACHE{0}[(#INCLURE{fond=carabistouille/de/montignac/absente}|non)ok]'); |
|
| 71 | - $this->assertCount(1, $infos['erreurs']); |
|
| 72 | - } |
|
| 64 | + /** |
|
| 65 | + * Un inclure manquant doit creer une erreur de compilation pour SPIP qui ne doivent pas s'afficher dans le public si |
|
| 66 | + * visiteur |
|
| 67 | + */ |
|
| 68 | + public function testInclureManquantGenereErreurCompilation(): void { |
|
| 69 | + $templating = Templating::fromString(); |
|
| 70 | + $infos = $templating->rawRender('#CACHE{0}[(#INCLURE{fond=carabistouille/de/montignac/absente}|non)ok]'); |
|
| 71 | + $this->assertCount(1, $infos['erreurs']); |
|
| 72 | + } |
|
| 73 | 73 | } |
@@ -11,52 +11,52 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function testInclureInlineNormal(): void { |
| 13 | 13 | $dir = $this->relativePath(__DIR__); |
| 14 | - $this->assertEqualsCode('Hello World', '#INCLURE{fond=' . $dir . '/data/texte_hello_world}'); |
|
| 15 | - $this->assertEqualsCode('Hello World', '[(#INCLURE{fond=' . $dir . '/data/texte_hello_world})]'); |
|
| 14 | + $this->assertEqualsCode('Hello World', '#INCLURE{fond='.$dir.'/data/texte_hello_world}'); |
|
| 15 | + $this->assertEqualsCode('Hello World', '[(#INCLURE{fond='.$dir.'/data/texte_hello_world})]'); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function testInclureDouble(): void { |
| 19 | 19 | $dir = $this->relativePath(__DIR__); |
| 20 | 20 | $this->assertEqualsCode( |
| 21 | 21 | 'Hello WorldHello World', |
| 22 | - '#INCLURE{fond=' . $dir . '/data/texte_hello_world}' |
|
| 23 | - . '#INCLURE{fond=' . $dir . '/data/texte_hello_world}' |
|
| 22 | + '#INCLURE{fond='.$dir.'/data/texte_hello_world}' |
|
| 23 | + . '#INCLURE{fond='.$dir.'/data/texte_hello_world}' |
|
| 24 | 24 | ); |
| 25 | 25 | $this->assertEqualsCode( |
| 26 | 26 | 'Hello WorldHello World', |
| 27 | 27 | ' |
| 28 | - #INCLURE{fond=' . $dir . '/data/texte_hello_world}' |
|
| 29 | - . '#INCLURE{fond=' . $dir . '/data/texte_hello_world}' |
|
| 28 | + #INCLURE{fond=' . $dir.'/data/texte_hello_world}' |
|
| 29 | + . '#INCLURE{fond='.$dir.'/data/texte_hello_world}' |
|
| 30 | 30 | ); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function testInclureArray(): void { |
| 34 | 34 | $dir = $this->relativePath(__DIR__); |
| 35 | 35 | $array = '#LISTE{ |
| 36 | - ' . $dir . '/data/texte_hello_world, |
|
| 37 | - ' . $dir . '/data/texte_hello_world, |
|
| 38 | - ' . $dir . '/data/texte_hello_world}'; |
|
| 36 | + ' . $dir.'/data/texte_hello_world, |
|
| 37 | + ' . $dir.'/data/texte_hello_world, |
|
| 38 | + ' . $dir.'/data/texte_hello_world}'; |
|
| 39 | 39 | $this->assertEqualsCode('Hello WorldHello WorldHello World', "#INCLURE{fond={$array}}"); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function testInclureOldParam(): void { |
| 43 | 43 | $dir = $this->relativePath(__DIR__); |
| 44 | - $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test}{test=Kitty})]'); |
|
| 45 | - $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test}{test=Kitty})]'); |
|
| 44 | + $this->assertEqualsCode('Kitty', '[(#INCLURE{fond='.$dir.'/data/balise_env_test}{test=Kitty})]'); |
|
| 45 | + $this->assertEqualsCode('Kitty', '[(#INCLURE{fond='.$dir.'/data/balise_env_test}{test=Kitty})]'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function testInclureNormalParam(): void { |
| 49 | 49 | $dir = $this->relativePath(__DIR__); |
| 50 | - $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test, test=Kitty})]'); |
|
| 51 | - $this->assertEqualsCode('Kitty', '[(#INCLURE{fond=' . $dir . '/data/balise_env_test, test=Kitty})]'); |
|
| 50 | + $this->assertEqualsCode('Kitty', '[(#INCLURE{fond='.$dir.'/data/balise_env_test, test=Kitty})]'); |
|
| 51 | + $this->assertEqualsCode('Kitty', '[(#INCLURE{fond='.$dir.'/data/balise_env_test, test=Kitty})]'); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function testInclureArrayParam(): void { |
| 55 | 55 | $dir = $this->relativePath(__DIR__); |
| 56 | 56 | $array = '#LISTE{ |
| 57 | - ' . $dir . '/data/balise_env_test, |
|
| 58 | - ' . $dir . '/data/texte_hello_world, |
|
| 59 | - ' . $dir . '/data/balise_env_test}'; |
|
| 57 | + ' . $dir.'/data/balise_env_test, |
|
| 58 | + ' . $dir.'/data/texte_hello_world, |
|
| 59 | + ' . $dir.'/data/balise_env_test}'; |
|
| 60 | 60 | $this->assertEqualsCode('KittyHello WorldKitty', "[(#INCLURE{fond={$array}, test=Kitty})]"); |
| 61 | 61 | $this->assertEqualsCode('KittyHello WorldKitty', "[(#INCLURE{fond={$array}, test=Kitty})]"); |
| 62 | 62 | } |
@@ -8,11 +8,11 @@ |
||
| 8 | 8 | |
| 9 | 9 | class EvalTest extends SquelettesTestCase |
| 10 | 10 | { |
| 11 | - public function testBaliseEval(): void { |
|
| 12 | - $this->assertEmptyCode("#EVAL{''}"); |
|
| 13 | - $this->assertOkCode('#EVAL{"\'ok\'"}'); |
|
| 14 | - $this->assertEqualsCode('1', '#EVAL{1}'); |
|
| 15 | - $this->assertEqualsCode(_DIR_CACHE, '#EVAL{_DIR_CACHE}'); |
|
| 16 | - $this->assertEqualsCode('20', '#EVAL{3*5+5}'); |
|
| 17 | - } |
|
| 11 | + public function testBaliseEval(): void { |
|
| 12 | + $this->assertEmptyCode("#EVAL{''}"); |
|
| 13 | + $this->assertOkCode('#EVAL{"\'ok\'"}'); |
|
| 14 | + $this->assertEqualsCode('1', '#EVAL{1}'); |
|
| 15 | + $this->assertEqualsCode(_DIR_CACHE, '#EVAL{_DIR_CACHE}'); |
|
| 16 | + $this->assertEqualsCode('20', '#EVAL{3*5+5}'); |
|
| 17 | + } |
|
| 18 | 18 | } |
@@ -9,65 +9,65 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class BaliseGeneriqueTest extends SquelettesTestCase |
| 11 | 11 | { |
| 12 | - public function testBaliseInexistante(): void { |
|
| 13 | - $this->assertEmptyCode('#JENEXISTEPAS'); |
|
| 14 | - $this->assertEmptyCode('[(#JENEXISTEPAS)]'); |
|
| 15 | - $this->assertEmptyCode('[avant(#JENEXISTEPAS)apres]'); |
|
| 12 | + public function testBaliseInexistante(): void { |
|
| 13 | + $this->assertEmptyCode('#JENEXISTEPAS'); |
|
| 14 | + $this->assertEmptyCode('[(#JENEXISTEPAS)]'); |
|
| 15 | + $this->assertEmptyCode('[avant(#JENEXISTEPAS)apres]'); |
|
| 16 | 16 | |
| 17 | - // ceux-ci sont plus etonnant mais c'est ce qui se passe effectivement |
|
| 18 | - $this->assertEqualsCode('{rien}', '#JENEXISTEPAS{rien}'); |
|
| 19 | - $this->assertEqualsCode('{rien}', '[(#JENEXISTEPAS{rien})]'); |
|
| 20 | - $this->assertEqualsCode('avant{rien}apres', '[avant(#JENEXISTEPAS{rien})apres]'); |
|
| 21 | - } |
|
| 17 | + // ceux-ci sont plus etonnant mais c'est ce qui se passe effectivement |
|
| 18 | + $this->assertEqualsCode('{rien}', '#JENEXISTEPAS{rien}'); |
|
| 19 | + $this->assertEqualsCode('{rien}', '[(#JENEXISTEPAS{rien})]'); |
|
| 20 | + $this->assertEqualsCode('avant{rien}apres', '[avant(#JENEXISTEPAS{rien})apres]'); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function testBaliseDeclaree(): void { |
|
| 24 | - $templating = Templating::fromString([ |
|
| 25 | - 'fonctions' => ' |
|
| 23 | + public function testBaliseDeclaree(): void { |
|
| 24 | + $templating = Templating::fromString([ |
|
| 25 | + 'fonctions' => ' |
|
| 26 | 26 | function balise_JEXISTE_dist($p){ |
| 27 | 27 | $p->code = "\'ok\'"; |
| 28 | 28 | return $p; |
| 29 | 29 | } |
| 30 | 30 | ', |
| 31 | - ]); |
|
| 32 | - $this->assertOkTemplate($templating, '#JEXISTE'); |
|
| 33 | - $this->assertOkTemplate($templating, '[(#JEXISTE)]'); |
|
| 34 | - } |
|
| 31 | + ]); |
|
| 32 | + $this->assertOkTemplate($templating, '#JEXISTE'); |
|
| 33 | + $this->assertOkTemplate($templating, '[(#JEXISTE)]'); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - public function testBaliseDeclareeAvantApres(): void { |
|
| 37 | - $templating = Templating::fromString([ |
|
| 38 | - 'fonctions' => ' |
|
| 36 | + public function testBaliseDeclareeAvantApres(): void { |
|
| 37 | + $templating = Templating::fromString([ |
|
| 38 | + 'fonctions' => ' |
|
| 39 | 39 | function balise_JEXISTE_dist($p){ |
| 40 | 40 | $p->code = "\'ok\'"; |
| 41 | 41 | return $p; |
| 42 | 42 | } |
| 43 | 43 | ', |
| 44 | - ]); |
|
| 44 | + ]); |
|
| 45 | 45 | |
| 46 | - $this->assertEqualsTemplate('avantokapres', $templating, '[avant(#JEXISTE)apres]'); |
|
| 47 | - $this->assertEqualsTemplate('avant apres', $templating, '[avant(#JEXISTE|oui)apres]'); |
|
| 48 | - $this->assertEqualsTemplate('', $templating, '[avant(#JEXISTE|non)apres]'); |
|
| 49 | - } |
|
| 46 | + $this->assertEqualsTemplate('avantokapres', $templating, '[avant(#JEXISTE)apres]'); |
|
| 47 | + $this->assertEqualsTemplate('avant apres', $templating, '[avant(#JEXISTE|oui)apres]'); |
|
| 48 | + $this->assertEqualsTemplate('', $templating, '[avant(#JEXISTE|non)apres]'); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - public function testBaliseDeclareeEtParams(): void { |
|
| 52 | - $templating = Templating::fromString([ |
|
| 53 | - 'fonctions' => ' |
|
| 51 | + public function testBaliseDeclareeEtParams(): void { |
|
| 52 | + $templating = Templating::fromString([ |
|
| 53 | + 'fonctions' => ' |
|
| 54 | 54 | function balise_JEXISTE_dist($p){ |
| 55 | 55 | $p->code = "\'ok\'"; |
| 56 | 56 | return $p; |
| 57 | 57 | } |
| 58 | 58 | ', |
| 59 | - ]); |
|
| 59 | + ]); |
|
| 60 | 60 | |
| 61 | - $this->assertOkTemplate($templating, '#JEXISTE{param}'); |
|
| 62 | - $this->assertOkTemplate($templating, '#JEXISTE{param,param}'); |
|
| 63 | - $this->assertOkTemplate($templating, '#JEXISTE{#SELF,#SQUELETTE}'); |
|
| 64 | - $this->assertOkTemplate($templating, '#JEXISTE{#VAL{#SELF}}'); |
|
| 65 | - $this->assertOkTemplate($templating, '[(#JEXISTE{[(#VAL{[(#SELF)]})]})]'); |
|
| 66 | - } |
|
| 61 | + $this->assertOkTemplate($templating, '#JEXISTE{param}'); |
|
| 62 | + $this->assertOkTemplate($templating, '#JEXISTE{param,param}'); |
|
| 63 | + $this->assertOkTemplate($templating, '#JEXISTE{#SELF,#SQUELETTE}'); |
|
| 64 | + $this->assertOkTemplate($templating, '#JEXISTE{#VAL{#SELF}}'); |
|
| 65 | + $this->assertOkTemplate($templating, '[(#JEXISTE{[(#VAL{[(#SELF)]})]})]'); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - public function testBaliseDeclareeEtParamsUtiles(): void { |
|
| 69 | - $templating = Templating::fromString([ |
|
| 70 | - 'fonctions' => ' |
|
| 68 | + public function testBaliseDeclareeEtParamsUtiles(): void { |
|
| 69 | + $templating = Templating::fromString([ |
|
| 70 | + 'fonctions' => ' |
|
| 71 | 71 | function balise_ZEXISTE_dist($p){ |
| 72 | 72 | if (!$p1 = interprete_argument_balise(1,$p)) |
| 73 | 73 | $p1 = "\'\'"; |
@@ -78,17 +78,17 @@ discard block |
||
| 78 | 78 | return $p1; |
| 79 | 79 | } |
| 80 | 80 | ', |
| 81 | - ]); |
|
| 82 | - $this->assertEmptyTemplate($templating, '#ZEXISTE'); |
|
| 83 | - $this->assertOkTemplate($templating, '#ZEXISTE{ok}'); |
|
| 84 | - $this->assertEqualsTemplate('avantokapres', $templating, '[avant(#ZEXISTE{ok})apres]'); |
|
| 85 | - $this->assertEqualsTemplate('avant apres', $templating, '[avant(#ZEXISTE{ok}|oui)apres]'); |
|
| 86 | - $this->assertEmptyTemplate($templating, '[avant(#ZEXISTE{ok}|non)apres]'); |
|
| 87 | - } |
|
| 81 | + ]); |
|
| 82 | + $this->assertEmptyTemplate($templating, '#ZEXISTE'); |
|
| 83 | + $this->assertOkTemplate($templating, '#ZEXISTE{ok}'); |
|
| 84 | + $this->assertEqualsTemplate('avantokapres', $templating, '[avant(#ZEXISTE{ok})apres]'); |
|
| 85 | + $this->assertEqualsTemplate('avant apres', $templating, '[avant(#ZEXISTE{ok}|oui)apres]'); |
|
| 86 | + $this->assertEmptyTemplate($templating, '[avant(#ZEXISTE{ok}|non)apres]'); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - public function testBaliseSurchargee(): void { |
|
| 90 | - $templating = Templating::fromString([ |
|
| 91 | - 'fonctions' => ' |
|
| 89 | + public function testBaliseSurchargee(): void { |
|
| 90 | + $templating = Templating::fromString([ |
|
| 91 | + 'fonctions' => ' |
|
| 92 | 92 | function balise_REXISTE_dist($p){ |
| 93 | 93 | $p->code = "\'oups\'"; |
| 94 | 94 | return $p; |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | return $p1; |
| 105 | 105 | } |
| 106 | 106 | ', |
| 107 | - ]); |
|
| 107 | + ]); |
|
| 108 | 108 | |
| 109 | - $this->assertEmptyTemplate($templating, '#REXISTE'); |
|
| 110 | - $this->assertOkTemplate($templating, '#REXISTE{ok}'); |
|
| 111 | - } |
|
| 109 | + $this->assertEmptyTemplate($templating, '#REXISTE'); |
|
| 110 | + $this->assertOkTemplate($templating, '#REXISTE{ok}'); |
|
| 111 | + } |
|
| 112 | 112 | } |
@@ -10,10 +10,10 @@ |
||
| 10 | 10 | |
| 11 | 11 | class DossierSqueletteTest extends SquelettesTestCase |
| 12 | 12 | { |
| 13 | - public function testBaliseDossierSquelette(): void { |
|
| 14 | - $loader = new StringLoader(); |
|
| 15 | - $templating = new Templating($loader); |
|
| 16 | - $expected = dirname($loader->getSourceFile('#DOSSIER_SQUELETTE')); |
|
| 17 | - $this->assertEqualsTemplate($expected, $templating, "#DOSSIER_SQUELETTE"); |
|
| 18 | - } |
|
| 13 | + public function testBaliseDossierSquelette(): void { |
|
| 14 | + $loader = new StringLoader(); |
|
| 15 | + $templating = new Templating($loader); |
|
| 16 | + $expected = dirname($loader->getSourceFile('#DOSSIER_SQUELETTE')); |
|
| 17 | + $this->assertEqualsTemplate($expected, $templating, "#DOSSIER_SQUELETTE"); |
|
| 18 | + } |
|
| 19 | 19 | } |
@@ -9,182 +9,182 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class ConfigTest extends SquelettesTestCase |
| 11 | 11 | { |
| 12 | - public function testConfigNomAbsent(): void { |
|
| 13 | - $templating = $this->getTemplating(); |
|
| 14 | - $this->assertOkTemplate($templating, '[(#CONFIG{pasla}|non)ok]'); |
|
| 15 | - } |
|
| 16 | - |
|
| 17 | - public function testConfigNomAbsentAvecDefaut(): void { |
|
| 18 | - $templating = $this->getTemplating(); |
|
| 19 | - $this->assertOkTemplate($templating, '[(#CONFIG{pasla,defaut}|=={defaut}|oui)ok]'); |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - public function testConfigChaine(): void { |
|
| 23 | - $templating = $this->getTemplating(); |
|
| 24 | - $this->assertOkTemplate($templating, '[(#CONFIG{chaine}|=={une chaine}|oui)ok]'); |
|
| 25 | - $this->assertOkTemplate($templating, '[(#CONFIG{chaine,defaut}|=={une chaine}|oui)ok]'); |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - public function testConfigValeurZero(): void { |
|
| 29 | - $templating = $this->getTemplating(); |
|
| 30 | - $this->assertOkTemplate($templating, '[(#CONFIG{zero}|=={0}|oui)ok]'); |
|
| 31 | - $this->assertOkTemplate($templating, '[(#CONFIG{zero,defaut}|=={0}|oui)ok]'); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - public function testConfigChaineZero(): void { |
|
| 35 | - $templating = $this->getTemplating(); |
|
| 36 | - $this->assertOkTemplate($templating, "[(#CONFIG{zeroc}|=={'0'}|oui)ok]"); |
|
| 37 | - $this->assertOkTemplate($templating, "[(#CONFIG{zeroc,defaut}|=={'0'}|oui)ok]"); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - public function testArrayAssoc(): void { |
|
| 41 | - $templating = $this->getTemplating(); |
|
| 42 | - $this->assertOkTemplate($templating, "[(#CONFIG{assoc,'',''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]"); |
|
| 43 | - $this->assertOkTemplate($templating, "[(#CONFIG{assoc,defaut,''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]"); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - public function testArraySerialize(): void { |
|
| 47 | - $templating = $this->getTemplating(); |
|
| 48 | - $this->assertOkTemplate( |
|
| 49 | - $templating, |
|
| 50 | - '[(#CONFIG{serie}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' |
|
| 51 | - ); |
|
| 52 | - $this->assertOkTemplate( |
|
| 53 | - $templating, |
|
| 54 | - '[(#CONFIG{serie,defaut}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' |
|
| 55 | - ); |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - public function testMetaConfigNomAbsent(): void { |
|
| 59 | - $templating = $this->getTemplating(); |
|
| 60 | - $this->assertOkTemplate($templating, '[(#CONFIG{/meta/pasla}|non)ok]'); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - public function testMetaConfigNomAbsentAvecDefaut(): void { |
|
| 64 | - $templating = $this->getTemplating(); |
|
| 65 | - $this->assertOkTemplate($templating, '[(#CONFIG{/meta/pasla,defaut}|=={defaut}|oui)ok]'); |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - public function testMetaConfigChaine(): void { |
|
| 69 | - $templating = $this->getTemplating(); |
|
| 70 | - $this->assertOkTemplate($templating, '[(#CONFIG{/meta/chaine}|=={une chaine}|oui)ok]'); |
|
| 71 | - $this->assertOkTemplate($templating, '[(#CONFIG{/meta/chaine,defaut}|=={une chaine}|oui)ok]'); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - public function testMetaConfigValeurZero(): void { |
|
| 75 | - $templating = $this->getTemplating(); |
|
| 76 | - $this->assertOkTemplate($templating, '[(#CONFIG{/meta/zero}|=={0}|oui)ok]'); |
|
| 77 | - $this->assertOkTemplate($templating, '[(#CONFIG{/meta/zero,defaut}|=={0}|oui)ok]'); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - public function testMetaConfigChaineZero(): void { |
|
| 81 | - $templating = $this->getTemplating(); |
|
| 82 | - $this->assertOkTemplate($templating, "[(#CONFIG{/meta/zeroc}|=={'0'}|oui)ok]"); |
|
| 83 | - $this->assertOkTemplate($templating, "[(#CONFIG{/meta/zeroc,defaut}|=={'0'}|oui)ok]"); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - public function testMetaArrayAssoc(): void { |
|
| 87 | - $templating = $this->getTemplating(); |
|
| 88 | - $this->assertOkTemplate($templating, "[(#CONFIG{/meta/assoc,'',''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]"); |
|
| 89 | - $this->assertOkTemplate( |
|
| 90 | - $templating, |
|
| 91 | - "[(#CONFIG{/meta/assoc,defaut,''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]" |
|
| 92 | - ); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - public function testMetaArraySerialize(): void { |
|
| 96 | - $templating = $this->getTemplating(); |
|
| 97 | - $this->assertOkTemplate( |
|
| 98 | - $templating, |
|
| 99 | - '[(#CONFIG{/meta/serie}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' |
|
| 100 | - ); |
|
| 101 | - $this->assertOkTemplate( |
|
| 102 | - $templating, |
|
| 103 | - '[(#CONFIG{/meta/serie,defaut}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' |
|
| 104 | - ); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - public function testAutreTableConfigNomAbsent(): void { |
|
| 108 | - $templating = $this->getTemplatingOtherTable(); |
|
| 109 | - $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tpasla}|non)ok]'); |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - public function testAutreTableConfigNomAbsentAvecDefaut(): void { |
|
| 113 | - $templating = $this->getTemplatingOtherTable(); |
|
| 114 | - $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tpasla,defaut}|=={defaut}|oui)ok]'); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - public function testAutreTableConfigChaine(): void { |
|
| 118 | - $templating = $this->getTemplatingOtherTable(); |
|
| 119 | - $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tchaine}|=={une chaine}|oui)ok]'); |
|
| 120 | - $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tchaine,defaut}|=={une chaine}|oui)ok]'); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - public function testAutreTableConfigValeurZero(): void { |
|
| 124 | - $templating = $this->getTemplatingOtherTable(); |
|
| 125 | - $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tzero}|=={0}|oui)ok]'); |
|
| 126 | - $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tzero,defaut}|=={0}|oui)ok]'); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - public function testAutreTableConfigChaineZero(): void { |
|
| 130 | - $templating = $this->getTemplatingOtherTable(); |
|
| 131 | - $this->assertOkTemplate($templating, "[(#CONFIG{/toto/tzeroc}|=={'0'}|oui)ok]"); |
|
| 132 | - $this->assertOkTemplate($templating, "[(#CONFIG{/toto/tzeroc,defaut}|=={'0'}|oui)ok]"); |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - public function testAutreTableArrayAssoc(): void { |
|
| 136 | - $templating = $this->getTemplatingOtherTable(); |
|
| 137 | - $this->assertOkTemplate($templating, "[(#CONFIG{/toto/tassoc,'',''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]"); |
|
| 138 | - $this->assertOkTemplate( |
|
| 139 | - $templating, |
|
| 140 | - "[(#CONFIG{/toto/tassoc,defaut,''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]" |
|
| 141 | - ); |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - public function testAutreTableArraySerialize(): void { |
|
| 145 | - $templating = $this->getTemplatingOtherTable(); |
|
| 146 | - $this->assertOkTemplate( |
|
| 147 | - $templating, |
|
| 148 | - '[(#CONFIG{/toto/tserie}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' |
|
| 149 | - ); |
|
| 150 | - $this->assertOkTemplate( |
|
| 151 | - $templating, |
|
| 152 | - '[(#CONFIG{/toto/tserie,defaut}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' |
|
| 153 | - ); |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - private function getFakeMetaData(): array { |
|
| 157 | - $assoc = [ |
|
| 158 | - 'one' => 'element 1', |
|
| 159 | - 'two' => 'element 2', |
|
| 160 | - ]; |
|
| 161 | - return [ |
|
| 162 | - 'zero' => 0, |
|
| 163 | - 'zeroc' => '0', |
|
| 164 | - 'chaine' => 'une chaine', |
|
| 165 | - 'assoc' => $assoc, |
|
| 166 | - 'serie' => serialize($assoc), |
|
| 167 | - ]; |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - private function getFakeMetaDataT(): array { |
|
| 171 | - $assoc = [ |
|
| 172 | - 'one' => 'element 1', |
|
| 173 | - 'two' => 'element 2', |
|
| 174 | - ]; |
|
| 175 | - return [ |
|
| 176 | - 'tzero' => 0, |
|
| 177 | - 'tzeroc' => '0', |
|
| 178 | - 'tchaine' => 'une chaine', |
|
| 179 | - 'tassoc' => $assoc, |
|
| 180 | - 'tserie' => serialize($assoc), |
|
| 181 | - ]; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - private function getTemplating(): Templating { |
|
| 185 | - $fake = var_export($this->getFakeMetaData(), true); |
|
| 186 | - return Templating::fromString([ |
|
| 187 | - 'fonctions' => " |
|
| 12 | + public function testConfigNomAbsent(): void { |
|
| 13 | + $templating = $this->getTemplating(); |
|
| 14 | + $this->assertOkTemplate($templating, '[(#CONFIG{pasla}|non)ok]'); |
|
| 15 | + } |
|
| 16 | + |
|
| 17 | + public function testConfigNomAbsentAvecDefaut(): void { |
|
| 18 | + $templating = $this->getTemplating(); |
|
| 19 | + $this->assertOkTemplate($templating, '[(#CONFIG{pasla,defaut}|=={defaut}|oui)ok]'); |
|
| 20 | + } |
|
| 21 | + |
|
| 22 | + public function testConfigChaine(): void { |
|
| 23 | + $templating = $this->getTemplating(); |
|
| 24 | + $this->assertOkTemplate($templating, '[(#CONFIG{chaine}|=={une chaine}|oui)ok]'); |
|
| 25 | + $this->assertOkTemplate($templating, '[(#CONFIG{chaine,defaut}|=={une chaine}|oui)ok]'); |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + public function testConfigValeurZero(): void { |
|
| 29 | + $templating = $this->getTemplating(); |
|
| 30 | + $this->assertOkTemplate($templating, '[(#CONFIG{zero}|=={0}|oui)ok]'); |
|
| 31 | + $this->assertOkTemplate($templating, '[(#CONFIG{zero,defaut}|=={0}|oui)ok]'); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + public function testConfigChaineZero(): void { |
|
| 35 | + $templating = $this->getTemplating(); |
|
| 36 | + $this->assertOkTemplate($templating, "[(#CONFIG{zeroc}|=={'0'}|oui)ok]"); |
|
| 37 | + $this->assertOkTemplate($templating, "[(#CONFIG{zeroc,defaut}|=={'0'}|oui)ok]"); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + public function testArrayAssoc(): void { |
|
| 41 | + $templating = $this->getTemplating(); |
|
| 42 | + $this->assertOkTemplate($templating, "[(#CONFIG{assoc,'',''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]"); |
|
| 43 | + $this->assertOkTemplate($templating, "[(#CONFIG{assoc,defaut,''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]"); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + public function testArraySerialize(): void { |
|
| 47 | + $templating = $this->getTemplating(); |
|
| 48 | + $this->assertOkTemplate( |
|
| 49 | + $templating, |
|
| 50 | + '[(#CONFIG{serie}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' |
|
| 51 | + ); |
|
| 52 | + $this->assertOkTemplate( |
|
| 53 | + $templating, |
|
| 54 | + '[(#CONFIG{serie,defaut}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' |
|
| 55 | + ); |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + public function testMetaConfigNomAbsent(): void { |
|
| 59 | + $templating = $this->getTemplating(); |
|
| 60 | + $this->assertOkTemplate($templating, '[(#CONFIG{/meta/pasla}|non)ok]'); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + public function testMetaConfigNomAbsentAvecDefaut(): void { |
|
| 64 | + $templating = $this->getTemplating(); |
|
| 65 | + $this->assertOkTemplate($templating, '[(#CONFIG{/meta/pasla,defaut}|=={defaut}|oui)ok]'); |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + public function testMetaConfigChaine(): void { |
|
| 69 | + $templating = $this->getTemplating(); |
|
| 70 | + $this->assertOkTemplate($templating, '[(#CONFIG{/meta/chaine}|=={une chaine}|oui)ok]'); |
|
| 71 | + $this->assertOkTemplate($templating, '[(#CONFIG{/meta/chaine,defaut}|=={une chaine}|oui)ok]'); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + public function testMetaConfigValeurZero(): void { |
|
| 75 | + $templating = $this->getTemplating(); |
|
| 76 | + $this->assertOkTemplate($templating, '[(#CONFIG{/meta/zero}|=={0}|oui)ok]'); |
|
| 77 | + $this->assertOkTemplate($templating, '[(#CONFIG{/meta/zero,defaut}|=={0}|oui)ok]'); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + public function testMetaConfigChaineZero(): void { |
|
| 81 | + $templating = $this->getTemplating(); |
|
| 82 | + $this->assertOkTemplate($templating, "[(#CONFIG{/meta/zeroc}|=={'0'}|oui)ok]"); |
|
| 83 | + $this->assertOkTemplate($templating, "[(#CONFIG{/meta/zeroc,defaut}|=={'0'}|oui)ok]"); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + public function testMetaArrayAssoc(): void { |
|
| 87 | + $templating = $this->getTemplating(); |
|
| 88 | + $this->assertOkTemplate($templating, "[(#CONFIG{/meta/assoc,'',''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]"); |
|
| 89 | + $this->assertOkTemplate( |
|
| 90 | + $templating, |
|
| 91 | + "[(#CONFIG{/meta/assoc,defaut,''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]" |
|
| 92 | + ); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + public function testMetaArraySerialize(): void { |
|
| 96 | + $templating = $this->getTemplating(); |
|
| 97 | + $this->assertOkTemplate( |
|
| 98 | + $templating, |
|
| 99 | + '[(#CONFIG{/meta/serie}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' |
|
| 100 | + ); |
|
| 101 | + $this->assertOkTemplate( |
|
| 102 | + $templating, |
|
| 103 | + '[(#CONFIG{/meta/serie,defaut}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' |
|
| 104 | + ); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + public function testAutreTableConfigNomAbsent(): void { |
|
| 108 | + $templating = $this->getTemplatingOtherTable(); |
|
| 109 | + $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tpasla}|non)ok]'); |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + public function testAutreTableConfigNomAbsentAvecDefaut(): void { |
|
| 113 | + $templating = $this->getTemplatingOtherTable(); |
|
| 114 | + $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tpasla,defaut}|=={defaut}|oui)ok]'); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + public function testAutreTableConfigChaine(): void { |
|
| 118 | + $templating = $this->getTemplatingOtherTable(); |
|
| 119 | + $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tchaine}|=={une chaine}|oui)ok]'); |
|
| 120 | + $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tchaine,defaut}|=={une chaine}|oui)ok]'); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + public function testAutreTableConfigValeurZero(): void { |
|
| 124 | + $templating = $this->getTemplatingOtherTable(); |
|
| 125 | + $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tzero}|=={0}|oui)ok]'); |
|
| 126 | + $this->assertOkTemplate($templating, '[(#CONFIG{/toto/tzero,defaut}|=={0}|oui)ok]'); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + public function testAutreTableConfigChaineZero(): void { |
|
| 130 | + $templating = $this->getTemplatingOtherTable(); |
|
| 131 | + $this->assertOkTemplate($templating, "[(#CONFIG{/toto/tzeroc}|=={'0'}|oui)ok]"); |
|
| 132 | + $this->assertOkTemplate($templating, "[(#CONFIG{/toto/tzeroc,defaut}|=={'0'}|oui)ok]"); |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + public function testAutreTableArrayAssoc(): void { |
|
| 136 | + $templating = $this->getTemplatingOtherTable(); |
|
| 137 | + $this->assertOkTemplate($templating, "[(#CONFIG{/toto/tassoc,'',''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]"); |
|
| 138 | + $this->assertOkTemplate( |
|
| 139 | + $templating, |
|
| 140 | + "[(#CONFIG{/toto/tassoc,defaut,''}|=={#ARRAY{one,element 1,two,element 2}}|oui)ok]" |
|
| 141 | + ); |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + public function testAutreTableArraySerialize(): void { |
|
| 145 | + $templating = $this->getTemplatingOtherTable(); |
|
| 146 | + $this->assertOkTemplate( |
|
| 147 | + $templating, |
|
| 148 | + '[(#CONFIG{/toto/tserie}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' |
|
| 149 | + ); |
|
| 150 | + $this->assertOkTemplate( |
|
| 151 | + $templating, |
|
| 152 | + '[(#CONFIG{/toto/tserie,defaut}|=={a:2:{s:3:"one";s:9:"element 1";s:3:"two";s:9:"element 2";}}oui)ok]' |
|
| 153 | + ); |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + private function getFakeMetaData(): array { |
|
| 157 | + $assoc = [ |
|
| 158 | + 'one' => 'element 1', |
|
| 159 | + 'two' => 'element 2', |
|
| 160 | + ]; |
|
| 161 | + return [ |
|
| 162 | + 'zero' => 0, |
|
| 163 | + 'zeroc' => '0', |
|
| 164 | + 'chaine' => 'une chaine', |
|
| 165 | + 'assoc' => $assoc, |
|
| 166 | + 'serie' => serialize($assoc), |
|
| 167 | + ]; |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + private function getFakeMetaDataT(): array { |
|
| 171 | + $assoc = [ |
|
| 172 | + 'one' => 'element 1', |
|
| 173 | + 'two' => 'element 2', |
|
| 174 | + ]; |
|
| 175 | + return [ |
|
| 176 | + 'tzero' => 0, |
|
| 177 | + 'tzeroc' => '0', |
|
| 178 | + 'tchaine' => 'une chaine', |
|
| 179 | + 'tassoc' => $assoc, |
|
| 180 | + 'tserie' => serialize($assoc), |
|
| 181 | + ]; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + private function getTemplating(): Templating { |
|
| 185 | + $fake = var_export($this->getFakeMetaData(), true); |
|
| 186 | + return Templating::fromString([ |
|
| 187 | + 'fonctions' => " |
|
| 188 | 188 | function test_meta(\$raz = 0) { |
| 189 | 189 | static \$meta = []; |
| 190 | 190 | if (!\$meta) { |
@@ -196,15 +196,15 @@ discard block |
||
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | ", |
| 199 | - 'avant_code' => '[(#VAL|test_meta)]', |
|
| 200 | - 'apres_code' => '[(#VAL{1}|test_meta)]', |
|
| 201 | - ]); |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - private function getTemplatingOtherTable(): Templating { |
|
| 205 | - $fake = var_export($this->getFakeMetaDataT(), true); |
|
| 206 | - return Templating::fromString([ |
|
| 207 | - 'fonctions' => " |
|
| 199 | + 'avant_code' => '[(#VAL|test_meta)]', |
|
| 200 | + 'apres_code' => '[(#VAL{1}|test_meta)]', |
|
| 201 | + ]); |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + private function getTemplatingOtherTable(): Templating { |
|
| 205 | + $fake = var_export($this->getFakeMetaDataT(), true); |
|
| 206 | + return Templating::fromString([ |
|
| 207 | + 'fonctions' => " |
|
| 208 | 208 | function test_meta_toto(\$raz = 0) { |
| 209 | 209 | \$GLOBALS['toto'] = {$fake}; |
| 210 | 210 | if (\$raz) { |
@@ -212,8 +212,8 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | ", |
| 215 | - 'avant_code' => '[(#VAL|test_meta_toto)]', |
|
| 216 | - 'apres_code' => '[(#VAL{1}|test_meta_toto)]', |
|
| 217 | - ]); |
|
| 218 | - } |
|
| 215 | + 'avant_code' => '[(#VAL|test_meta_toto)]', |
|
| 216 | + 'apres_code' => '[(#VAL{1}|test_meta_toto)]', |
|
| 217 | + ]); |
|
| 218 | + } |
|
| 219 | 219 | } |
@@ -8,43 +8,43 @@ |
||
| 8 | 8 | |
| 9 | 9 | class NotesTest extends SquelettesTestCase |
| 10 | 10 | { |
| 11 | - protected function setUp(): void { |
|
| 12 | - $this->viderNotes(); |
|
| 13 | - } |
|
| 14 | - |
|
| 15 | - public function testNotesEnVrac(): void { |
|
| 16 | - $this->assertOkSquelette(__DIR__ . '/data/notes.html'); |
|
| 17 | - } |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Ce bloc est en premier, et contient des notes separees par un MODELE; il ne doit pas "sauter" de compteur_notes |
|
| 21 | - * (nb2-2) |
|
| 22 | - */ |
|
| 23 | - public function testNoteNonSupprimeeSiBaliseModele(): void { |
|
| 24 | - $this->assertOkCode( |
|
| 25 | - "[(#VAL{\[\[note1\]\]<img1>\[\[note2\]\]'} |
|
| 11 | + protected function setUp(): void { |
|
| 12 | + $this->viderNotes(); |
|
| 13 | + } |
|
| 14 | + |
|
| 15 | + public function testNotesEnVrac(): void { |
|
| 16 | + $this->assertOkSquelette(__DIR__ . '/data/notes.html'); |
|
| 17 | + } |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Ce bloc est en premier, et contient des notes separees par un MODELE; il ne doit pas "sauter" de compteur_notes |
|
| 21 | + * (nb2-2) |
|
| 22 | + */ |
|
| 23 | + public function testNoteNonSupprimeeSiBaliseModele(): void { |
|
| 24 | + $this->assertOkCode( |
|
| 25 | + "[(#VAL{\[\[note1\]\]<img1>\[\[note2\]\]'} |
|
| 26 | 26 | |propre |
| 27 | 27 | |match{'nb.-1'} |
| 28 | 28 | |?{#VAL{'Le compteur_notes a change a cause du modele. Résultat: '#NOTES}, OK})]" |
| 29 | - ); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * Ce bloc teste le bug introduit en http://trac.rezo.net/trac/spip/changeset/8847 et corrige en |
|
| 34 | - * http://trac.rezo.net/trac/spip/changeset/8872 |
|
| 35 | - */ |
|
| 36 | - public function testNoteNonSupprimeeSiInclureInline(): void { |
|
| 37 | - $dir = $this->relativePath(__DIR__); |
|
| 38 | - $this->assertOkCode(" |
|
| 29 | + ); |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * Ce bloc teste le bug introduit en http://trac.rezo.net/trac/spip/changeset/8847 et corrige en |
|
| 34 | + * http://trac.rezo.net/trac/spip/changeset/8872 |
|
| 35 | + */ |
|
| 36 | + public function testNoteNonSupprimeeSiInclureInline(): void { |
|
| 37 | + $dir = $this->relativePath(__DIR__); |
|
| 38 | + $this->assertOkCode(" |
|
| 39 | 39 | [(#VAL{'\[\[Ma note\]\]'}|propre|?)] |
| 40 | 40 | [(#INCLURE{fond={$dir}/data/inclure_vide})] |
| 41 | 41 | [(#NOTES|match{Ma note}|?{'OK','Une note mangee par INCLURE'})] |
| 42 | 42 | "); |
| 43 | - } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - private function viderNotes(): void { |
|
| 46 | - // attention a cette globale qui pourrait changer dans le temps |
|
| 47 | - $notes = charger_fonction('notes', 'inc'); |
|
| 48 | - $notes('', 'reset_all'); |
|
| 49 | - } |
|
| 45 | + private function viderNotes(): void { |
|
| 46 | + // attention a cette globale qui pourrait changer dans le temps |
|
| 47 | + $notes = charger_fonction('notes', 'inc'); |
|
| 48 | + $notes('', 'reset_all'); |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | public function testNotesEnVrac(): void { |
| 16 | - $this->assertOkSquelette(__DIR__ . '/data/notes.html'); |
|
| 16 | + $this->assertOkSquelette(__DIR__.'/data/notes.html'); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | declare(strict_types=1); |
| 4 | 4 | |
| 5 | 5 | function formulaires_test_dyn_lang_charger_dist($lang_skel) { |
| 6 | - return [ |
|
| 7 | - 'message_ok' => $lang_skel === $GLOBALS['spip_lang'] ? 'OK' : "NOK : La langue dans le squelette appelant est {$lang_skel} mais la langue dans charger() est " . $GLOBALS['spip_lang'], |
|
| 8 | - ]; |
|
| 6 | + return [ |
|
| 7 | + 'message_ok' => $lang_skel === $GLOBALS['spip_lang'] ? 'OK' : "NOK : La langue dans le squelette appelant est {$lang_skel} mais la langue dans charger() est " . $GLOBALS['spip_lang'], |
|
| 8 | + ]; |
|
| 9 | 9 | } |
@@ -4,6 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | function formulaires_test_dyn_lang_charger_dist($lang_skel) { |
| 6 | 6 | return [ |
| 7 | - 'message_ok' => $lang_skel === $GLOBALS['spip_lang'] ? 'OK' : "NOK : La langue dans le squelette appelant est {$lang_skel} mais la langue dans charger() est " . $GLOBALS['spip_lang'], |
|
| 7 | + 'message_ok' => $lang_skel === $GLOBALS['spip_lang'] ? 'OK' : "NOK : La langue dans le squelette appelant est {$lang_skel} mais la langue dans charger() est ".$GLOBALS['spip_lang'], |
|
| 8 | 8 | ]; |
| 9 | 9 | } |