Completed
Push — master ( ad9227...bd2221 )
by cam
01:15
created
ecrire/tests/Testing/TemplateTest.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,14 +9,14 @@
 block discarded – undo
9 9
 
10 10
 class TemplateTest extends SquelettesTestCase
11 11
 {
12
-	public function testNativeRecupererFond(): void {
13
-		$dir = $this->relativePath(__DIR__);
14
-		$this->assertEquals('Hello World', recuperer_fond($dir . '/data/texte_hello_world'));
15
-	}
12
+    public function testNativeRecupererFond(): void {
13
+        $dir = $this->relativePath(__DIR__);
14
+        $this->assertEquals('Hello World', recuperer_fond($dir . '/data/texte_hello_world'));
15
+    }
16 16
 
17
-	public function testRenderer(): void {
18
-		$dir = $this->relativePath(__DIR__);
19
-		$template = new Template($dir . '/data/texte_hello_world');
20
-		$this->assertEquals('Hello World', $template->render());
21
-	}
17
+    public function testRenderer(): void {
18
+        $dir = $this->relativePath(__DIR__);
19
+        $template = new Template($dir . '/data/texte_hello_world');
20
+        $this->assertEquals('Hello World', $template->render());
21
+    }
22 22
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@
 block discarded – undo
11 11
 {
12 12
 	public function testNativeRecupererFond(): void {
13 13
 		$dir = $this->relativePath(__DIR__);
14
-		$this->assertEquals('Hello World', recuperer_fond($dir . '/data/texte_hello_world'));
14
+		$this->assertEquals('Hello World', recuperer_fond($dir.'/data/texte_hello_world'));
15 15
 	}
16 16
 
17 17
 	public function testRenderer(): void {
18 18
 		$dir = $this->relativePath(__DIR__);
19
-		$template = new Template($dir . '/data/texte_hello_world');
19
+		$template = new Template($dir.'/data/texte_hello_world');
20 20
 		$this->assertEquals('Hello World', $template->render());
21 21
 	}
22 22
 }
Please login to merge, or discard this patch.
ecrire/tests/Testing/TemplatingTest.php 2 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -13,137 +13,137 @@
 block discarded – undo
13 13
 
14 14
 class TemplatingTest extends SquelettesTestCase
15 15
 {
16
-	public function testFileLoader(): void {
17
-		$loader = new FileLoader();
18
-		$templating = new Templating($loader);
19
-		$this->assertInstanceOf(FileLoader::class, $templating->getLoader());
20
-		$this->assertEquals($loader, $templating->getLoader());
21
-
22
-		$file = __DIR__ . '/data/texte_hello_world.html';
23
-		$expected = trim(file_get_contents($file));
24
-
25
-		// Indirect render
26
-		$template = $templating->load($file);
27
-		$actual = $template->render();
28
-		$this->assertEquals($expected, $actual);
29
-
30
-		// Quick render
31
-		$actual = $templating->render($file);
32
-		$this->assertEquals($expected, $actual);
33
-
34
-		// Assert render
35
-		$this->assertEqualsTemplate($expected, $templating, $file);
36
-	}
37
-
38
-	public function testFileLoaderException(): void {
39
-		$templating = new Templating(new FileLoader());
40
-		$file = __DIR__ . '/data/inexistant_file.html';
41
-		$this->expectException(TemplateNotFoundException::class);
42
-		$templating->render($file);
43
-	}
44
-
45
-	public function testStringLoader(): void {
46
-		$templating = Templating::fromString();
47
-		$expected = 'Hello World';
48
-		$actual = $templating->render($expected);
49
-		$this->assertEquals($expected, $actual);
50
-	}
51
-
52
-	public function testChainLoader(): void {
53
-		$template = new Templating(new ChainLoader([new FileLoader(), new StringLoader()]));
54
-
55
-		$file = __DIR__ . '/data/texte_hello_world.html';
56
-		$expected = trim(file_get_contents($file));
57
-		$actual = $template->render($file);
58
-		$this->assertEquals($expected, $actual);
59
-
60
-		$string = 'Not a file';
61
-		$actual = $template->render($string);
62
-		$this->assertEquals($string, $actual);
63
-	}
64
-
65
-	public function testCodeRenderAvecFonctionEtApresCode(): void {
66
-		$loader = new StringLoader([
67
-			'fonctions' => "
16
+    public function testFileLoader(): void {
17
+        $loader = new FileLoader();
18
+        $templating = new Templating($loader);
19
+        $this->assertInstanceOf(FileLoader::class, $templating->getLoader());
20
+        $this->assertEquals($loader, $templating->getLoader());
21
+
22
+        $file = __DIR__ . '/data/texte_hello_world.html';
23
+        $expected = trim(file_get_contents($file));
24
+
25
+        // Indirect render
26
+        $template = $templating->load($file);
27
+        $actual = $template->render();
28
+        $this->assertEquals($expected, $actual);
29
+
30
+        // Quick render
31
+        $actual = $templating->render($file);
32
+        $this->assertEquals($expected, $actual);
33
+
34
+        // Assert render
35
+        $this->assertEqualsTemplate($expected, $templating, $file);
36
+    }
37
+
38
+    public function testFileLoaderException(): void {
39
+        $templating = new Templating(new FileLoader());
40
+        $file = __DIR__ . '/data/inexistant_file.html';
41
+        $this->expectException(TemplateNotFoundException::class);
42
+        $templating->render($file);
43
+    }
44
+
45
+    public function testStringLoader(): void {
46
+        $templating = Templating::fromString();
47
+        $expected = 'Hello World';
48
+        $actual = $templating->render($expected);
49
+        $this->assertEquals($expected, $actual);
50
+    }
51
+
52
+    public function testChainLoader(): void {
53
+        $template = new Templating(new ChainLoader([new FileLoader(), new StringLoader()]));
54
+
55
+        $file = __DIR__ . '/data/texte_hello_world.html';
56
+        $expected = trim(file_get_contents($file));
57
+        $actual = $template->render($file);
58
+        $this->assertEquals($expected, $actual);
59
+
60
+        $string = 'Not a file';
61
+        $actual = $template->render($string);
62
+        $this->assertEquals($string, $actual);
63
+    }
64
+
65
+    public function testCodeRenderAvecFonctionEtApresCode(): void {
66
+        $loader = new StringLoader([
67
+            'fonctions' => "
68 68
 				function so_smile(): string {
69 69
 					return ' So Smile';
70 70
 				}
71 71
 			",
72
-			'apres_code' => '[(#VAL|so_smile)]',
73
-		]);
74
-		$templating = new Templating($loader);
75
-		$this->assertEquals('Hello World So Smile', $templating->render('Hello World'));
72
+            'apres_code' => '[(#VAL|so_smile)]',
73
+        ]);
74
+        $templating = new Templating($loader);
75
+        $this->assertEquals('Hello World So Smile', $templating->render('Hello World'));
76 76
 
77
-		$templating = Templating::fromString([
78
-			'fonctions' => "
77
+        $templating = Templating::fromString([
78
+            'fonctions' => "
79 79
 				function so_smile(): string {
80 80
 					return ' So Smile';
81 81
 				}
82 82
 			",
83
-			'apres_code' => '[(#VAL|so_smile)]',
84
-		]);
85
-		$this->assertEquals('Hello World So Smile', $templating->render('Hello World'));
86
-	}
87
-
88
-	public function testCodeRenderAvecFonctionPrecedenteNonPresente(): void {
89
-		$template = Templating::fromString();
90
-		$this->assertNotEquals('Hello World So Smile', $template->render('Hello World'));
91
-		$this->assertEquals('Hello World', $template->render('Hello World'));
92
-		$this->assertNotEquals('Hello Kitty So Smile', $template->render('Hello Kitty'));
93
-		$this->assertEquals('Hello Kitty', $template->render('Hello Kitty'));
94
-	}
95
-
96
-	public function testCodeRender(): void {
97
-		$this->assertEqualsCode('Hello World', 'Hello World');
98
-	}
99
-
100
-	public function testCodeRenderAvecFonctionVide(): void {
101
-		// pas de fichier de fonctions
102
-		$this->assertOkCode("[(#SQUELETTE|replace{'.html','_fonctions.php'}|find_in_path|non)ok]");
103
-
104
-		// fichier de fonction
105
-		$templating = Templating::fromString([
106
-			'fonctions' => "
83
+            'apres_code' => '[(#VAL|so_smile)]',
84
+        ]);
85
+        $this->assertEquals('Hello World So Smile', $templating->render('Hello World'));
86
+    }
87
+
88
+    public function testCodeRenderAvecFonctionPrecedenteNonPresente(): void {
89
+        $template = Templating::fromString();
90
+        $this->assertNotEquals('Hello World So Smile', $template->render('Hello World'));
91
+        $this->assertEquals('Hello World', $template->render('Hello World'));
92
+        $this->assertNotEquals('Hello Kitty So Smile', $template->render('Hello Kitty'));
93
+        $this->assertEquals('Hello Kitty', $template->render('Hello Kitty'));
94
+    }
95
+
96
+    public function testCodeRender(): void {
97
+        $this->assertEqualsCode('Hello World', 'Hello World');
98
+    }
99
+
100
+    public function testCodeRenderAvecFonctionVide(): void {
101
+        // pas de fichier de fonctions
102
+        $this->assertOkCode("[(#SQUELETTE|replace{'.html','_fonctions.php'}|find_in_path|non)ok]");
103
+
104
+        // fichier de fonction
105
+        $templating = Templating::fromString([
106
+            'fonctions' => "
107 107
 				function so_smile(): string {
108 108
 					return ' So Smile';
109 109
 				}
110 110
 			",
111
-		]);
112
-		$this->assertOk($templating->render("[(#SQUELETTE|replace{'.html','_fonctions.php'}|find_in_path|oui)ok]"));
113
-
114
-		// pas de fichier de fonctions
115
-		$templating = Templating::fromString();
116
-		$this->assertNotOk($templating->render("[(#SQUELETTE|replace{'.html','_fonctions.php'}|find_in_path|oui)ok]"));
117
-	}
118
-
119
-	public function testCodeRenderAvantApres(): void {
120
-		$templating = Templating::fromString([
121
-			'avant_code' => 'Nice ',
122
-			'apres_code' => ' So Beautiful',
123
-		]);
124
-		$this->assertEquals('Nice Hello World So Beautiful', $templating->render('Hello World'));
125
-	}
126
-
127
-	public function testCodeRawRenderInfos(): void {
128
-		$templating = Templating::fromString();
129
-		$infos = $templating->rawRender('#SELF');
130
-		$this->assertTrue(is_array($infos));
131
-		$this->assertTrue(isset($infos['squelette']));
132
-		$this->assertTrue(isset($infos['fond']));
133
-	}
134
-
135
-	public function testCodeRawRenderInfosErreurCompilationFiltreAbsent(): void {
136
-		$templating = Templating::fromString();
137
-
138
-		$infos = $templating->rawRender('#CACHE{0}[(#SELF|ce_filtre_nexiste_pas)]');
139
-		$this->assertTrue(is_array($infos['erreurs']));
140
-		$this->assertCount(1, $infos['erreurs']);
141
-	}
142
-
143
-	public function testCodeRawRenderInfosErreurCompilationAbsentsDansNouvelleDemandeCorrecte(): void {
144
-		$templating = Templating::fromString();
145
-
146
-		$infos = $templating->rawRender('#CACHE{0}Aucun Probleme ici');
147
-		$this->assertCount(0, $infos['erreurs']);
148
-	}
111
+        ]);
112
+        $this->assertOk($templating->render("[(#SQUELETTE|replace{'.html','_fonctions.php'}|find_in_path|oui)ok]"));
113
+
114
+        // pas de fichier de fonctions
115
+        $templating = Templating::fromString();
116
+        $this->assertNotOk($templating->render("[(#SQUELETTE|replace{'.html','_fonctions.php'}|find_in_path|oui)ok]"));
117
+    }
118
+
119
+    public function testCodeRenderAvantApres(): void {
120
+        $templating = Templating::fromString([
121
+            'avant_code' => 'Nice ',
122
+            'apres_code' => ' So Beautiful',
123
+        ]);
124
+        $this->assertEquals('Nice Hello World So Beautiful', $templating->render('Hello World'));
125
+    }
126
+
127
+    public function testCodeRawRenderInfos(): void {
128
+        $templating = Templating::fromString();
129
+        $infos = $templating->rawRender('#SELF');
130
+        $this->assertTrue(is_array($infos));
131
+        $this->assertTrue(isset($infos['squelette']));
132
+        $this->assertTrue(isset($infos['fond']));
133
+    }
134
+
135
+    public function testCodeRawRenderInfosErreurCompilationFiltreAbsent(): void {
136
+        $templating = Templating::fromString();
137
+
138
+        $infos = $templating->rawRender('#CACHE{0}[(#SELF|ce_filtre_nexiste_pas)]');
139
+        $this->assertTrue(is_array($infos['erreurs']));
140
+        $this->assertCount(1, $infos['erreurs']);
141
+    }
142
+
143
+    public function testCodeRawRenderInfosErreurCompilationAbsentsDansNouvelleDemandeCorrecte(): void {
144
+        $templating = Templating::fromString();
145
+
146
+        $infos = $templating->rawRender('#CACHE{0}Aucun Probleme ici');
147
+        $this->assertCount(0, $infos['erreurs']);
148
+    }
149 149
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 		$this->assertInstanceOf(FileLoader::class, $templating->getLoader());
20 20
 		$this->assertEquals($loader, $templating->getLoader());
21 21
 
22
-		$file = __DIR__ . '/data/texte_hello_world.html';
22
+		$file = __DIR__.'/data/texte_hello_world.html';
23 23
 		$expected = trim(file_get_contents($file));
24 24
 
25 25
 		// Indirect render
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
 	public function testFileLoaderException(): void {
39 39
 		$templating = new Templating(new FileLoader());
40
-		$file = __DIR__ . '/data/inexistant_file.html';
40
+		$file = __DIR__.'/data/inexistant_file.html';
41 41
 		$this->expectException(TemplateNotFoundException::class);
42 42
 		$templating->render($file);
43 43
 	}
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	public function testChainLoader(): void {
53 53
 		$template = new Templating(new ChainLoader([new FileLoader(), new StringLoader()]));
54 54
 
55
-		$file = __DIR__ . '/data/texte_hello_world.html';
55
+		$file = __DIR__.'/data/texte_hello_world.html';
56 56
 		$expected = trim(file_get_contents($file));
57 57
 		$actual = $template->render($file);
58 58
 		$this->assertEquals($expected, $actual);
Please login to merge, or discard this patch.
ecrire/tests/Squelettes/Critere/OrigineTraductionTest.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -11,27 +11,27 @@  discard block
 block discarded – undo
11 11
 class OrigineTraductionTest extends SquelettesTestCase
12 12
 {
13 13
 
14
-	/** Un article non traduit est bien {origine_traduction} */
15
-	public function testArticleTraduitEstOrigineTraduction(): void {
16
-		$templating = Templating::fromString();
17
-		$result = $templating->render(<<<SPIP
14
+    /** Un article non traduit est bien {origine_traduction} */
15
+    public function testArticleTraduitEstOrigineTraduction(): void {
16
+        $templating = Templating::fromString();
17
+        $result = $templating->render(<<<SPIP
18 18
 		<BOUCLE_t(ARTICLES)/>[(#TOTAL_BOUCLE|<{2}|?{NA il faut des articles})]<//B_t>
19 19
 		<BOUCLE_ori(ARTICLES){origine_traduction}{id_trad=0}{0,1}> </BOUCLE_ori>
20 20
 		Erreur boucle origine
21 21
 		<//B_ori>
22 22
 		ok
23 23
 		SPIP);
24
-		if ($this->isNa($result)) {
25
-			$this->markTestSkipped($result);
26
-		}
24
+        if ($this->isNa($result)) {
25
+            $this->markTestSkipped($result);
26
+        }
27 27
 
28
-		$this->assertOk($result);
29
-	}
28
+        $this->assertOk($result);
29
+    }
30 30
 
31
-	/** Un article traduit n'a qu'une traduction qui est {origine_traduction} */
32
-	public function testArticleTraduitAUneSeuleTraductionOrigineTraduction(): void {
33
-		$templating = Templating::fromString();
34
-		$result = $templating->render(<<<SPIP
31
+    /** Un article traduit n'a qu'une traduction qui est {origine_traduction} */
32
+    public function testArticleTraduitAUneSeuleTraductionOrigineTraduction(): void {
33
+        $templating = Templating::fromString();
34
+        $result = $templating->render(<<<SPIP
35 35
 		<BOUCLE_ori2(ARTICLES){id_trad>0}{origine_traduction}>
36 36
 		<BOUCLE_casse(ARTICLES){traduction}{origine_traduction}{!id_article}>
37 37
 			Boum ! #ID_ARTICLE ne devrait pas etre origine
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 		<//B_ori2>
42 42
 		OK
43 43
 		SPIP);
44
-		if ($this->isNa($result)) {
45
-			$this->markTestSkipped($result);
46
-		}
44
+        if ($this->isNa($result)) {
45
+            $this->markTestSkipped($result);
46
+        }
47 47
 
48
-		$this->assertOk($result);
49
-	}
48
+        $this->assertOk($result);
49
+    }
50 50
 }
Please login to merge, or discard this patch.
ecrire/tests/Squelettes/Critere/DoublonsTest.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -10,58 +10,58 @@
 block discarded – undo
10 10
 
11 11
 class DoublonsTest extends SquelettesTestCase
12 12
 {
13
-	public function testCritereDoublons(): void {
14
-		$this->assertOkCode(
15
-			'
13
+    public function testCritereDoublons(): void {
14
+        $this->assertOkCode(
15
+            '
16 16
 			<BOUCLE_a(ARTICLES){statut=.*}{doublons}></BOUCLE_a>
17 17
 			<BOUCLE_b(ARTICLES){statut=.*}{tout}{doublons}{0,1}>Erreur doublons articles</BOUCLE_b>
18 18
 			ok<//B_b>
19 19
 			'
20
-		);
21
-		$this->assertOkCode(
22
-			'
20
+        );
21
+        $this->assertOkCode(
22
+            '
23 23
 			<BOUCLE_a(ARTICLES){doublons}></BOUCLE_a>
24 24
 			<BOUCLE_b(ARTICLES){doublons}{0,1}>Erreur doublons articles</BOUCLE_b>
25 25
 			ok<//B_b>
26 26
 			'
27
-		);
28
-	}
27
+        );
28
+    }
29 29
 
30
-	public function testCritereDoublonsMultiplesBoucles(): void {
31
-		$this->assertOkSquelette(__DIR__ . '/data/doublons.html');
32
-	}
30
+    public function testCritereDoublonsMultiplesBoucles(): void {
31
+        $this->assertOkSquelette(__DIR__ . '/data/doublons.html');
32
+    }
33 33
 
34
-	public function testDoublonsAuteurs(): void {
35
-		$templating = Templating::fromString();
36
-		$n = $templating->render('<BOUCLE_a(AUTEURS)>#COMPTEUR_BOUCLE</BOUCLE_a>');
34
+    public function testDoublonsAuteurs(): void {
35
+        $templating = Templating::fromString();
36
+        $n = $templating->render('<BOUCLE_a(AUTEURS)>#COMPTEUR_BOUCLE</BOUCLE_a>');
37 37
 
38
-		if ($n <= 1) {
39
-			$this->markTestSkipped('Il faut au moins 2 auteurs ayant publie sur le site !');
40
-		}
38
+        if ($n <= 1) {
39
+            $this->markTestSkipped('Il faut au moins 2 auteurs ayant publie sur le site !');
40
+        }
41 41
 
42
-		$this->assertOkCode('
42
+        $this->assertOkCode('
43 43
 			<BOUCLE_a(AUTEURS){doublons}></BOUCLE_a>
44 44
 			<BOUCLE_b(AUTEURS){doublons}{0,1}>Erreur doublons Auteurs</BOUCLE_b>OK<//B_b>
45 45
 		');
46
-	}
46
+    }
47 47
 
48
-	#[Depends('testDoublonsAuteurs')]
49
-	public function testDoublonsNommesAuteurs(): void {
50
-		$this->assertOkCode('
48
+    #[Depends('testDoublonsAuteurs')]
49
+    public function testDoublonsNommesAuteurs(): void {
50
+        $this->assertOkCode('
51 51
 			<BOUCLE_a(AUTEURS){doublons polisson}></BOUCLE_a>
52 52
 			<BOUCLE_b(AUTEURS){doublons polisson}{0,1}>Erreur doublons Auteurs</BOUCLE_b>OK<//B_b>
53 53
 		');
54
-		$this->assertOkCode('
54
+        $this->assertOkCode('
55 55
 			<BOUCLE_a(AUTEURS){1/2}{doublons kakis}></BOUCLE_a>
56 56
 			<BOUCLE_b(AUTEURS){2/2}{doublons kokos}></BOUCLE_b>
57 57
 			<BOUCLE_c(AUTEURS){doublons kakis}{0,1}>ok</BOUCLE_c>Erreur doubles doublons Auteurs<//B_c>
58 58
 		');
59
-		$this->assertOkCode('
59
+        $this->assertOkCode('
60 60
 			<BOUCLE_a(AUTEURS){1/2}{doublons kakis}></BOUCLE_a>
61 61
 			<BOUCLE_b(AUTEURS){2/2}{doublons kokos}></BOUCLE_b>
62 62
 			<BOUCLE_c(AUTEURS){doublons kakis}{0,1}> </BOUCLE_c>Erreur doubles doublons Auteurs<//B_c>
63 63
 			<BOUCLE_d(AUTEURS){doublons kokos}{0,1}> </BOUCLE_d>Erreur doubles doublons Auteurs<//B_d>
64 64
 			<BOUCLE_e(AUTEURS){doublons kakis}{doublons kokos}{0,1}>Erreur doubles doublons Auteurs</BOUCLE_e>OK<//B_e>
65 65
 		');
66
-	}
66
+    }
67 67
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 	}
29 29
 
30 30
 	public function testCritereDoublonsMultiplesBoucles(): void {
31
-		$this->assertOkSquelette(__DIR__ . '/data/doublons.html');
31
+		$this->assertOkSquelette(__DIR__.'/data/doublons.html');
32 32
 	}
33 33
 
34 34
 	public function testDoublonsAuteurs(): void {
Please login to merge, or discard this patch.
ecrire/tests/Squelettes/Critere/TraductionTest.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@  discard block
 block discarded – undo
11 11
 class TraductionTest extends SquelettesTestCase
12 12
 {
13 13
 
14
-	/** Un article sans trad */
15
-	public function testArticleSansTraduction(): void {
16
-		$templating = Templating::fromString();
17
-		$result = $templating->render(<<<SPIP
14
+    /** Un article sans trad */
15
+    public function testArticleSansTraduction(): void {
16
+        $templating = Templating::fromString();
17
+        $result = $templating->render(<<<SPIP
18 18
 		<BOUCLE_principale(ARTICLES){id_trad=0}{0,1}>
19 19
 		<BOUCLE_check(ARTICLES){traduction}> </BOUCLE_check>
20 20
 			boucle check: le critere {traduction} a echoue
@@ -25,17 +25,17 @@  discard block
 block discarded – undo
25 25
 		<//B_principale>
26 26
 		ok
27 27
 		SPIP);
28
-		if ($this->isNa($result)) {
29
-			$this->markTestSkipped($result);
30
-		}
28
+        if ($this->isNa($result)) {
29
+            $this->markTestSkipped($result);
30
+        }
31 31
 
32
-		$this->assertOk($result);
33
-	}
32
+        $this->assertOk($result);
33
+    }
34 34
 
35
-	/** un article et ses traductions */
36
-	public function testArticleAvecTraductions(): void {
37
-		$templating = Templating::fromString();
38
-		$result = $templating->render(<<<SPIP
35
+    /** un article et ses traductions */
36
+    public function testArticleAvecTraductions(): void {
37
+        $templating = Templating::fromString();
38
+        $result = $templating->render(<<<SPIP
39 39
 		<BOUCLE_s(ARTICLES){id_trad>0}{0,1}>
40 40
 		<BOUCLE_t(ARTICLES){traduction}> </BOUCLE_t>
41 41
 		</BOUCLE_s>
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 		<//B_s>
44 44
 		ok
45 45
 		SPIP);
46
-		if ($this->isNa($result)) {
47
-			$this->markTestSkipped($result);
48
-		}
46
+        if ($this->isNa($result)) {
47
+            $this->markTestSkipped($result);
48
+        }
49 49
 
50
-		$this->assertOk($result);
51
-	}
50
+        $this->assertOk($result);
51
+    }
52 52
 }
Please login to merge, or discard this patch.
ecrire/tests/Squelettes/Critere/BrancheTest.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@  discard block
 block discarded – undo
10 10
 
11 11
 class BrancheTest extends SquelettesTestCase
12 12
 {
13
-	/**
14
-	 * 	Un test pour le critere {branche}
15
-	 *
16
-	 * 	verifie :
17
-	 * 	- une rubrique est dans sa branche
18
-	 * 	- sa fille est dans sa branche
19
-	 * 	- elle n'est pas dans la branche de sa fille
20
-	 *  - que la boucle documents compile sans erreur
21
-	 * 	- que la boucle articles compile sans erreur
22
-	 */
23
-	public function testCritereBranche(): void {
24
-		$this->assertOkCode(<<<SPIP
13
+    /**
14
+     * 	Un test pour le critere {branche}
15
+     *
16
+     * 	verifie :
17
+     * 	- une rubrique est dans sa branche
18
+     * 	- sa fille est dans sa branche
19
+     * 	- elle n'est pas dans la branche de sa fille
20
+     *  - que la boucle documents compile sans erreur
21
+     * 	- que la boucle articles compile sans erreur
22
+     */
23
+    public function testCritereBranche(): void {
24
+        $this->assertOkCode(<<<SPIP
25 25
 		<BOUCLE_a(RUBRIQUES){id_parent>0}>
26 26
 			<BOUCLE_b(RUBRIQUES){id_rubrique=#ID_PARENT}>
27 27
 				<BOUCLE_d(RUBRIQUES){branche}{id_rubrique}>
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 		</BOUCLE_a>
41 41
 		ok
42 42
 		SPIP);
43
-	}
43
+    }
44 44
 
45
-	public function testCompileBoucle(): void {
46
-		$this->assertOkCode(<<<SPIP
45
+    public function testCompileBoucle(): void {
46
+        $this->assertOkCode(<<<SPIP
47 47
 		<BOUCLE_art(ARTICLES){branche}{0,1}> </BOUCLE_art>
48 48
 		<BOUCLE_docs(DOCUMENTS){branche}{0,1}> </BOUCLE_docs>
49 49
 		OK
50 50
 		SPIP);
51
-	}
51
+    }
52 52
 }
Please login to merge, or discard this patch.
ecrire/tests/Squelettes/Critere/DoublonsNotesTest.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -10,19 +10,19 @@  discard block
 block discarded – undo
10 10
 
11 11
 class DoublonsNotesTest extends SquelettesTestCase
12 12
 {
13
-	public static function tearDownAfterClass(): void {
14
-		sql_delete('spip_articles', 'id_article = -1');
15
-	}
13
+    public static function tearDownAfterClass(): void {
14
+        sql_delete('spip_articles', 'id_article = -1');
15
+    }
16 16
 
17
-	/**
18
-	 * On cherche un article avec un document en note dans le texte,
19
-	 * et on veut qu'il soit pris par {doublons}
20
-	 * cf. https://git.spip.net/spip/spip/issues/779
21
-	 */
22
-	public function testCritereDoublonsNotes(): void {
23
-		$id_document = $this->creer_article_a_doublons_notes();
17
+    /**
18
+     * On cherche un article avec un document en note dans le texte,
19
+     * et on veut qu'il soit pris par {doublons}
20
+     * cf. https://git.spip.net/spip/spip/issues/779
21
+     */
22
+    public function testCritereDoublonsNotes(): void {
23
+        $id_document = $this->creer_article_a_doublons_notes();
24 24
 
25
-		$this->assertOkCode(<<<SPIP
25
+        $this->assertOkCode(<<<SPIP
26 26
 			<BOUCLE_d(DOCUMENTS){id_document=#ENV{id_document}}{statut==.*}>
27 27
 				<BOUCLE_a(ARTICLES){id_article=-1}{statut==.*}>[(#TEXTE|?)]</BOUCLE_a>
28 28
 				<BOUCLE_test(DOCUMENTS){id_document}{doublons}>
@@ -34,41 +34,41 @@  discard block
 block discarded – undo
34 34
 				erreur, pas de document
35 35
 			<//B_d>
36 36
 			SPIP,
37
-			[
38
-				'id_article' => -1,
39
-				'id_document' => $id_document,
40
-			]
41
-		);
42
-	}
37
+            [
38
+                'id_article' => -1,
39
+                'id_document' => $id_document,
40
+            ]
41
+        );
42
+    }
43 43
 
44
-	/**
45
-	 * Creation article de test pour doublons_notes.html
46
-	 * On cherche un document, on le met dans la note d'un texte,
47
-	 * @return int id_document
48
-	 */
49
-	private function creer_article_a_doublons_notes(): int {
50
-		$id_document = sql_getfetsel(
51
-			'id_document',
52
-			'spip_documents',
53
-			sql_in('mode', ['logoon','logooff','vignette'], 'not'),
54
-			orderby: 'rand()',
55
-			limit: '0,1'
56
-		);
57
-		if (!$id_document) {
58
-			$this->markTestSkipped('Il faut un document');
59
-		}
60
-		$data = [
61
-			'id_article' => -1,
62
-			'titre' => 'test pour doublons_notes.html',
63
-			'statut' => 'prepa',
64
-			'texte' => 'hello [[ xx <doc' . $id_document . '> ]].'
65
-		];
66
-		$id_article = sql_getfetsel('id_article', 'spip_articles', 'id_article = -1');
67
-		if ($id_article === null) {
68
-			sql_insertq('spip_articles', $data);
69
-		} else {
70
-			sql_updateq('spip_articles', $data, ['id_article = -1']);
71
-		}
72
-		return $id_document;
73
-	}
44
+    /**
45
+     * Creation article de test pour doublons_notes.html
46
+     * On cherche un document, on le met dans la note d'un texte,
47
+     * @return int id_document
48
+     */
49
+    private function creer_article_a_doublons_notes(): int {
50
+        $id_document = sql_getfetsel(
51
+            'id_document',
52
+            'spip_documents',
53
+            sql_in('mode', ['logoon','logooff','vignette'], 'not'),
54
+            orderby: 'rand()',
55
+            limit: '0,1'
56
+        );
57
+        if (!$id_document) {
58
+            $this->markTestSkipped('Il faut un document');
59
+        }
60
+        $data = [
61
+            'id_article' => -1,
62
+            'titre' => 'test pour doublons_notes.html',
63
+            'statut' => 'prepa',
64
+            'texte' => 'hello [[ xx <doc' . $id_document . '> ]].'
65
+        ];
66
+        $id_article = sql_getfetsel('id_article', 'spip_articles', 'id_article = -1');
67
+        if ($id_article === null) {
68
+            sql_insertq('spip_articles', $data);
69
+        } else {
70
+            sql_updateq('spip_articles', $data, ['id_article = -1']);
71
+        }
72
+        return $id_document;
73
+    }
74 74
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		$id_document = sql_getfetsel(
51 51
 			'id_document',
52 52
 			'spip_documents',
53
-			sql_in('mode', ['logoon','logooff','vignette'], 'not'),
53
+			sql_in('mode', ['logoon', 'logooff', 'vignette'], 'not'),
54 54
 			orderby: 'rand()',
55 55
 			limit: '0,1'
56 56
 		);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			'id_article' => -1,
62 62
 			'titre' => 'test pour doublons_notes.html',
63 63
 			'statut' => 'prepa',
64
-			'texte' => 'hello [[ xx <doc' . $id_document . '> ]].'
64
+			'texte' => 'hello [[ xx <doc'.$id_document.'> ]].'
65 65
 		];
66 66
 		$id_article = sql_getfetsel('id_article', 'spip_articles', 'id_article = -1');
67 67
 		if ($id_article === null) {
Please login to merge, or discard this patch.
ecrire/tests/Squelettes/Critere/OperatorRegexpLikeTest.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -10,83 +10,83 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
ecrire/tests/Squelettes/Filtre/IntroductionTest.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -8,65 +8,65 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.