diff --git a/test/phpunit/ODFTest.php b/test/phpunit/ODFTest.php
index 90b505e0848..02c80dc9689 100644
--- a/test/phpunit/ODFTest.php
+++ b/test/phpunit/ODFTest.php
@@ -155,87 +155,101 @@ class ODFTest extends PHPUnit\Framework\TestCase
'to_convert' => 'Simple string',
'encode' => true,
'charset' => null,
- 'expected' => 'Simple string'
+ 'expected7.4' => 'Simple string',
+ 'expected7.3' => 'Simple string'
],
2 => [
'to_convert' => 'Simple string',
'encode' => false,
'charset' => null,
- 'expected' => 'Simple string'
+ 'expected7.4' => 'Simple string',
+ 'expected7.3' => 'Simple string'
],
3 => [
'to_convert' => "Simple string\nwith line break",
'encode' => true,
'charset' => null,
- 'expected' => "Simple stringwith line break"
+ 'expected7.4' => "Simple stringwith line break",
+ 'expected7.3' => "Simple stringwith line break"
],
4 => [
'to_convert' => "Simple string\nwith line break",
'encode' => false,
'charset' => null,
- 'expected' => "Simple stringwith line break"
+ 'expected7.4' => "Simple stringwith line break",
+ 'expected7.3' => "Simple stringwith line break"
],
// Special chars
5 => [
'to_convert' => 'One&two',
'encode' => true,
'charset' => null,
- 'expected' => 'One&two'
+ 'expected7.4' => 'One&two',
+ 'expected7.3' => 'One&two'
],
6 => [
'to_convert' => 'One&two',
'encode' => false,
'charset' => null,
- 'expected' => 'One&two'
+ 'expected7.4' => 'One&two',
+ 'expected7.3' => 'One&two'
],
7 => [
'to_convert' => "/a&él'èàüöç€Ğ~<>",
'encode' => true,
'charset' => null,
- 'expected' => utf8_encode("/a&él'èàüöç€Ğ~<>"),
+ 'expected7.4' => utf8_encode("/a&él'èàüöç€Ğ~<>"),
+ 'expected7.3' => utf8_encode("/a&él'èàüöç€Ğ~<>")
],
8 => [
'to_convert' => "/a&él'èàüöç€Ğ~<>",
'encode' => false,
'charset' => null,
- 'expected' => utf8_encode("/a&él'èàüöç€Ğ~<>"),
+ 'expected7.4' => utf8_encode("/a&él'èàüöç€Ğ~<>"),
+ 'expected7.3' => utf8_encode("/a&él'èàüöç€Ğ~<>")
],
// special chars with non-default charset
9 => [
'to_convert' => "/a&él'èàüöç€Ğ~<>",
'encode' => true,
'charset' => 'UTF-16',
- 'expected' => "/a&él'èàüöç€Ğ~<>",
+ 'expected7.4' => "/a&él'èàüöç€Ğ~<>",
+ 'expected7.3' => "/a&él'èàüöç€Ğ~<>",
],
10 => [
'to_convert' => "/a&él'èàüöç€Ğ~<>",
'encode' => false,
'charset' => 'UTF-16', // When the charset differs from ISO-8859 string is not converted.
- 'expected' => "/a&él'èàüöç€Ğ~<>",
+ 'expected7.4' => "/a&él'èàüöç€Ğ~<>",
+ 'expected7.3' => "/a&él'èàüöç€Ğ~<>",
],
11 => [
'to_convert' => "Greater > than",
'encode' => true,
'charset' => null,
- 'expected' => utf8_encode("Greater > than"),
+ 'expected7.4' => utf8_encode("Greater > than"),
+ 'expected7.3' => utf8_encode("Greater > than"),
],
12 => [
'to_convert' => "Greater > than",
'encode' => false,
'charset' => null,
- 'expected' => utf8_encode("Greater > than"),
+ 'expected7.4' => utf8_encode("Greater > than"),
+ 'expected7.3' => utf8_encode("Greater > than"),
],
13 => [
'to_convert' => "Smaller < than",
'encode' => true,
'charset' => null,
- 'expected' => utf8_encode("Smaller < than"),
+ 'expected7.4' => utf8_encode("Smaller < than"),
+ 'expected7.3' => utf8_encode("Smaller < than"),
],
14 => [
'to_convert' => "Smaller < than",
'encode' => false,
'charset' => null,
- 'expected' => utf8_encode("Smaller < than"),
+ 'expected7.4' => utf8_encode("Smaller < than"),
+ 'expected7.3' => utf8_encode("Smaller < than"),
],
/** HTML **/
// break lines
@@ -243,56 +257,65 @@ class ODFTest extends PHPUnit\Framework\TestCase
'to_convert' => "Break
line",
'encode' => true,
'charset' => null,
- 'expected' => utf8_encode("Breakline"),
+ 'expected7.4' => utf8_encode("Breakline"),
+ 'expected7.3' => utf8_encode("Breakline"),
],
16 => [
'to_convert' => "Break
line",
'encode' => false,
'charset' => null,
- 'expected' => utf8_encode("Breakline"),
+ 'expected7.4' => utf8_encode("Breakline"),
+ 'expected7.3' => utf8_encode("Breakline"),
],
17 => [
'to_convert' => "Break
line",
'encode' => true,
'charset' => null,
- 'expected' => utf8_encode("Breakline"),
+ 'expected7.4' => utf8_encode("Breakline"),
+ 'expected7.3' => utf8_encode("Breakline"),
],
18 => [
'to_convert' => "Break
line",
'encode' => false,
'charset' => null,
- 'expected' => utf8_encode("Breakline"),
+ 'expected7.4' => utf8_encode("Breakline"),
+ 'expected7.3' => utf8_encode("Breakline"),
],
// HTML tags
19 => [
'to_convert' => "text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l'",
'encode' => false,
'charset' => 'UTF-8',
- 'expected' => 'text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l\'',
+ 'expected7.4' => 'text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l\'',
+ 'expected7.3' => 'text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l\'',
],
20 => [
'to_convert' => "text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l'",
'encode' => true,
'charset' => 'UTF-8',
- 'expected' => 'text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l'',
+ 'expected7.4' => 'text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l'',
+ 'expected7.3' => 'text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l'',
],
21 => [
'to_convert' => "text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l'",
'encode' => false,
'charset' => null,
- 'expected' => utf8_encode('text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l\''),
+ 'expected7.4' => utf8_encode('text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l\''),
+ 'expected7.3' => utf8_encode('text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l\''),
],
22 => [
'to_convert' => "text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l'",
'encode' => true,
'charset' => null,
- 'expected' => utf8_encode('text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l''),
+ 'expected7.4' => utf8_encode('text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l''),
+ 'expected7.3' => utf8_encode('text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l''),
],
23 => [
'to_convert' => "text with intricatedtags",
'encode' => true,
'charset' => null,
- 'expected' => utf8_encode('text with intricatedtags'),
+ 'expected7.4' => utf8_encode('text with intricatedtags'),
+ 'expected7.3' => utf8_encode('text with intricatedtags'),
],
// One can also pass html-encoded string to the method
@@ -300,31 +323,36 @@ class ODFTest extends PHPUnit\Framework\TestCase
'to_convert' => 'One&two',
'encode' => true,
'charset' => null,
- 'expected' => 'One&two'
+ 'expected7.4' => 'One&two',
+ 'expected7.3' => 'One&two'
],
25 => [
'to_convert' => "text with <strong>strong, </strong><em>emphasis</em> and <u>underlined</u> words with <i>it@lic sp&ciàlchärs éè l'</i>",
'encode' => false,
'charset' => 'UTF-8',
- 'expected' => 'text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l\'',
+ 'expected7.4' => 'text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l\'',
+ 'expected7.3' => 'text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l\'',
],
26 => [
'to_convert' => "text with <strong>strong, </strong><em>emphasis</em> and <u>underlined</u> words with <i>it@lic sp&ciàlchärs éè l'</i>",
'encode' => true,
'charset' => 'UTF-8',
- 'expected' => 'text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l'',
+ 'expected7.4' => 'text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l'',
+ 'expected7.3' => 'text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l'',
],
27 => [
'to_convert' => "text with <strong>strong, </strong><em>emphasis</em> and <u>underlined</u> words with <i>it@lic sp&ciàlchärs éè l'</i>",
'encode' => false,
'charset' => null,
- 'expected' => utf8_encode('text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l\''),
+ 'expected7.4' => utf8_encode('text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l\''),
+ 'expected7.3' => utf8_encode('text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l\''),
],
28 => [
'to_convert' => "text with <strong>strong, </strong><em>emphasis</em> and <u>underlined</u> words with <i>it@lic sp&ciàlchärs éè l'</i>",
'encode' => true,
'charset' => null,
- 'expected' => utf8_encode('text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l''),
+ 'expected7.4' => utf8_encode('text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l''),
+ 'expected7.3' => utf8_encode('text with strong, emphasis and underlined words with it@lic sp&ciàlchärs éè l''),
],
// // TODO custom styles are not tested for now : the custom style have a custom ID based on time. Not random, but hard to mock or predict. generated in _replaceHtmlWithOdtTag() case 'span'.
@@ -332,7 +360,7 @@ class ODFTest extends PHPUnit\Framework\TestCase
// 'to_convert' => '123 trucmachin > truc < troc > tracbla bla',
// 'encode' => true,
// 'charset' => 'UTF-8',
- // 'expected' => "123 trucmachin > truc < troc > tracbla bla'",
+ // 'expected7.4' => "123 trucmachin > truc < troc > tracbla bla'",
// ],
/* Tests that can evolve */
@@ -343,20 +371,23 @@ class ODFTest extends PHPUnit\Framework\TestCase
'to_convert' => '123 trucmachin > truc < troc > tracbla bla',
'encode' => true,
'charset' => null,
- 'expected' => "123 trucmachin > truc < troc > tracbla bla",
+ 'expected7.4' => "123 trucmachin > truc < troc > tracbla bla",
+ 'expected7.3' => "123 trucmachin > truc < troc > tracbla bla",
],
30 => [
'to_convert' => '123
Title
bla',
'encode' => true,
'charset' => null,
- 'expected' => "123 Title bla",
+ 'expected7.4' => "123 Title bla",
+ 'expected7.3' => "123 Title bla",
],
// HTML should not take \n into account, but only
.
31 => [
'to_convert' => "text with strong text , a line\nbreak and underlined words with it@lic sp&ciàlchärs éè l'",
'encode' => false,
'charset' => 'UTF-8',
- 'expected' => 'text with strong text , a line'."\n".'break and underlined words with it@lic sp&ciàlchärs éè l\'',
+ 'expected7.4' => 'text with strong text , a line'."\n".'break and underlined words with it@lic sp&ciàlchärs éè l\'',
+ 'expected7.3' => 'text with strong text , a line'."\n".'break and underlined words with it@lic sp&ciàlchärs éè l\'',
],
];
@@ -369,7 +400,11 @@ class ODFTest extends PHPUnit\Framework\TestCase
} else {
$res = $odf->convertVarToOdf($case['to_convert'], $case['encode']);
}
- $this->assertEquals($res, $case['expected']);
+ if (version_compare(phpversion(), '7.4.0', '>=' )) {
+ $this->assertEquals($res, $case['expected7.4']);
+ } else {
+ $this->assertEquals($res, $case['expected7.3']);
+ }
}
print __METHOD__." result=".$result."\n";