Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit 922a1ad

Browse files
committed
Fix phpcs issues
1 parent 2e02ccd commit 922a1ad

4 files changed

+45
-20
lines changed

php/class-customize-snapshot-manager.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -724,20 +724,20 @@ public function render_templates() {
724724
$data = array(
725725
'choices' => array(
726726
'publish' => array(
727-
'option_text' => __( 'Publish' , 'customize-snapshots' ),
728-
'alt_text' => __( 'Published' , 'customize-snapshots' ),
727+
'option_text' => __( 'Publish', 'customize-snapshots' ),
728+
'alt_text' => __( 'Published', 'customize-snapshots' ),
729729
),
730730
'draft' => array(
731-
'option_text' => __( 'Save Draft' , 'customize-snapshots' ),
732-
'alt_text' => __( 'Draft' , 'customize-snapshots' ),
731+
'option_text' => __( 'Save Draft', 'customize-snapshots' ),
732+
'alt_text' => __( 'Draft', 'customize-snapshots' ),
733733
),
734734
'future' => array(
735-
'option_text' => __( 'Schedule' , 'customize-snapshots' ),
736-
'alt_text' => __( 'Scheduled' , 'customize-snapshots' ),
735+
'option_text' => __( 'Schedule', 'customize-snapshots' ),
736+
'alt_text' => __( 'Scheduled', 'customize-snapshots' ),
737737
),
738738
'pending' => array(
739-
'option_text' => __( 'Save Pending' , 'customize-snapshots' ),
740-
'alt_text' => __( 'Pending' , 'customize-snapshots' ),
739+
'option_text' => __( 'Save Pending', 'customize-snapshots' ),
740+
'alt_text' => __( 'Pending', 'customize-snapshots' ),
741741
),
742742
),
743743
'selected' => 'publish',

php/class-post-type.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function init() {
107107

108108
add_filter( 'post_link', array( $this, 'filter_post_type_link' ), 10, 2 );
109109
add_action( 'add_meta_boxes_' . static::SLUG, array( $this, 'setup_metaboxes' ), 10, 1 );
110-
add_action( 'admin_menu',array( $this, 'add_admin_menu_item' ), 99 );
110+
add_action( 'admin_menu', array( $this, 'add_admin_menu_item' ), 99 );
111111
add_filter( 'map_meta_cap', array( $this, 'remap_customize_meta_cap' ), 5, 4 );
112112
add_filter( 'bulk_actions-edit-' . static::SLUG, array( $this, 'add_snapshot_bulk_actions' ) );
113113
add_filter( 'handle_bulk_actions-edit-' . static::SLUG, array( $this, 'handle_snapshot_merge' ), 10, 3 );

phpcs.xml.dist

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
<rule ref="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing">
1313
<severity>0</severity>
1414
</rule>
15+
<rule ref="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned">
16+
<severity>0</severity>
17+
</rule>
18+
<rule ref="Generic.Formatting.MultipleStatementAlignment.NotSameWarning">
19+
<severity>0</severity>
20+
</rule>
1521
<rule ref="Squiz.PHP.DisallowMultipleAssignments.Found">
1622
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/issues/1277 -->
1723
<severity>0</severity>

tests/php/test-class-post-type.php

+30-11
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ public function test_setup_metaboxes() {
261261
$post_type = $this->get_new_post_type_instance( $this->plugin->customize_snapshot_manager );
262262
$post_type->init();
263263

264-
$post_id = $this->factory()->post->create( array( 'post_type' => $this->post_type_slug, 'post_status' => 'draft' ) );
264+
$post_id = $this->factory()->post->create( array(
265+
'post_type' => $this->post_type_slug,
266+
'post_status' => 'draft',
267+
) );
265268

266269
$wp_meta_boxes = array(); // WPCS: global override ok.
267270
$metabox_id = $this->post_type_slug;
@@ -542,7 +545,10 @@ public function test_get_post_content() {
542545
$this->assertEquals( 'baz', $content['foo']['value'] );
543546

544547
// Bad post data.
545-
$bad_post_id = $this->factory()->post->create( array( 'post_type' => $this->post_type_slug, 'post_content' => 'BADJSON' ) );
548+
$bad_post_id = $this->factory()->post->create( array(
549+
'post_type' => $this->post_type_slug,
550+
'post_content' => 'BADJSON',
551+
) );
546552
$bad_post = get_post( $bad_post_id );
547553
$content = $post_type->get_post_content( $bad_post );
548554
$this->assertEquals( array(), $content );
@@ -566,17 +572,28 @@ public function test_save() {
566572
$this->assertInstanceOf( 'WP_Error', $r );
567573
$this->assertEquals( 'missing_valid_uuid', $r->get_error_code() );
568574

569-
$r = $post_type->save( array( 'uuid' => self::UUID, 'data' => 'bad' ) );
575+
$r = $post_type->save( array(
576+
'uuid' => self::UUID,
577+
'data' => 'bad',
578+
) );
570579
$this->assertInstanceOf( 'WP_Error', $r );
571580
$this->assertEquals( 'missing_data', $r->get_error_code() );
572581

573582
// Error: bad_setting_params.
574-
$r = $post_type->save( array( 'uuid' => self::UUID, 'data' => array( 'foo' => 'bar' ) ) );
583+
$r = $post_type->save( array(
584+
'uuid' => self::UUID,
585+
'data' => array( 'foo' => 'bar' ),
586+
) );
575587
$this->assertInstanceOf( 'WP_Error', $r );
576588
$this->assertEquals( 'bad_setting_params', $r->get_error_code() );
577589

578590
// Error: missing_value_param.
579-
$r = $post_type->save( array( 'uuid' => self::UUID, 'data' => array( 'foo' => array( 'bar' => 'quux' ) ) ) );
591+
$r = $post_type->save( array(
592+
'uuid' => self::UUID,
593+
'data' => array(
594+
'foo' => array( 'bar' => 'quux' ),
595+
),
596+
) );
580597
$this->assertInstanceOf( 'WP_Error', $r );
581598
$this->assertEquals( 'missing_value_param', $r->get_error_code() );
582599

@@ -779,12 +796,14 @@ public function test_add_snapshot_bulk_actions() {
779796
public function test_handle_snapshot_merge() {
780797
$ids = $this->factory()->post->create_many( 2 );
781798
$posts = array_map( 'get_post', $ids );
782-
$post_type_obj = $this->getMockBuilder( 'CustomizeSnapshots\Post_Type' )
783-
->setConstructorArgs( array( $this->plugin->customize_snapshot_manager ) )
784-
->setMethods( array( 'merge_snapshots' ) )
785-
->getMock();
786-
$post_type_obj->expects( $this->once() )
787-
->method( 'merge_snapshots' )
799+
$post_type_obj = $this
800+
->getMockBuilder( 'CustomizeSnapshots\Post_Type' )
801+
->setConstructorArgs( array( $this->plugin->customize_snapshot_manager ) )
802+
->setMethods( array( 'merge_snapshots' ) )
803+
->getMock();
804+
$post_type_obj
805+
->expects( $this->once() )
806+
->method( 'merge_snapshots' )
788807
->with( $posts )
789808
->will( $this->returnValue( null ) );
790809
$post_type_obj->handle_snapshot_merge( '', 'merge_snapshot', $ids );

0 commit comments

Comments
 (0)