Skip to content

Commit

Permalink
Fix static analysis issues in Test_WebP_Uploads_Image_Edit
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Jun 24, 2024
1 parent 71fbb9a commit fea003c
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions plugins/webp-uploads/tests/test-image-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,12 @@ public function test_it_should_backup_the_sources_structure_alongside_the_full_s
$this->assertArrayHasKey( 'full-orig', $backup_sources );
$this->assertSame( $metadata['sources'], $backup_sources['full-orig'] );

unset( $backup_sizes['full-orig'] );
foreach ( $backup_sizes as $size => $properties ) {
$size_name = str_replace( '-orig', '', $size );

if ( 'full-orig' === $size ) {
continue;
}

$this->assertArrayHasKey( 'sources', $properties );
$this->assertSame( $metadata['sizes'][ $size_name ]['sources'], $properties['sources'] );
}

$metadata = wp_get_attachment_metadata( $attachment_id );
}

/**
Expand Down Expand Up @@ -136,7 +130,7 @@ public function test_it_should_prevent_to_back_up_the_sources_when_the_sources_a
$backup_sizes = get_post_meta( $attachment_id, '_wp_attachment_backup_sizes', true );
$this->assertIsArray( $backup_sizes );

foreach ( $backup_sizes as $size_name => $properties ) {
foreach ( $backup_sizes as $properties ) {
$this->assertArrayNotHasKey( 'sources', $properties );
}
}
Expand Down Expand Up @@ -281,7 +275,7 @@ static function () {
foreach ( $metadata['sizes'] as $size_name => $properties ) {
$this->assertImageNotHasSizeSource( $attachment_id, $size_name, 'image/jpeg' );
$this->assertImageHasSizeSource( $attachment_id, $size_name, 'image/webp' );
foreach ( $properties['sources'] as $mime_type => $values ) {
foreach ( $properties['sources'] as $values ) {
if ( 'thumbnail' === $size_name ) {
$this->assertFileNameIsNotEdited( $values['file'], "'{$size_name}' is not valid." );
$this->assertStringNotContainsString( '-scaled-', $values['file'] );
Expand Down

0 comments on commit fea003c

Please sign in to comment.