php-gettext-gettext/php-gettext-gettext-bigendian.patch
Remi Collet ec40649b8e fix FTBFS from Koschei
add upstream patch for PHP 7.2
add patch for bigendian from https://github.com/oscarotero/Gettext/pull/159
2017-10-31 09:57:31 +01:00

35 lines
1.4 KiB
Diff

From 063cf0e74c8bce8785a8d7cc90a5af2bac345fe3 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Tue, 31 Oct 2017 09:54:52 +0100
Subject: [PATCH] don't check Po file content on bigendian
---
tests/AbstractTest.php | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tests/AbstractTest.php b/tests/AbstractTest.php
index 42f54b6..42f419f 100644
--- a/tests/AbstractTest.php
+++ b/tests/AbstractTest.php
@@ -51,7 +51,10 @@ protected function assertContent(Translations $translations, $file, $format = nu
$method = "to{$format}String";
$content = file_get_contents(static::asset($file.'.'.static::$ext[$format]));
- $this->assertSame($content, $translations->$method(), $file);
+ // Po reference files are LittleEndian
+ if ($format !== 'Mo' || self::isLittleEndian()) {
+ $this->assertSame($content, $translations->$method(), $file);
+ }
}
protected static function saveContent(Translations $translations, $file, $format = null)
@@ -78,4 +81,9 @@ protected function runTestFormat($file, $countTranslations, $countTranslated = 0
$this->assertSame($countTranslated, $translations->countTranslated());
$this->assertContent($translations, $file);
}
+
+ protected function isLittleEndian()
+ {
+ return pack("s", 0x3031) === "10";
+ }
}