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
13 changes: 13 additions & 0 deletions features/language-core.feature
Original file line number Diff line number Diff line change
Expand Up @@ -535,3 +535,16 @@ Feature: Manage translation files for a WordPress install
"""
en_US
"""

@require-wp-4.0
Scenario: List languages by multiple statuses
Given a WP install
And an empty cache
And I run `wp language core install nl_NL`

When I run `wp language core list --fields=language,status --status=active,installed`
Then STDOUT should be a table containing rows:
| language | status |
| en_US | active |
| nl_NL | installed |
And STDERR should be empty
13 changes: 13 additions & 0 deletions features/language-plugin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -439,3 +439,16 @@ Feature: Manage translation files for a WordPress install
jetpack,invalid_lang,"not available"
"""
And STDERR should be empty

@require-wp-4.0
Scenario: List languages by multiple statuses
Given a WP install
And an empty cache
And I run `wp language plugin install akismet nl_NL`

When I run `wp language plugin list --all --fields=plugin,language,status --status=active,installed`
Then STDOUT should be a table containing rows:
| plugin | language | status |
| akismet | en_US | active |
| akismet | nl_NL | installed |
And STDERR should be empty
14 changes: 14 additions & 0 deletions features/language-theme.feature
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,17 @@ Feature: Manage translation files for a WordPress install
twentysixteen,de_DE,"not installed"
"""
And STDERR should be empty

@require-wp-4.0
Scenario: List languages by multiple statuses
Given a WP install
And an empty cache
And I run `wp theme install twentyten --force`
And I run `wp language theme install twentyten nl_NL`

When I run `wp language theme list twentyten --fields=language,status --status=active,installed`
Then STDOUT should be a table containing rows:
| language | status |
| en_US | active |
| nl_NL | installed |
And STDERR should be empty
2 changes: 1 addition & 1 deletion src/Core_Language_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function ( $translation ) use ( $available, $current_locale, $updates ) {

foreach ( $translations as $key => $translation ) {
foreach ( array_keys( $translation ) as $field ) {
if ( isset( $assoc_args[ $field ] ) && $assoc_args[ $field ] !== $translation[ $field ] ) {
if ( isset( $assoc_args[ $field ] ) && ! in_array( $translation[ $field ], array_map( 'trim', explode( ',', $assoc_args[ $field ] ) ), true ) ) {
unset( $translations[ $key ] );
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin_Language_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function list_( $args, $assoc_args ) {

// Support features like --status=active.
foreach ( array_keys( $translation ) as $field ) {
if ( isset( $assoc_args[ $field ] ) && $assoc_args[ $field ] !== $translation[ $field ] ) {
if ( isset( $assoc_args[ $field ] ) && ! in_array( $translation[ $field ], array_map( 'trim', explode( ',', $assoc_args[ $field ] ) ), true ) ) {
continue 2;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Theme_Language_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function ( $file ) {

// Support features like --status=active.
foreach ( array_keys( $translation ) as $field ) {
if ( isset( $assoc_args[ $field ] ) && $assoc_args[ $field ] !== $translation[ $field ] ) {
if ( isset( $assoc_args[ $field ] ) && ! in_array( $translation[ $field ], array_map( 'trim', explode( ',', $assoc_args[ $field ] ) ), true ) ) {
continue 2;
}
}
Expand Down
Loading