Skip to content

Commit 0fbb3d5

Browse files
Copilotswissspidy
andcommitted
Add test for plugins with different text domain than slug
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent c8f987d commit 0fbb3d5

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

‎features/language-plugin.feature‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,3 +444,37 @@ Feature: Manage plugin translation files for a WordPress install
444444
| akismet | en_US | active |
445445
| akismet | nl_NL | installed |
446446
And STDERR should be empty
447+
448+
@require-wp-4.0
449+
Scenario: Handle plugins with text domain different from slug
450+
Given a WP install
451+
And an empty cache
452+
453+
# Create a test plugin with a different text domain
454+
Given a wp-content/plugins/test-plugin/test-plugin.php file:
455+
"""
456+
<?php
457+
/**
458+
* Plugin Name: Test Plugin
459+
* Text Domain: different-text-domain
460+
* Domain Path: /languages
461+
*/
462+
"""
463+
464+
# Manually create a translation file using the text domain (not the plugin slug)
465+
And a wp-content/languages/plugins/different-text-domain-de_DE.po file:
466+
"""
467+
msgid ""
468+
msgstr ""
469+
"""
470+
471+
When I run `wp language plugin list test-plugin --fields=language,status --format=csv`
472+
Then STDOUT should contain:
473+
"""
474+
en_US,active
475+
"""
476+
And STDERR should be empty
477+
478+
# If the fix is working, installed languages should be detected via text domain
479+
When I run `wp language plugin is-installed test-plugin de_DE`
480+
Then the return code should be 0

0 commit comments

Comments
 (0)