@@ -583,3 +583,142 @@ Feature: Update existing PO files from a POT file
583583 """
584584 And STDERR should be empty
585585 And the contents of the foo-plugin/foo-plugin-de_DE.po file should match /First string.*Second string.*Third string/s
586+
587+ Scenario : Reports unchanged files when POT hasn't changed
588+ Given an empty foo-plugin directory
589+ And a foo-plugin/foo-plugin.pot file:
590+ """
591+ # Copyright (C) 2018 Foo Plugin
592+ # This file is distributed under the same license as the Foo Plugin package.
593+ msgid ""
594+ msgstr ""
595+ "Project-Id-Version: Foo Plugin\n"
596+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n"
597+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
598+ "Language-Team: LANGUAGE <LL@li.org>\n"
599+ "MIME-Version: 1.0\n"
600+ "Content-Type: text/plain; charset=UTF-8\n"
601+ "Content-Transfer-Encoding: 8bit\n"
602+ "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n"
603+ "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n"
604+ "X-Domain: foo-plugin\n"
605+
606+ #: foo-plugin.php:1
607+ msgid "Some string"
608+ msgstr ""
609+ """
610+ And a foo-plugin/foo-plugin-de_DE.po file:
611+ """
612+ # Copyright (C) 2018 Foo Plugin
613+ # This file is distributed under the same license as the Foo Plugin package.
614+ msgid ""
615+ msgstr ""
616+ "Project-Id-Version: Foo Plugin\n"
617+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n"
618+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
619+ "Language-Team: LANGUAGE <LL@li.org>\n"
620+ "Language: de_DE\n"
621+ "MIME-Version: 1.0\n"
622+ "Content-Type: text/plain; charset=UTF-8\n"
623+ "Content-Transfer-Encoding: 8bit\n"
624+ "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n"
625+ "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n"
626+ "X-Domain: foo-plugin\n"
627+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
628+
629+ #: foo-plugin.php:1
630+ msgid "Some string"
631+ msgstr "Some translated string"
632+ """
633+
634+ When I run `wp i18n update-po foo-plugin/foo-plugin.pot`
635+ Then STDOUT should be:
636+ """
637+ Success: Updated 0 files. 1 file unchanged.
638+ """
639+ And STDERR should be empty
640+
641+ Scenario : Reports both updated and unchanged files
642+ Given an empty foo-plugin directory
643+ And a foo-plugin/foo-plugin.pot file:
644+ """
645+ # Copyright (C) 2018 Foo Plugin
646+ # This file is distributed under the same license as the Foo Plugin package.
647+ msgid ""
648+ msgstr ""
649+ "Project-Id-Version: Foo Plugin\n"
650+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n"
651+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
652+ "Language-Team: LANGUAGE <LL@li.org>\n"
653+ "MIME-Version: 1.0\n"
654+ "Content-Type: text/plain; charset=UTF-8\n"
655+ "Content-Transfer-Encoding: 8bit\n"
656+ "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n"
657+ "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n"
658+ "X-Domain: foo-plugin\n"
659+
660+ #: foo-plugin.php:1
661+ msgid "Some string"
662+ msgstr ""
663+
664+ #: foo-plugin.php:15
665+ msgid "Another new string"
666+ msgstr ""
667+ """
668+ And a foo-plugin/foo-plugin-de_DE.po file:
669+ """
670+ # Copyright (C) 2018 Foo Plugin
671+ # This file is distributed under the same license as the Foo Plugin package.
672+ msgid ""
673+ msgstr ""
674+ "Project-Id-Version: Foo Plugin\n"
675+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n"
676+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
677+ "Language-Team: LANGUAGE <LL@li.org>\n"
678+ "Language: de_DE\n"
679+ "MIME-Version: 1.0\n"
680+ "Content-Type: text/plain; charset=UTF-8\n"
681+ "Content-Transfer-Encoding: 8bit\n"
682+ "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n"
683+ "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n"
684+ "X-Domain: foo-plugin\n"
685+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
686+
687+ #: foo-plugin.php:10
688+ msgid "Some string"
689+ msgstr "Some translated string"
690+ """
691+ And a foo-plugin/foo-plugin-es_ES.po file:
692+ """
693+ # Copyright (C) 2018 Foo Plugin
694+ # This file is distributed under the same license as the Foo Plugin package.
695+ msgid ""
696+ msgstr ""
697+ "Project-Id-Version: Foo Plugin\n"
698+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n"
699+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
700+ "Language-Team: LANGUAGE <LL@li.org>\n"
701+ "Language: es_ES\n"
702+ "MIME-Version: 1.0\n"
703+ "Content-Type: text/plain; charset=UTF-8\n"
704+ "Content-Transfer-Encoding: 8bit\n"
705+ "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n"
706+ "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n"
707+ "X-Domain: foo-plugin\n"
708+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
709+
710+ #: foo-plugin.php:1
711+ msgid "Some string"
712+ msgstr "Some translated string"
713+
714+ #: foo-plugin.php:15
715+ msgid "Another new string"
716+ msgstr "Otra nueva cadena"
717+ """
718+
719+ When I run `wp i18n update-po foo-plugin/foo-plugin.pot`
720+ Then STDOUT should be:
721+ """
722+ Success: Updated 1 file. 1 file unchanged.
723+ """
724+ And STDERR should be empty
0 commit comments