@@ -13,90 +13,90 @@ |
||
| 13 | 13 | |
| 14 | 14 | class QueryEchappeTextesTest extends TestCase |
| 15 | 15 | { |
| 16 | - public static function setUpBeforeClass(): void { |
|
| 17 | - find_in_path('base/connect_sql.php', '', true); |
|
| 18 | - } |
|
| 16 | + public static function setUpBeforeClass(): void { |
|
| 17 | + find_in_path('base/connect_sql.php', '', true); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - protected function setUp(): void { |
|
| 21 | - query_echappe_textes('', 'uniqid'); |
|
| 22 | - } |
|
| 20 | + protected function setUp(): void { |
|
| 21 | + query_echappe_textes('', 'uniqid'); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - #[DataProvider('providerConnectSqlQueryEchappeTextes')] |
|
| 25 | - public function testConnectSqlQueryEchappeTextes($expected, ...$args): void { |
|
| 26 | - $actual = query_echappe_textes(...$args); |
|
| 27 | - $this->assertSame($expected, $actual); |
|
| 28 | - } |
|
| 24 | + #[DataProvider('providerConnectSqlQueryEchappeTextes')] |
|
| 25 | + public function testConnectSqlQueryEchappeTextes($expected, ...$args): void { |
|
| 26 | + $actual = query_echappe_textes(...$args); |
|
| 27 | + $this->assertSame($expected, $actual); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public static function providerConnectSqlQueryEchappeTextes(): array { |
|
| 31 | - $md5 = substr(md5('uniqid'), 0, 4); |
|
| 32 | - return [ |
|
| 33 | - [ |
|
| 34 | - 0 => ['%1$s', ["'guillemets simples'"]], |
|
| 35 | - 1 => "'guillemets simples'", |
|
| 36 | - ], |
|
| 37 | - [ |
|
| 38 | - 0 => ['%1$s', ['"guillemets doubles"']], |
|
| 39 | - 1 => '"guillemets doubles"', |
|
| 40 | - ], |
|
| 41 | - [ |
|
| 42 | - 0 => ['%1$s,%2$s', ["'guillemets simples 1/2'", "'guillemets simples 2/2'"]], |
|
| 43 | - 1 => "'guillemets simples 1/2','guillemets simples 2/2'", |
|
| 44 | - ], |
|
| 45 | - [ |
|
| 46 | - 0 => ['%1$s,%2$s', ['"guillemets doubles 1/2"', '"guillemets doubles 2/2"']], |
|
| 47 | - 1 => '"guillemets doubles 1/2","guillemets doubles 2/2"', |
|
| 48 | - ], |
|
| 49 | - [ |
|
| 50 | - 0 => ['%1$s', ["'guillemets simples \x02@#{$md5}#@\x02 avec un echappement'"]], |
|
| 51 | - 1 => "'guillemets simples \\' avec un echappement'", |
|
| 52 | - ], |
|
| 53 | - [ |
|
| 54 | - 0 => ['%1$s', ["\"guillemets doubles \x03@#{$md5}#@\x03 avec un echappement\""]], |
|
| 55 | - 1 => '"guillemets doubles \\" avec un echappement"', |
|
| 56 | - ], |
|
| 57 | - [ |
|
| 58 | - 0 => ['%1$s', ["'guillemets simples \x02@#{$md5}#@\x02\x03@#{$md5}#@\x03 avec deux echappements'"]], |
|
| 59 | - 1 => "'guillemets simples \\'\\\" avec deux echappements'", |
|
| 60 | - ], |
|
| 61 | - [ |
|
| 62 | - 0 => ['%1$s', ["\"guillemets doubles \x02@#{$md5}#@\x02\x03@#{$md5}#@\x03 avec deux echappements\""]], |
|
| 63 | - 1 => "\"guillemets doubles \\'\\\" avec deux echappements\"", |
|
| 64 | - ], |
|
| 65 | - [ |
|
| 66 | - 0 => ['%1$s', ["'guillemet double \" dans guillemets simples'"]], |
|
| 67 | - 1 => "'guillemet double \" dans guillemets simples'", |
|
| 68 | - ], |
|
| 69 | - [ |
|
| 70 | - 0 => ['%1$s', ["\"guillemet simple ' dans guillemets doubles\""]], |
|
| 71 | - 1 => "\"guillemet simple ' dans guillemets doubles\"", |
|
| 72 | - ], |
|
| 73 | - // sortie de sqlitemanager firefox |
|
| 74 | - // (description de table suite a import d'une table au format xml/phpmyadmin v5) |
|
| 75 | - [ |
|
| 76 | - 0 => ['%1$s INTEGER,%2$s VARCHAR', ['"id_objet"', '"objet"']], |
|
| 77 | - 1 => '"id_objet" INTEGER,"objet" VARCHAR', |
|
| 78 | - ], |
|
| 79 | - [ |
|
| 80 | - 0 => [ |
|
| 81 | - 'UPDATE spip_truc SET html=%1$s WHERE id_truc=1', |
|
| 82 | - ["'''0'' style=''margin: 0;padding: 0;width: 100\x04@#{$md5}#@\x04;border: 0;height: auto;lin'"], |
|
| 83 | - ], |
|
| 84 | - 1 => "UPDATE spip_truc SET html='''0'' style=''margin: 0;padding: 0;width: 100%;border: 0;height: auto;lin' WHERE id_truc=1", |
|
| 85 | - ], |
|
| 86 | - [ |
|
| 87 | - 0 => [ |
|
| 88 | - 'UPDATE spip_truc SET html=%1$s, texte=%2$s WHERE id_truc=1', |
|
| 89 | - ["'''0'' style=''margin: 0;padding: 0;width: 100\x04@#{$md5}#@\x04;border: 0;height: auto;lin'", "'toto'"], |
|
| 90 | - ], |
|
| 91 | - 1 => "UPDATE spip_truc SET html='''0'' style=''margin: 0;padding: 0;width: 100%;border: 0;height: auto;lin', texte='toto' WHERE id_truc=1", |
|
| 92 | - ], |
|
| 93 | - [ |
|
| 94 | - 0 => [ |
|
| 95 | - 'UPDATE spip_truc SET texte=%1$s, html=%2$s WHERE id_truc=1', |
|
| 96 | - ["''", "'''0'' style=''margin: 0;padding: 0;width: 100\x04@#{$md5}#@\x04;border: 0;height: auto;lin'"], |
|
| 97 | - ], |
|
| 98 | - 1 => "UPDATE spip_truc SET texte='', html='''0'' style=''margin: 0;padding: 0;width: 100%;border: 0;height: auto;lin' WHERE id_truc=1", |
|
| 99 | - ], |
|
| 100 | - ]; |
|
| 101 | - } |
|
| 30 | + public static function providerConnectSqlQueryEchappeTextes(): array { |
|
| 31 | + $md5 = substr(md5('uniqid'), 0, 4); |
|
| 32 | + return [ |
|
| 33 | + [ |
|
| 34 | + 0 => ['%1$s', ["'guillemets simples'"]], |
|
| 35 | + 1 => "'guillemets simples'", |
|
| 36 | + ], |
|
| 37 | + [ |
|
| 38 | + 0 => ['%1$s', ['"guillemets doubles"']], |
|
| 39 | + 1 => '"guillemets doubles"', |
|
| 40 | + ], |
|
| 41 | + [ |
|
| 42 | + 0 => ['%1$s,%2$s', ["'guillemets simples 1/2'", "'guillemets simples 2/2'"]], |
|
| 43 | + 1 => "'guillemets simples 1/2','guillemets simples 2/2'", |
|
| 44 | + ], |
|
| 45 | + [ |
|
| 46 | + 0 => ['%1$s,%2$s', ['"guillemets doubles 1/2"', '"guillemets doubles 2/2"']], |
|
| 47 | + 1 => '"guillemets doubles 1/2","guillemets doubles 2/2"', |
|
| 48 | + ], |
|
| 49 | + [ |
|
| 50 | + 0 => ['%1$s', ["'guillemets simples \x02@#{$md5}#@\x02 avec un echappement'"]], |
|
| 51 | + 1 => "'guillemets simples \\' avec un echappement'", |
|
| 52 | + ], |
|
| 53 | + [ |
|
| 54 | + 0 => ['%1$s', ["\"guillemets doubles \x03@#{$md5}#@\x03 avec un echappement\""]], |
|
| 55 | + 1 => '"guillemets doubles \\" avec un echappement"', |
|
| 56 | + ], |
|
| 57 | + [ |
|
| 58 | + 0 => ['%1$s', ["'guillemets simples \x02@#{$md5}#@\x02\x03@#{$md5}#@\x03 avec deux echappements'"]], |
|
| 59 | + 1 => "'guillemets simples \\'\\\" avec deux echappements'", |
|
| 60 | + ], |
|
| 61 | + [ |
|
| 62 | + 0 => ['%1$s', ["\"guillemets doubles \x02@#{$md5}#@\x02\x03@#{$md5}#@\x03 avec deux echappements\""]], |
|
| 63 | + 1 => "\"guillemets doubles \\'\\\" avec deux echappements\"", |
|
| 64 | + ], |
|
| 65 | + [ |
|
| 66 | + 0 => ['%1$s', ["'guillemet double \" dans guillemets simples'"]], |
|
| 67 | + 1 => "'guillemet double \" dans guillemets simples'", |
|
| 68 | + ], |
|
| 69 | + [ |
|
| 70 | + 0 => ['%1$s', ["\"guillemet simple ' dans guillemets doubles\""]], |
|
| 71 | + 1 => "\"guillemet simple ' dans guillemets doubles\"", |
|
| 72 | + ], |
|
| 73 | + // sortie de sqlitemanager firefox |
|
| 74 | + // (description de table suite a import d'une table au format xml/phpmyadmin v5) |
|
| 75 | + [ |
|
| 76 | + 0 => ['%1$s INTEGER,%2$s VARCHAR', ['"id_objet"', '"objet"']], |
|
| 77 | + 1 => '"id_objet" INTEGER,"objet" VARCHAR', |
|
| 78 | + ], |
|
| 79 | + [ |
|
| 80 | + 0 => [ |
|
| 81 | + 'UPDATE spip_truc SET html=%1$s WHERE id_truc=1', |
|
| 82 | + ["'''0'' style=''margin: 0;padding: 0;width: 100\x04@#{$md5}#@\x04;border: 0;height: auto;lin'"], |
|
| 83 | + ], |
|
| 84 | + 1 => "UPDATE spip_truc SET html='''0'' style=''margin: 0;padding: 0;width: 100%;border: 0;height: auto;lin' WHERE id_truc=1", |
|
| 85 | + ], |
|
| 86 | + [ |
|
| 87 | + 0 => [ |
|
| 88 | + 'UPDATE spip_truc SET html=%1$s, texte=%2$s WHERE id_truc=1', |
|
| 89 | + ["'''0'' style=''margin: 0;padding: 0;width: 100\x04@#{$md5}#@\x04;border: 0;height: auto;lin'", "'toto'"], |
|
| 90 | + ], |
|
| 91 | + 1 => "UPDATE spip_truc SET html='''0'' style=''margin: 0;padding: 0;width: 100%;border: 0;height: auto;lin', texte='toto' WHERE id_truc=1", |
|
| 92 | + ], |
|
| 93 | + [ |
|
| 94 | + 0 => [ |
|
| 95 | + 'UPDATE spip_truc SET texte=%1$s, html=%2$s WHERE id_truc=1', |
|
| 96 | + ["''", "'''0'' style=''margin: 0;padding: 0;width: 100\x04@#{$md5}#@\x04;border: 0;height: auto;lin'"], |
|
| 97 | + ], |
|
| 98 | + 1 => "UPDATE spip_truc SET texte='', html='''0'' style=''margin: 0;padding: 0;width: 100%;border: 0;height: auto;lin' WHERE id_truc=1", |
|
| 99 | + ], |
|
| 100 | + ]; |
|
| 101 | + } |
|
| 102 | 102 | } |
@@ -9,186 +9,186 @@ |
||
| 9 | 9 | |
| 10 | 10 | class SqlInSqliteTest extends TestCase |
| 11 | 11 | { |
| 12 | - public static function setUpBeforeClass(): void { |
|
| 13 | - find_in_path('base/abstract_sql.php', '', true); |
|
| 14 | - } |
|
| 12 | + public static function setUpBeforeClass(): void { |
|
| 13 | + find_in_path('base/abstract_sql.php', '', true); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - protected function setUp(): void { |
|
| 17 | - if ($this->getSqlType() !== 'sqlite3') { |
|
| 18 | - $this->markTestSkipped('Needs a Sqlite database'); |
|
| 19 | - } |
|
| 20 | - } |
|
| 16 | + protected function setUp(): void { |
|
| 17 | + if ($this->getSqlType() !== 'sqlite3') { |
|
| 18 | + $this->markTestSkipped('Needs a Sqlite database'); |
|
| 19 | + } |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - #[DataProvider('providerSqliteSqliIn')] |
|
| 23 | - public function testSqliteSqlIn($expected, ...$args): void { |
|
| 24 | - $this->assertEquals($expected, sql_in(...$args)); |
|
| 25 | - } |
|
| 22 | + #[DataProvider('providerSqliteSqliIn')] |
|
| 23 | + public function testSqliteSqlIn($expected, ...$args): void { |
|
| 24 | + $this->assertEquals($expected, sql_in(...$args)); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public static function providerSqliteSqliIn(): array { |
|
| 28 | - return [ |
|
| 29 | - 0 => |
|
| 30 | - [ |
|
| 31 | - 0 => '(id_rubrique IN (1,2,3))', |
|
| 32 | - 1 => 'id_rubrique', |
|
| 33 | - 2 => '1,2,3', |
|
| 34 | - ], |
|
| 35 | - 1 => |
|
| 36 | - [ |
|
| 37 | - 0 => '(id_rubrique IN (1,2,3))', |
|
| 38 | - 1 => 'id_rubrique', |
|
| 39 | - 2 => |
|
| 40 | - [ |
|
| 41 | - 0 => 1, |
|
| 42 | - 1 => 2, |
|
| 43 | - 2 => 3, |
|
| 44 | - ], |
|
| 45 | - ], |
|
| 46 | - 2 => |
|
| 47 | - [ |
|
| 48 | - 0 => '(id_rubrique NOT IN (1,2,3))', |
|
| 49 | - 1 => 'id_rubrique', |
|
| 50 | - 2 => '1,2,3', |
|
| 51 | - 3 => 'NOT', |
|
| 52 | - ], |
|
| 53 | - 3 => |
|
| 54 | - [ |
|
| 55 | - 0 => '(id_rubrique NOT IN (1,2,3))', |
|
| 56 | - 1 => 'id_rubrique', |
|
| 57 | - 2 => |
|
| 58 | - [ |
|
| 59 | - 0 => 1, |
|
| 60 | - 1 => 2, |
|
| 61 | - 2 => 3, |
|
| 62 | - ], |
|
| 63 | - 3 => 'NOT', |
|
| 64 | - ], |
|
| 65 | - 4 => |
|
| 66 | - [ |
|
| 67 | - 0 => '0=1', |
|
| 68 | - 1 => 'id_rubrique', |
|
| 69 | - 2 => |
|
| 70 | - [], |
|
| 71 | - ], |
|
| 72 | - 5 => |
|
| 73 | - [ |
|
| 74 | - 0 => '(id_rubrique IN (\'\',0,\'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net\',\'Un texte avec des entités &<>"\',\'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;\',\'Un texte avec des entités numériques &<>"\',\'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;\',\'Un texte sans entites &<>"\'\'\',\'{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>\',\'Un modele <modeleinexistant|lien=[->https://www.spip.net]>\',\'Un texte avec des retour |
|
| 27 | + public static function providerSqliteSqliIn(): array { |
|
| 28 | + return [ |
|
| 29 | + 0 => |
|
| 30 | + [ |
|
| 31 | + 0 => '(id_rubrique IN (1,2,3))', |
|
| 32 | + 1 => 'id_rubrique', |
|
| 33 | + 2 => '1,2,3', |
|
| 34 | + ], |
|
| 35 | + 1 => |
|
| 36 | + [ |
|
| 37 | + 0 => '(id_rubrique IN (1,2,3))', |
|
| 38 | + 1 => 'id_rubrique', |
|
| 39 | + 2 => |
|
| 40 | + [ |
|
| 41 | + 0 => 1, |
|
| 42 | + 1 => 2, |
|
| 43 | + 2 => 3, |
|
| 44 | + ], |
|
| 45 | + ], |
|
| 46 | + 2 => |
|
| 47 | + [ |
|
| 48 | + 0 => '(id_rubrique NOT IN (1,2,3))', |
|
| 49 | + 1 => 'id_rubrique', |
|
| 50 | + 2 => '1,2,3', |
|
| 51 | + 3 => 'NOT', |
|
| 52 | + ], |
|
| 53 | + 3 => |
|
| 54 | + [ |
|
| 55 | + 0 => '(id_rubrique NOT IN (1,2,3))', |
|
| 56 | + 1 => 'id_rubrique', |
|
| 57 | + 2 => |
|
| 58 | + [ |
|
| 59 | + 0 => 1, |
|
| 60 | + 1 => 2, |
|
| 61 | + 2 => 3, |
|
| 62 | + ], |
|
| 63 | + 3 => 'NOT', |
|
| 64 | + ], |
|
| 65 | + 4 => |
|
| 66 | + [ |
|
| 67 | + 0 => '0=1', |
|
| 68 | + 1 => 'id_rubrique', |
|
| 69 | + 2 => |
|
| 70 | + [], |
|
| 71 | + ], |
|
| 72 | + 5 => |
|
| 73 | + [ |
|
| 74 | + 0 => '(id_rubrique IN (\'\',0,\'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net\',\'Un texte avec des entités &<>"\',\'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;\',\'Un texte avec des entités numériques &<>"\',\'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;\',\'Un texte sans entites &<>"\'\'\',\'{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>\',\'Un modele <modeleinexistant|lien=[->https://www.spip.net]>\',\'Un texte avec des retour |
|
| 75 | 75 | a la ligne et meme des |
| 76 | 76 | |
| 77 | 77 | paragraphes\'))', |
| 78 | - 1 => 'id_rubrique', |
|
| 79 | - 2 => |
|
| 80 | - [ |
|
| 81 | - 0 => '', |
|
| 82 | - 1 => '0', |
|
| 83 | - 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', |
|
| 84 | - 3 => 'Un texte avec des entités &<>"', |
|
| 85 | - 4 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', |
|
| 86 | - 5 => 'Un texte avec des entités numériques &<>"', |
|
| 87 | - 6 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', |
|
| 88 | - 7 => 'Un texte sans entites &<>"\'', |
|
| 89 | - 8 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', |
|
| 90 | - 9 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', |
|
| 91 | - 10 => 'Un texte avec des retour |
|
| 78 | + 1 => 'id_rubrique', |
|
| 79 | + 2 => |
|
| 80 | + [ |
|
| 81 | + 0 => '', |
|
| 82 | + 1 => '0', |
|
| 83 | + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', |
|
| 84 | + 3 => 'Un texte avec des entités &<>"', |
|
| 85 | + 4 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', |
|
| 86 | + 5 => 'Un texte avec des entités numériques &<>"', |
|
| 87 | + 6 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', |
|
| 88 | + 7 => 'Un texte sans entites &<>"\'', |
|
| 89 | + 8 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', |
|
| 90 | + 9 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', |
|
| 91 | + 10 => 'Un texte avec des retour |
|
| 92 | 92 | a la ligne et meme des |
| 93 | 93 | |
| 94 | 94 | paragraphes', |
| 95 | - ], |
|
| 96 | - ], |
|
| 97 | - 6 => |
|
| 98 | - [ |
|
| 99 | - 0 => '(id_rubrique IN (0,-1,1,2,3,4,5,6,7,10,20,30,50,100,1000,10000))', |
|
| 100 | - 1 => 'id_rubrique', |
|
| 101 | - 2 => |
|
| 102 | - [ |
|
| 103 | - 0 => 0, |
|
| 104 | - 1 => -1, |
|
| 105 | - 2 => 1, |
|
| 106 | - 3 => 2, |
|
| 107 | - 4 => 3, |
|
| 108 | - 5 => 4, |
|
| 109 | - 6 => 5, |
|
| 110 | - 7 => 6, |
|
| 111 | - 8 => 7, |
|
| 112 | - 9 => 10, |
|
| 113 | - 10 => 20, |
|
| 114 | - 11 => 30, |
|
| 115 | - 12 => 50, |
|
| 116 | - 13 => 100, |
|
| 117 | - 14 => 1000, |
|
| 118 | - 15 => 10000, |
|
| 119 | - ], |
|
| 120 | - ], |
|
| 121 | - 7 => |
|
| 122 | - [ |
|
| 123 | - 0 => '0=1', |
|
| 124 | - 1 => 'id_rubrique', |
|
| 125 | - 2 => |
|
| 126 | - [ |
|
| 127 | - 0 => |
|
| 128 | - [], |
|
| 129 | - 1 => |
|
| 130 | - [ |
|
| 131 | - 0 => '', |
|
| 132 | - 1 => '0', |
|
| 133 | - 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', |
|
| 134 | - 3 => 'Un texte avec des entités &<>"', |
|
| 135 | - 4 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', |
|
| 136 | - 5 => 'Un texte avec des entités numériques &<>"', |
|
| 137 | - 6 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', |
|
| 138 | - 7 => 'Un texte sans entites &<>"\'', |
|
| 139 | - 8 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', |
|
| 140 | - 9 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', |
|
| 141 | - 10 => 'Un texte avec des retour |
|
| 95 | + ], |
|
| 96 | + ], |
|
| 97 | + 6 => |
|
| 98 | + [ |
|
| 99 | + 0 => '(id_rubrique IN (0,-1,1,2,3,4,5,6,7,10,20,30,50,100,1000,10000))', |
|
| 100 | + 1 => 'id_rubrique', |
|
| 101 | + 2 => |
|
| 102 | + [ |
|
| 103 | + 0 => 0, |
|
| 104 | + 1 => -1, |
|
| 105 | + 2 => 1, |
|
| 106 | + 3 => 2, |
|
| 107 | + 4 => 3, |
|
| 108 | + 5 => 4, |
|
| 109 | + 6 => 5, |
|
| 110 | + 7 => 6, |
|
| 111 | + 8 => 7, |
|
| 112 | + 9 => 10, |
|
| 113 | + 10 => 20, |
|
| 114 | + 11 => 30, |
|
| 115 | + 12 => 50, |
|
| 116 | + 13 => 100, |
|
| 117 | + 14 => 1000, |
|
| 118 | + 15 => 10000, |
|
| 119 | + ], |
|
| 120 | + ], |
|
| 121 | + 7 => |
|
| 122 | + [ |
|
| 123 | + 0 => '0=1', |
|
| 124 | + 1 => 'id_rubrique', |
|
| 125 | + 2 => |
|
| 126 | + [ |
|
| 127 | + 0 => |
|
| 128 | + [], |
|
| 129 | + 1 => |
|
| 130 | + [ |
|
| 131 | + 0 => '', |
|
| 132 | + 1 => '0', |
|
| 133 | + 2 => 'Un texte avec des <a href="http://spip.net">liens</a> [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', |
|
| 134 | + 3 => 'Un texte avec des entités &<>"', |
|
| 135 | + 4 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', |
|
| 136 | + 5 => 'Un texte avec des entités numériques &<>"', |
|
| 137 | + 6 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', |
|
| 138 | + 7 => 'Un texte sans entites &<>"\'', |
|
| 139 | + 8 => '{{{Des raccourcis}}} {italique} {{gras}} <code>du code</code>', |
|
| 140 | + 9 => 'Un modele <modeleinexistant|lien=[->https://www.spip.net]>', |
|
| 141 | + 10 => 'Un texte avec des retour |
|
| 142 | 142 | a la ligne et meme des |
| 143 | 143 | |
| 144 | 144 | paragraphes', |
| 145 | - ], |
|
| 146 | - 2 => |
|
| 147 | - [ |
|
| 148 | - 0 => 0, |
|
| 149 | - 1 => -1, |
|
| 150 | - 2 => 1, |
|
| 151 | - 3 => 2, |
|
| 152 | - 4 => 3, |
|
| 153 | - 5 => 4, |
|
| 154 | - 6 => 5, |
|
| 155 | - 7 => 6, |
|
| 156 | - 8 => 7, |
|
| 157 | - 9 => 10, |
|
| 158 | - 10 => 20, |
|
| 159 | - 11 => 30, |
|
| 160 | - 12 => 50, |
|
| 161 | - 13 => 100, |
|
| 162 | - 14 => 1000, |
|
| 163 | - 15 => 10000, |
|
| 164 | - ], |
|
| 165 | - 3 => |
|
| 166 | - [ |
|
| 167 | - 0 => true, |
|
| 168 | - 1 => false, |
|
| 169 | - ], |
|
| 170 | - ], |
|
| 171 | - ], |
|
| 172 | - 8 => |
|
| 173 | - [ |
|
| 174 | - 0 => '(id_rubrique IN (2))', |
|
| 175 | - 1 => 'id_rubrique', |
|
| 176 | - 2 => 2, |
|
| 177 | - ], |
|
| 178 | - 9 => |
|
| 179 | - [ |
|
| 180 | - 0 => '(id_rubrique IN (1,0))', |
|
| 181 | - 1 => 'id_rubrique', |
|
| 182 | - 2 => |
|
| 183 | - [ |
|
| 184 | - 0 => true, |
|
| 185 | - 1 => false, |
|
| 186 | - ], |
|
| 187 | - ], |
|
| 188 | - ]; |
|
| 189 | - } |
|
| 145 | + ], |
|
| 146 | + 2 => |
|
| 147 | + [ |
|
| 148 | + 0 => 0, |
|
| 149 | + 1 => -1, |
|
| 150 | + 2 => 1, |
|
| 151 | + 3 => 2, |
|
| 152 | + 4 => 3, |
|
| 153 | + 5 => 4, |
|
| 154 | + 6 => 5, |
|
| 155 | + 7 => 6, |
|
| 156 | + 8 => 7, |
|
| 157 | + 9 => 10, |
|
| 158 | + 10 => 20, |
|
| 159 | + 11 => 30, |
|
| 160 | + 12 => 50, |
|
| 161 | + 13 => 100, |
|
| 162 | + 14 => 1000, |
|
| 163 | + 15 => 10000, |
|
| 164 | + ], |
|
| 165 | + 3 => |
|
| 166 | + [ |
|
| 167 | + 0 => true, |
|
| 168 | + 1 => false, |
|
| 169 | + ], |
|
| 170 | + ], |
|
| 171 | + ], |
|
| 172 | + 8 => |
|
| 173 | + [ |
|
| 174 | + 0 => '(id_rubrique IN (2))', |
|
| 175 | + 1 => 'id_rubrique', |
|
| 176 | + 2 => 2, |
|
| 177 | + ], |
|
| 178 | + 9 => |
|
| 179 | + [ |
|
| 180 | + 0 => '(id_rubrique IN (1,0))', |
|
| 181 | + 1 => 'id_rubrique', |
|
| 182 | + 2 => |
|
| 183 | + [ |
|
| 184 | + 0 => true, |
|
| 185 | + 1 => false, |
|
| 186 | + ], |
|
| 187 | + ], |
|
| 188 | + ]; |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | - private function getSqlType(): string { |
|
| 192 | - return $GLOBALS['connexions'][0]['type'] ?? ''; |
|
| 193 | - } |
|
| 191 | + private function getSqlType(): string { |
|
| 192 | + return $GLOBALS['connexions'][0]['type'] ?? ''; |
|
| 193 | + } |
|
| 194 | 194 | } |
@@ -13,42 +13,42 @@ |
||
| 13 | 13 | |
| 14 | 14 | class UrlToAsciiTest extends TestCase |
| 15 | 15 | { |
| 16 | - public static function setUpBeforeClass(): void { |
|
| 17 | - find_in_path('./inc/distant.php', '', true); |
|
| 18 | - } |
|
| 16 | + public static function setUpBeforeClass(): void { |
|
| 17 | + find_in_path('./inc/distant.php', '', true); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - #[DataProvider('providerDistantUrlToAscii')] |
|
| 21 | - public function testDistantUrlToAscii($expected, ...$args): void { |
|
| 22 | - $actual = url_to_ascii(...$args); |
|
| 23 | - $this->assertSame($expected, $actual); |
|
| 24 | - } |
|
| 20 | + #[DataProvider('providerDistantUrlToAscii')] |
|
| 21 | + public function testDistantUrlToAscii($expected, ...$args): void { |
|
| 22 | + $actual = url_to_ascii(...$args); |
|
| 23 | + $this->assertSame($expected, $actual); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public static function providerDistantUrlToAscii(): array { |
|
| 27 | - return [ |
|
| 28 | - 0 => [ |
|
| 29 | - 0 => 'http://www.spip.net/', |
|
| 30 | - 1 => 'http://www.spip.net/', |
|
| 31 | - ], |
|
| 32 | - 1 => [ |
|
| 33 | - 0 => 'http://www.spip.net/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 34 | - 1 => 'http://www.spip.net/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 35 | - ], |
|
| 36 | - 2 => [ |
|
| 37 | - 0 => 'http://user:[email protected]:80/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 38 | - 1 => 'http://user:[email protected]:80/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 39 | - ], |
|
| 40 | - 3 => [ |
|
| 41 | - 0 => 'http://www.xn--spap-7pa.net/', |
|
| 42 | - 1 => 'http://www.spaïp.net/', |
|
| 43 | - ], |
|
| 44 | - 4 => [ |
|
| 45 | - 0 => 'http://www.xn--spap-7pa.net/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 46 | - 1 => 'http://www.spaïp.net/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 47 | - ], |
|
| 48 | - 5 => [ |
|
| 49 | - 0 => 'http://user:[email protected]:80/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 50 | - 1 => 'http://user:[email protected]ïp.net:80/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 51 | - ], |
|
| 52 | - ]; |
|
| 53 | - } |
|
| 26 | + public static function providerDistantUrlToAscii(): array { |
|
| 27 | + return [ |
|
| 28 | + 0 => [ |
|
| 29 | + 0 => 'http://www.spip.net/', |
|
| 30 | + 1 => 'http://www.spip.net/', |
|
| 31 | + ], |
|
| 32 | + 1 => [ |
|
| 33 | + 0 => 'http://www.spip.net/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 34 | + 1 => 'http://www.spip.net/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 35 | + ], |
|
| 36 | + 2 => [ |
|
| 37 | + 0 => 'http://user:[email protected]:80/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 38 | + 1 => 'http://user:[email protected]:80/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 39 | + ], |
|
| 40 | + 3 => [ |
|
| 41 | + 0 => 'http://www.xn--spap-7pa.net/', |
|
| 42 | + 1 => 'http://www.spaïp.net/', |
|
| 43 | + ], |
|
| 44 | + 4 => [ |
|
| 45 | + 0 => 'http://www.xn--spap-7pa.net/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 46 | + 1 => 'http://www.spaïp.net/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 47 | + ], |
|
| 48 | + 5 => [ |
|
| 49 | + 0 => 'http://user:[email protected]:80/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 50 | + 1 => 'http://user:[email protected]ïp.net:80/fr_article879.html#BOUCLE-ARTICLES-', |
|
| 51 | + ], |
|
| 52 | + ]; |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -13,49 +13,49 @@ |
||
| 13 | 13 | |
| 14 | 14 | class NeedProxyTest extends TestCase |
| 15 | 15 | { |
| 16 | - public static function setUpBeforeClass(): void { |
|
| 17 | - find_in_path('./inc/distant.php', '', true); |
|
| 18 | - } |
|
| 16 | + public static function setUpBeforeClass(): void { |
|
| 17 | + find_in_path('./inc/distant.php', '', true); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - #[DataProvider('providerDistantNeedProxy')] |
|
| 21 | - public function testDistantNeedProxy($expected, ...$args): void { |
|
| 22 | - $actual = need_proxy(...$args); |
|
| 23 | - $this->assertSame($expected, $actual); |
|
| 24 | - } |
|
| 20 | + #[DataProvider('providerDistantNeedProxy')] |
|
| 21 | + public function testDistantNeedProxy($expected, ...$args): void { |
|
| 22 | + $actual = need_proxy(...$args); |
|
| 23 | + $this->assertSame($expected, $actual); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public static function providerDistantNeedProxy(): array { |
|
| 27 | - return [ |
|
| 28 | - 0 => [ |
|
| 29 | - 0 => 'http://monproxy.example.org', |
|
| 30 | - 1 => 'sous.domaine.spip.net', |
|
| 31 | - 2 => 'http://monproxy.example.org', |
|
| 32 | - 3 => 'spip.net', |
|
| 33 | - ], |
|
| 34 | - 1 => [ |
|
| 35 | - 0 => '', |
|
| 36 | - 1 => 'sous.domaine.spip.net', |
|
| 37 | - 2 => 'http://monproxy.example.org', |
|
| 38 | - 3 => '.spip.net', |
|
| 39 | - ], |
|
| 40 | - 2 => [ |
|
| 41 | - 0 => '', |
|
| 42 | - 1 => 'sous.domaine.spip.net', |
|
| 43 | - 2 => 'http://monproxy.example.org', |
|
| 44 | - 3 => '.spip.net |
|
| 26 | + public static function providerDistantNeedProxy(): array { |
|
| 27 | + return [ |
|
| 28 | + 0 => [ |
|
| 29 | + 0 => 'http://monproxy.example.org', |
|
| 30 | + 1 => 'sous.domaine.spip.net', |
|
| 31 | + 2 => 'http://monproxy.example.org', |
|
| 32 | + 3 => 'spip.net', |
|
| 33 | + ], |
|
| 34 | + 1 => [ |
|
| 35 | + 0 => '', |
|
| 36 | + 1 => 'sous.domaine.spip.net', |
|
| 37 | + 2 => 'http://monproxy.example.org', |
|
| 38 | + 3 => '.spip.net', |
|
| 39 | + ], |
|
| 40 | + 2 => [ |
|
| 41 | + 0 => '', |
|
| 42 | + 1 => 'sous.domaine.spip.net', |
|
| 43 | + 2 => 'http://monproxy.example.org', |
|
| 44 | + 3 => '.spip.net |
|
| 45 | 45 | .net', |
| 46 | - ], |
|
| 47 | - 3 => [ |
|
| 48 | - 0 => '', |
|
| 49 | - 1 => 'sous.domaine.spip.net', |
|
| 50 | - 2 => 'http://monproxy.example.org', |
|
| 51 | - 3 => 'sous.domaine.spip.net', |
|
| 52 | - ], |
|
| 53 | - 4 => [ |
|
| 54 | - 0 => 'http://monproxy.example.org', |
|
| 55 | - 1 => 'sous.domaine.spip.net', |
|
| 56 | - 2 => 'http://monproxy.example.org', |
|
| 57 | - 3 => '.sous.domaine.spip.net', |
|
| 58 | - ], |
|
| 59 | - ]; |
|
| 60 | - } |
|
| 46 | + ], |
|
| 47 | + 3 => [ |
|
| 48 | + 0 => '', |
|
| 49 | + 1 => 'sous.domaine.spip.net', |
|
| 50 | + 2 => 'http://monproxy.example.org', |
|
| 51 | + 3 => 'sous.domaine.spip.net', |
|
| 52 | + ], |
|
| 53 | + 4 => [ |
|
| 54 | + 0 => 'http://monproxy.example.org', |
|
| 55 | + 1 => 'sous.domaine.spip.net', |
|
| 56 | + 2 => 'http://monproxy.example.org', |
|
| 57 | + 3 => '.sous.domaine.spip.net', |
|
| 58 | + ], |
|
| 59 | + ]; |
|
| 60 | + } |
|
| 61 | 61 | } |
@@ -13,71 +13,71 @@ |
||
| 13 | 13 | |
| 14 | 14 | class ValiderUrlDistanteTest extends TestCase |
| 15 | 15 | { |
| 16 | - public static function setUpBeforeClass(): void { |
|
| 17 | - find_in_path('./inc/distant.php', '', true); |
|
| 18 | - } |
|
| 16 | + public static function setUpBeforeClass(): void { |
|
| 17 | + find_in_path('./inc/distant.php', '', true); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - #[DataProvider('providerDistantValiderUrlDistante')] |
|
| 21 | - public function testDistantValiderUrlDistante($expected, ...$args): void { |
|
| 22 | - $actual = valider_url_distante(...$args); |
|
| 23 | - $this->assertSame($expected, $actual); |
|
| 24 | - } |
|
| 20 | + #[DataProvider('providerDistantValiderUrlDistante')] |
|
| 21 | + public function testDistantValiderUrlDistante($expected, ...$args): void { |
|
| 22 | + $actual = valider_url_distante(...$args); |
|
| 23 | + $this->assertSame($expected, $actual); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public static function providerDistantValiderUrlDistante(): array { |
|
| 27 | - return [ |
|
| 28 | - 0 => [ |
|
| 29 | - 0 => 'http://www.spip.net', |
|
| 30 | - 1 => 'http://www.spip.net', |
|
| 31 | - ], |
|
| 32 | - 1 => [ |
|
| 33 | - 0 => 'https://www.spip.net', |
|
| 34 | - 1 => 'https://www.spip.net', |
|
| 35 | - ], |
|
| 36 | - 2 => [ |
|
| 37 | - 0 => false, |
|
| 38 | - 1 => 'ftp://www.spip.net', |
|
| 39 | - ], |
|
| 40 | - 3 => [ |
|
| 41 | - 0 => false, |
|
| 42 | - 1 => 'http://[email protected]', |
|
| 43 | - ], |
|
| 44 | - 4 => [ |
|
| 45 | - 0 => false, |
|
| 46 | - 1 => 'https://user:[email protected]', |
|
| 47 | - ], |
|
| 48 | - 5 => [ |
|
| 49 | - 0 => false, |
|
| 50 | - 1 => 'http://127.0.0.1/munin/graph.png', |
|
| 51 | - ], |
|
| 52 | - 6 => [ |
|
| 53 | - 0 => false, |
|
| 54 | - 1 => 'http://localhost:8765', |
|
| 55 | - ], |
|
| 56 | - 7 => [ |
|
| 57 | - 0 => 'http://localhost:8765/test.png', |
|
| 58 | - 1 => 'http://localhost:8765/test.png', |
|
| 59 | - 2 => [ |
|
| 60 | - 0 => 'localhost:8765', |
|
| 61 | - ], |
|
| 62 | - ], |
|
| 63 | - 8 => [ |
|
| 64 | - 0 => false, |
|
| 65 | - 1 => 'http://localhost:9100/test.png', |
|
| 66 | - ], |
|
| 67 | - 9 => [ |
|
| 68 | - 0 => false, |
|
| 69 | - 1 => 'http://user@password:localhost:8765/test.png', |
|
| 70 | - 2 => [ |
|
| 71 | - 0 => 'localhost:8765', |
|
| 72 | - ], |
|
| 73 | - ], |
|
| 74 | - 10 => [ |
|
| 75 | - 0 => false, |
|
| 76 | - 1 => 'http://user@password:localhost:8765/test.png', |
|
| 77 | - 2 => [ |
|
| 78 | - 0 => 'http://user@password:localhost:8765', |
|
| 79 | - ], |
|
| 80 | - ], |
|
| 81 | - ]; |
|
| 82 | - } |
|
| 26 | + public static function providerDistantValiderUrlDistante(): array { |
|
| 27 | + return [ |
|
| 28 | + 0 => [ |
|
| 29 | + 0 => 'http://www.spip.net', |
|
| 30 | + 1 => 'http://www.spip.net', |
|
| 31 | + ], |
|
| 32 | + 1 => [ |
|
| 33 | + 0 => 'https://www.spip.net', |
|
| 34 | + 1 => 'https://www.spip.net', |
|
| 35 | + ], |
|
| 36 | + 2 => [ |
|
| 37 | + 0 => false, |
|
| 38 | + 1 => 'ftp://www.spip.net', |
|
| 39 | + ], |
|
| 40 | + 3 => [ |
|
| 41 | + 0 => false, |
|
| 42 | + 1 => 'http://[email protected]', |
|
| 43 | + ], |
|
| 44 | + 4 => [ |
|
| 45 | + 0 => false, |
|
| 46 | + 1 => 'https://user:[email protected]', |
|
| 47 | + ], |
|
| 48 | + 5 => [ |
|
| 49 | + 0 => false, |
|
| 50 | + 1 => 'http://127.0.0.1/munin/graph.png', |
|
| 51 | + ], |
|
| 52 | + 6 => [ |
|
| 53 | + 0 => false, |
|
| 54 | + 1 => 'http://localhost:8765', |
|
| 55 | + ], |
|
| 56 | + 7 => [ |
|
| 57 | + 0 => 'http://localhost:8765/test.png', |
|
| 58 | + 1 => 'http://localhost:8765/test.png', |
|
| 59 | + 2 => [ |
|
| 60 | + 0 => 'localhost:8765', |
|
| 61 | + ], |
|
| 62 | + ], |
|
| 63 | + 8 => [ |
|
| 64 | + 0 => false, |
|
| 65 | + 1 => 'http://localhost:9100/test.png', |
|
| 66 | + ], |
|
| 67 | + 9 => [ |
|
| 68 | + 0 => false, |
|
| 69 | + 1 => 'http://user@password:localhost:8765/test.png', |
|
| 70 | + 2 => [ |
|
| 71 | + 0 => 'localhost:8765', |
|
| 72 | + ], |
|
| 73 | + ], |
|
| 74 | + 10 => [ |
|
| 75 | + 0 => false, |
|
| 76 | + 1 => 'http://user@password:localhost:8765/test.png', |
|
| 77 | + 2 => [ |
|
| 78 | + 0 => 'http://user@password:localhost:8765', |
|
| 79 | + ], |
|
| 80 | + ], |
|
| 81 | + ]; |
|
| 82 | + } |
|
| 83 | 83 | } |
@@ -9,14 +9,14 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class CreerRubriqueNommeeTest extends SquelettesTestCase |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * La fonction creer_rubrique_nommee('a/b/c/d') creee une arborescence et renvoie l'id_rubrique |
|
| 14 | - * Ici on en prend 10 au pif et on essaie de voir si on retombe bien dessus (attention, le |
|
| 15 | - * test est potentiellement "destructeur" (ou plutot "constructeur", puisqu'il creera des |
|
| 16 | - * rubriques superflues) si la fonction echoue, ou si deux rubriques soeurs portent le meme titre). |
|
| 17 | - */ |
|
| 18 | - public function testCreerRubriqueNommee(): void { |
|
| 19 | - $this->assertOkCode(<<<SPIP |
|
| 12 | + /** |
|
| 13 | + * La fonction creer_rubrique_nommee('a/b/c/d') creee une arborescence et renvoie l'id_rubrique |
|
| 14 | + * Ici on en prend 10 au pif et on essaie de voir si on retombe bien dessus (attention, le |
|
| 15 | + * test est potentiellement "destructeur" (ou plutot "constructeur", puisqu'il creera des |
|
| 16 | + * rubriques superflues) si la fonction echoue, ou si deux rubriques soeurs portent le meme titre). |
|
| 17 | + */ |
|
| 18 | + public function testCreerRubriqueNommee(): void { |
|
| 19 | + $this->assertOkCode(<<<SPIP |
|
| 20 | 20 | <BOUCLE_r(RUBRIQUES){par hasard}{0,10}> |
| 21 | 21 | [(#SET{hier,''})] |
| 22 | 22 | <BOUCLE_h(HIERARCHIE){tout}> |
@@ -30,5 +30,5 @@ discard block |
||
| 30 | 30 | </BOUCLE_r> |
| 31 | 31 | [(#GET{bug}|?{'',OK})] |
| 32 | 32 | SPIP); |
| 33 | - } |
|
| 33 | + } |
|
| 34 | 34 | } |
@@ -13,27 +13,27 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class XmlHackTest extends SquelettesTestCase |
| 15 | 15 | { |
| 16 | - #[DataProvider('providerXmlIsNotPhp')] |
|
| 17 | - public function testXmlIsNotPhp(string $squelette): void { |
|
| 18 | - $skel = $this->relativePath(__DIR__ . '/data/' . $squelette); |
|
| 19 | - $out = recuperer_fond($skel, [], [ |
|
| 20 | - 'raw' => true, |
|
| 21 | - 'trim' => true |
|
| 22 | - ]); |
|
| 23 | - $this->assertEmpty($out['erreur'] ?? null); |
|
| 24 | - $this->assertNotEmpty($out['texte']); |
|
| 25 | - $xml = simplexml_load_string($out['texte']); |
|
| 26 | - $this->assertOk((string) $xml[0]); |
|
| 27 | - } |
|
| 16 | + #[DataProvider('providerXmlIsNotPhp')] |
|
| 17 | + public function testXmlIsNotPhp(string $squelette): void { |
|
| 18 | + $skel = $this->relativePath(__DIR__ . '/data/' . $squelette); |
|
| 19 | + $out = recuperer_fond($skel, [], [ |
|
| 20 | + 'raw' => true, |
|
| 21 | + 'trim' => true |
|
| 22 | + ]); |
|
| 23 | + $this->assertEmpty($out['erreur'] ?? null); |
|
| 24 | + $this->assertNotEmpty($out['texte']); |
|
| 25 | + $xml = simplexml_load_string($out['texte']); |
|
| 26 | + $this->assertOk((string) $xml[0]); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - public static function providerXmlIsNotPhp(): array { |
|
| 30 | - return [ |
|
| 31 | - ['xmlhack'], |
|
| 32 | - ['xmlhack_php'], |
|
| 33 | - ['xmlhack_inclure'], |
|
| 34 | - ['xmlhack_inclure_php'], |
|
| 35 | - ['xmlhack_inclure_dyn'], |
|
| 36 | - ['xmlhack_inclure_dyn_php'], |
|
| 37 | - ]; |
|
| 38 | - } |
|
| 29 | + public static function providerXmlIsNotPhp(): array { |
|
| 30 | + return [ |
|
| 31 | + ['xmlhack'], |
|
| 32 | + ['xmlhack_php'], |
|
| 33 | + ['xmlhack_inclure'], |
|
| 34 | + ['xmlhack_inclure_php'], |
|
| 35 | + ['xmlhack_inclure_dyn'], |
|
| 36 | + ['xmlhack_inclure_dyn_php'], |
|
| 37 | + ]; |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | { |
| 16 | 16 | #[DataProvider('providerXmlIsNotPhp')] |
| 17 | 17 | public function testXmlIsNotPhp(string $squelette): void { |
| 18 | - $skel = $this->relativePath(__DIR__ . '/data/' . $squelette); |
|
| 18 | + $skel = $this->relativePath(__DIR__.'/data/'.$squelette); |
|
| 19 | 19 | $out = recuperer_fond($skel, [], [ |
| 20 | 20 | 'raw' => true, |
| 21 | 21 | 'trim' => true |
@@ -9,44 +9,44 @@ |
||
| 9 | 9 | |
| 10 | 10 | class SquelettesTestCaseTest extends SquelettesTestCase |
| 11 | 11 | { |
| 12 | - public function testAssertOk(): void { |
|
| 13 | - $this->assertOk('ok'); |
|
| 14 | - $this->assertOk('Ok'); |
|
| 15 | - $this->assertOk('OK'); |
|
| 16 | - $this->assertOk('OK NOK NA'); |
|
| 17 | - } |
|
| 18 | - |
|
| 19 | - public function testAssertOkExceptionNok(): void { |
|
| 20 | - $this->expectException(AssertionFailedError::class); |
|
| 21 | - $this->assertOk('NOK'); |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - public function testAssertOkExceptionNa(): void { |
|
| 25 | - $this->expectException(AssertionFailedError::class); |
|
| 26 | - $this->assertOk('NA'); |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - public function testAssertNotOk() { |
|
| 30 | - $this->assertNotOk('nOK'); |
|
| 31 | - $this->assertNotOk('NOK'); |
|
| 32 | - $this->assertNotOk('Nok'); |
|
| 33 | - $this->assertNotOk('Nok OK NA'); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - public function testAssertNotOkExceptionOk(): void { |
|
| 37 | - $this->expectException(AssertionFailedError::class); |
|
| 38 | - $this->assertNotOk('OK'); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - public function testAssertNotOkExceptionNa(): void { |
|
| 42 | - $this->expectException(AssertionFailedError::class); |
|
| 43 | - $this->assertOk('Na'); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - public function testIsNa(): void { |
|
| 47 | - $this->assertTrue($this->isNa(' NA texte')); |
|
| 48 | - $this->assertTrue($this->isNa('na texte')); |
|
| 49 | - $this->assertfalse($this->isNa('texte NA')); |
|
| 50 | - $this->assertfalse($this->isNa('texte')); |
|
| 51 | - } |
|
| 12 | + public function testAssertOk(): void { |
|
| 13 | + $this->assertOk('ok'); |
|
| 14 | + $this->assertOk('Ok'); |
|
| 15 | + $this->assertOk('OK'); |
|
| 16 | + $this->assertOk('OK NOK NA'); |
|
| 17 | + } |
|
| 18 | + |
|
| 19 | + public function testAssertOkExceptionNok(): void { |
|
| 20 | + $this->expectException(AssertionFailedError::class); |
|
| 21 | + $this->assertOk('NOK'); |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + public function testAssertOkExceptionNa(): void { |
|
| 25 | + $this->expectException(AssertionFailedError::class); |
|
| 26 | + $this->assertOk('NA'); |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + public function testAssertNotOk() { |
|
| 30 | + $this->assertNotOk('nOK'); |
|
| 31 | + $this->assertNotOk('NOK'); |
|
| 32 | + $this->assertNotOk('Nok'); |
|
| 33 | + $this->assertNotOk('Nok OK NA'); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + public function testAssertNotOkExceptionOk(): void { |
|
| 37 | + $this->expectException(AssertionFailedError::class); |
|
| 38 | + $this->assertNotOk('OK'); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + public function testAssertNotOkExceptionNa(): void { |
|
| 42 | + $this->expectException(AssertionFailedError::class); |
|
| 43 | + $this->assertOk('Na'); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + public function testIsNa(): void { |
|
| 47 | + $this->assertTrue($this->isNa(' NA texte')); |
|
| 48 | + $this->assertTrue($this->isNa('na texte')); |
|
| 49 | + $this->assertfalse($this->isNa('texte NA')); |
|
| 50 | + $this->assertfalse($this->isNa('texte')); |
|
| 51 | + } |
|
| 52 | 52 | } |
@@ -9,14 +9,14 @@ |
||
| 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 | } |
@@ -11,12 +11,12 @@ |
||
| 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 | } |