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
36 changes: 18 additions & 18 deletions features/icon-collection.feature
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@ Feature: Manage WordPress icon collections
<?php
// Plugin Name: Test Icons
add_action(
'init',
function () {
wp_register_icon_collection(
'test-icons',
array(
'label' => 'Test Icons',
'description' => 'A collection for testing.',
)
);

wp_register_icon(
'test-icons/square',
array(
'label' => 'Square',
'content' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 4h16v16H4z" /></svg>',
)
);
}
'init',
function () {
wp_register_icon_collection(
'test-icons',
array(
'label' => 'Test Icons',
'description' => 'A collection for testing.',
)
);

wp_register_icon(
'test-icons/square',
array(
'label' => 'Square',
'content' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 4h16v16H4z" /></svg>',
)
);
}
);
"""

Expand Down
36 changes: 18 additions & 18 deletions features/icon.feature
Original file line number Diff line number Diff line change
Expand Up @@ -151,24 +151,24 @@ Feature: Manage WordPress SVG icons
<?php
// Plugin Name: Test Icons
add_action(
'init',
function () {
wp_register_icon_collection(
'test-icons',
array(
'label' => 'Test Icons',
'description' => 'A collection for testing.',
)
);

wp_register_icon(
'test-icons/square',
array(
'label' => 'Square',
'content' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 4h16v16H4z" /></svg>',
)
);
}
'init',
function () {
wp_register_icon_collection(
'test-icons',
array(
'label' => 'Test Icons',
'description' => 'A collection for testing.',
)
);

wp_register_icon(
'test-icons/square',
array(
'label' => 'Square',
'content' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 4h16v16H4z" /></svg>',
)
);
}
);
"""

Expand Down
28 changes: 14 additions & 14 deletions features/post-block.feature
Original file line number Diff line number Diff line change
Expand Up @@ -587,20 +587,20 @@ Feature: Manage blocks in post content
"""
<?php
WP_CLI::add_wp_hook(
'wp_cli_post_block_update_html',
function ( $block, $new_attrs, $block_name ) {
if ( 'core/paragraph' === $block_name && isset( $new_attrs['customClass'] ) ) {
$block['innerHTML'] = preg_replace(
'/<p([^>]*)>/',
'<p class="' . esc_attr( $new_attrs['customClass'] ) . '"$1>',
$block['innerHTML']
);
$block['innerContent'] = [ $block['innerHTML'] ];
}
return $block;
},
10,
3
'wp_cli_post_block_update_html',
function ( $block, $new_attrs, $block_name ) {
if ( 'core/paragraph' === $block_name && isset( $new_attrs['customClass'] ) ) {
$block['innerHTML'] = preg_replace(
'/<p([^>]*)>/',
'<p class="' . esc_attr( $new_attrs['customClass'] ) . '"$1>',
$block['innerHTML']
);
$block['innerContent'] = [ $block['innerHTML'] ];
}
return $block;
},
10,
3
);
"""
When I run `wp post create --post_title="Block Post" --post_content="<!-- wp:paragraph --><p>Hello World</p><!-- /wp:paragraph -->" --porcelain`
Expand Down
56 changes: 28 additions & 28 deletions features/taxonomy.feature
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@ Feature: Manage WordPress taxonomies
<?php
// Plugin Name: Test Taxonomy Strict/No-Strict Mode
add_action(
'init',
function () {
$args = array(
'hierarchical' => true,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'labels' => array(
'name' => _x( 'Genres', 'taxonomy general name', 'textdomain' ),
),
);
register_taxonomy( 'genres', array( 'post', 'page' ), $args );
}
'init',
function () {
$args = array(
'hierarchical' => true,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'labels' => array(
'name' => _x( 'Genres', 'taxonomy general name', 'textdomain' ),
),
);
register_taxonomy( 'genres', array( 'post', 'page' ), $args );
}
);
"""

Expand All @@ -95,20 +95,20 @@ Feature: Manage WordPress taxonomies
<?php
// Plugin Name: Test Taxonomy Strict/No-Strict Mode
add_action(
'init',
function () {
$args = array(
'hierarchical' => true,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'labels' => array(
'name' => _x( 'Genres', 'taxonomy general name', 'textdomain' ),
),
);
register_taxonomy( 'genres', array( 'post', 'page' ), $args );
}
'init',
function () {
$args = array(
'hierarchical' => true,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'labels' => array(
'name' => _x( 'Genres', 'taxonomy general name', 'textdomain' ),
),
);
register_taxonomy( 'genres', array( 'post', 'page' ), $args );
}
);
"""

Expand Down
10 changes: 5 additions & 5 deletions features/term-migrate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ Feature: Migrate term custom fields
<?php
// Plugin Name: Test Migrate
add_action(
'init',
function () {
register_post_type( 'news', [ 'public' => true ] );
register_taxonomy( 'topic', 'news', [ 'public' => true ] );
}
'init',
function () {
register_post_type( 'news', [ 'public' => true ] );
register_taxonomy( 'topic', 'news', [ 'public' => true ] );
}
);
"""

Expand Down
4 changes: 2 additions & 2 deletions features/user-term.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Manage user term
<?php
// Plugin Name: Test Add Tax
function add_cli_tax() {
register_taxonomy( 'user_type', 'user' );
register_taxonomy( 'user_type', 'user' );
}
add_action( 'init', 'add_cli_tax' );
"""
Expand Down Expand Up @@ -74,7 +74,7 @@ Feature: Manage user term
<?php
// Plugin Name: Test Add Tax
function add_cli_tax() {
register_taxonomy( 'user_type', 'user' );
register_taxonomy( 'user_type', 'user' );
}
add_action( 'init', 'add_cli_tax' );
"""
Expand Down