Completed
Push — master ( bd2221...312538 )
by cam
01:50
created
ecrire/tests/Squelettes/Critere/DoublonsNotesTest.php 1 patch
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 (int) $id_document;
73
-	}
44
+    /**
45
+     * Creation article de test pour doublons_notes.html
46
+     * On cherche un document, on le met dans la note d'un texte,
47
+     * @return int id_document
48
+     */
49
+    private function creer_article_a_doublons_notes(): int {
50
+        $id_document = sql_getfetsel(
51
+            'id_document',
52
+            'spip_documents',
53
+            sql_in('mode', ['logoon','logooff','vignette'], 'not'),
54
+            orderby: 'rand()',
55
+            limit: '0,1'
56
+        );
57
+        if (!$id_document) {
58
+            $this->markTestSkipped('Il faut un document');
59
+        }
60
+        $data = [
61
+            'id_article' => -1,
62
+            'titre' => 'test pour doublons_notes.html',
63
+            'statut' => 'prepa',
64
+            'texte' => 'hello [[ xx <doc' . $id_document . '> ]].'
65
+        ];
66
+        $id_article = sql_getfetsel('id_article', 'spip_articles', 'id_article = -1');
67
+        if ($id_article === null) {
68
+            sql_insertq('spip_articles', $data);
69
+        } else {
70
+            sql_updateq('spip_articles', $data, ['id_article = -1']);
71
+        }
72
+        return (int) $id_document;
73
+    }
74 74
 }
Please login to merge, or discard this patch.