Skip to content

Commit

Permalink
returning false in tevkori_get_srcset_array if srcset contains less t…
Browse files Browse the repository at this point in the history
…han 2 sources plus tests
  • Loading branch information
joemcgill committed Aug 26, 2015
1 parent 72eac54 commit a7be365
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions tests/test-suite.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,14 @@ function test_tevkori_get_srcset_array_no_date_upoads() {
update_option( 'uploads_use_yearmonth_folders', $uploads_use_yearmonth_folders );
}

function test_tevkori_get_srcset_array_thumb() {
function test_tevkori_get_srcset_array_single_srcset() {
// make an image
$id = $this->_test_img();
$sizes = tevkori_get_srcset_array( $id, 'thumbnail' );

$image = wp_get_attachment_metadata( $id );

$year_month = date('Y/m');
$expected = array(
$image['sizes']['thumbnail']['width'] => 'http://example.org/wp-content/uploads/' . $year_month = date('Y/m') . '/'
. $image['sizes']['thumbnail']['file'] . ' ' . $image['sizes']['thumbnail']['width'] . 'w',
);

$this->assertSame( $expected, $sizes );
$this->assertFalse( $sizes );
}

function test_tevkori_get_srcset_array_false() { // make an image
Expand Down
2 changes: 1 addition & 1 deletion wp-tevko-responsive-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function tevkori_get_srcset_array( $id, $size = 'thumbnail' ) {
}
}

if ( empty( $arr ) ) {
if ( count( $arr ) <= 1 ) {
return false;
}

Expand Down

0 comments on commit a7be365

Please sign in to comment.