Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions features/makepot.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3785,3 +3785,84 @@ Feature: Generate a POT file of a WordPress project
"""
msgid "Other pattern description."
"""

Scenario: Ignores a standard set of directories as expected
Given an empty foo-plugin directory
And a foo-plugin/foo-plugin.php file:
"""
<?php
/**
* Plugin Name: Foo Plugin
* Plugin URI: https://example.com
* Description:
* Version: 0.1.0
* Author:
* Author URI:
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: foo-plugin
* Domain Path: /languages
*/

__( 'foo-plugin/foo-plugin.php', 'foo-plugin' );
"""
And a foo-plugin/.git/foo-plugin.php file:
"""
<?php
__( 'foo-plugin/.git/foo-plugin.php', 'foo-plugin' );
"""
And a foo-plugin/not.git/foo-plugin.php file:
"""
<?php
__( 'foo-plugin/not.git/foo-plugin.php', 'foo-plugin' );
"""
And a foo-plugin/subdir/.git/foo-plugin.php file:
"""
<?php
__( 'foo-plugin/subdir/.git/foo-plugin.php', 'foo-plugin' );
"""
And a foo-plugin/subdir/not.git/foo-plugin.php file:
"""
<?php
__( 'foo-plugin/subdir/not.git/foo-plugin.php', 'foo-plugin' );
"""
And a foo-plugin/tests/foo-plugin.php file:
"""
<?php
__( 'foo-plugin/tests/foo-plugin.php', 'foo-plugin' );
"""
And a foo-plugin/longertests/foo-plugin.php file:
"""
<?php
__( 'foo-plugin/longertests/foo-plugin.php', 'foo-plugin' );
"""

When I run `wp i18n make-pot foo-plugin foo-plugin.pot`
Then the foo-plugin.pot file should contain:
"""
msgid "foo-plugin/foo-plugin.php"
"""
And the foo-plugin.pot file should not contain:
"""
msgid "foo-plugin/.git/foo-plugin.php"
"""
And the foo-plugin.pot file should contain:
"""
msgid "foo-plugin/not.git/foo-plugin.php"
"""
And the foo-plugin.pot file should not contain:
"""
msgid "foo-plugin/subdir/.git/foo-plugin.php"
"""
And the foo-plugin.pot file should contain:
"""
msgid "foo-plugin/subdir/not.git/foo-plugin.php"
"""
And the foo-plugin.pot file should not contain:
"""
msgid "foo-plugin/tests/foo-plugin.php"
"""
And the foo-plugin.pot file should contain:
"""
msgid "foo-plugin/longertests/foo-plugin.php"
"""
2 changes: 1 addition & 1 deletion src/MakePotCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MakePotCommand extends WP_CLI_Command {
/**
* @var array
*/
protected $exclude = [ 'node_modules', '.git', '.svn', '.CVS', '.hg', 'vendor', 'Gruntfile.js', 'webpack.config.js', '*.min.js' ];
protected $exclude = [ 'node_modules', '.*', 'vendor', 'Gruntfile.js', 'webpack.config.js', '*.min.js', 'test', 'tests' ];

/**
* @var string
Expand Down