From 92272ad229d37edd07a086b9f3dc23f87b24f603 Mon Sep 17 00:00:00 2001
From: Matthieu Marcillaud <marcimat@rezo.net>
Date: Tue, 28 May 2024 10:52:40 +0200
Subject: [PATCH] =?UTF-8?q?tests:=20Ajouter=20un=20tests=20d=E2=80=99inser?=
 =?UTF-8?q?tion=20d=E2=80=99attribut=20dans=20IMG=20autre=20que=20alt?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/tests/Filtre/InsererAttributTest.php | 109 ++++++++++++++++++++
 1 file changed, 109 insertions(+)

diff --git a/ecrire/tests/Filtre/InsererAttributTest.php b/ecrire/tests/Filtre/InsererAttributTest.php
index b5c0a37551..6fd0767b7a 100644
--- a/ecrire/tests/Filtre/InsererAttributTest.php
+++ b/ecrire/tests/Filtre/InsererAttributTest.php
@@ -60,6 +60,12 @@ class InsererAttributTest extends TestCase
 		$this->assertSame($expected, $actual);
 	}
 
+	#[DataProvider('providerFiltresInsererAttributLienImgAutres')]
+	public function testFiltresInsererAttributLienImgAutres($expected, ...$args): void {
+		$actual = inserer_attribut(...$args);
+		$this->assertSame($expected, $actual);
+	}
+
 	#[DataProvider('providerFiltresInsererAttributAutres')]
 	public function testFiltresInsererAttributAutres($expected, ...$args): void {
 		$actual = inserer_attribut(...$args);
@@ -753,6 +759,109 @@ paragraphes',
 		];
 	}
 
+	public static function providerFiltresInsererAttributLienImgAutres(): array {
+		return [
+			0 => [
+				0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>",
+				1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>",
+				2 => 'data-truc',
+				3 => '',
+				4 => true,
+				5 => true,
+			],
+			1 => [
+				0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png'></a>",
+				1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png'></a>",
+				2 => 'data-truc',
+				3 => '',
+				4 => true,
+				5 => true,
+			],
+			2 => [
+				0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' data-truc=''></a>",
+				1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png'></a>",
+				2 => 'data-truc',
+				3 => '',
+				4 => true,
+				5 => false,
+			],
+			3 => [
+				0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' data-truc='' /></a>",
+				1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>",
+				2 => 'data-truc',
+				3 => '',
+				4 => true,
+				5 => false,
+			],
+			4 => [
+				0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png'></a>",
+				1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png'></a>",
+				2 => 'data-truc',
+				3 => '',
+				4 => false,
+				5 => true,
+			],
+			5 => [
+				0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>",
+				1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>",
+				2 => 'data-truc',
+				3 => '',
+				4 => false,
+				5 => true,
+			],
+			6 => [
+				0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' data-truc=''></a>",
+				1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png'></a>",
+				2 => 'data-truc',
+				3 => '',
+				4 => false,
+				5 => false,
+			],
+			7 => [
+				0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' data-truc='' /></a>",
+				1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' /></a>",
+				2 => 'data-truc',
+				3 => '',
+				4 => false,
+				5 => false,
+			],
+
+
+			8 => [
+				0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' data-truc='0'></a>",
+				1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png'></a>",
+				2 => 'data-truc',
+				3 => '0',
+				4 => true,
+				5 => true,
+			],
+			9 => [
+				0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' data-truc='0'></a>",
+				1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png'></a>",
+				2 => 'data-truc',
+				3 => '0',
+				4 => true,
+				5 => false,
+			],
+			10 => [
+				0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' data-truc='0'></a>",
+				1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png'></a>",
+				2 => 'data-truc',
+				3 => '0',
+				4 => false,
+				5 => true,
+			],
+			11 => [
+				0 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png' data-truc='0'></a>",
+				1 => "<a href='https://www.spip.net'><img src='https://www.spip.net/IMG/logo/siteon0.png'></a>",
+				2 => 'data-truc',
+				3 => '0',
+				4 => false,
+				5 => false,
+			],
+		];
+	}
+
 	public static function providerFiltresInsererAttributAutres(): array {
 		return [
 			72 => [
-- 
GitLab