From d30e49fa608d0aefea33572dc87f9ab27510a754 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Thu, 25 Feb 2016 15:01:23 +0000 Subject: [PATCH] L10n: Add test for `wp_get_pomo_file_data()`. Props realloc. See #35284. git-svn-id: https://develop.svn.wordpress.org/trunk@36710 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/l10n.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/phpunit/tests/l10n.php b/tests/phpunit/tests/l10n.php index 6559a71ada..ad951ddf75 100644 --- a/tests/phpunit/tests/l10n.php +++ b/tests/phpunit/tests/l10n.php @@ -110,4 +110,30 @@ class Tests_L10n extends WP_UnitTestCase { ); } + /** + * @ticket 35284 + */ + function test_wp_get_pomo_file_data() { + $file = DIR_TESTDATA . '/pomo/empty.po'; + $array = wp_get_pomo_file_data( $file ); + $this->assertArrayHasKey( 'POT-Creation-Date', $array ); + $this->assertArrayHasKey( 'PO-Revision-Date', $array ); + $this->assertArrayHasKey( 'Project-Id-Version', $array ); + $this->assertArrayHasKey( 'X-Generator', $array ); + + $file = DIR_TESTDATA . '/pomo/mo.pot'; + $array = wp_get_pomo_file_data( $file ); + $this->assertNotEmpty( $array['POT-Creation-Date'] ); + $this->assertNotEmpty( $array['PO-Revision-Date'] ); + $this->assertNotEmpty( $array['Project-Id-Version'] ); + $this->assertArrayHasKey( 'X-Generator', $array ); + + $file = DIR_TESTDATA . '/languages/es_ES.po'; + $array = wp_get_pomo_file_data( $file ); + $this->assertArrayHasKey( 'POT-Creation-Date', $array ); + $this->assertNotEmpty( $array['PO-Revision-Date'] ); + $this->assertNotEmpty( $array['Project-Id-Version'] ); + $this->assertNotEmpty( $array['X-Generator'] ); + } + }