Skip to content
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare( strict_types=1 );

namespace Imagify\Tests\Unit\Inc\ThirdParty\PerfectImages\Classes;

use Imagify\Media\WP;
use Imagify\ThirdParty\PerfectImages\PerfectImages;
use Mockery;
use PHPUnit\Framework\TestCase;

class PerfectImagesTest extends TestCase {

/**
* @test
* @group 3rd-party
* @group PerfectImages
*/
public function shouldAddRetinaSizesToMediaFilesArray()
{
$perfectImages = PerfectImages::get_instance();
$media = Mockery::Mock( WP::class );

$this->assertEquals([], $perfectImages->add_2x_images_to_sizes_for_optimization( [], $media ) );
}
}
7 changes: 6 additions & 1 deletion classes/Context/AbstractContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,12 @@ public function can_resize() {
* @return bool
*/
public function can_backup() {
return $this->can_backup;
if ( isset( $this->can_backup ) ) {
return $this->can_backup;
}

$this->can_backup = get_imagify_option( 'backup' );

}

/**
Expand Down
19 changes: 0 additions & 19 deletions classes/Context/CustomFolders.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,6 @@ public function get_resizing_threshold() {
return 0;
}

/**
* Tell if the optimization process is allowed to backup in this context.
*
* @since 1.9
* @access public
* @author Grégory Viguier
*
* @return bool
*/
public function can_backup() {
if ( isset( $this->can_backup ) ) {
return $this->can_backup;
}

$this->can_backup = get_imagify_option( 'backup' );

return $this->can_backup;
}

/**
* Tell if the optimization process is allowed to keep exif in this context.
*
Expand Down
19 changes: 0 additions & 19 deletions classes/Context/WP.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,6 @@ public function get_resizing_threshold() {
return $this->resizing_threshold;
}

/**
* Tell if the optimization process is allowed to backup in this context.
*
* @since 1.9
* @access public
* @author Grégory Viguier
*
* @return bool
*/
public function can_backup() {
if ( isset( $this->can_backup ) ) {
return $this->can_backup;
}

$this->can_backup = get_imagify_option( 'backup' );

return $this->can_backup;
}

/**
* Tell if the optimization process is allowed to keep exif in this context.
*
Expand Down
2 changes: 0 additions & 2 deletions classes/Media/AbstractMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
use Imagify\CDN\PushCDNInterface;
use Imagify\Context\ContextInterface;

defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );

/**
* Abstract used for "media groups" (aka attachments).
*
Expand Down
2 changes: 0 additions & 2 deletions classes/Media/MediaInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
use Imagify\CDN\PushCDNInterface;
use Imagify\Context\ContextInterface;

defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );

/**
* Interface to use for "media groups" (aka attachments).
*
Expand Down
2 changes: 0 additions & 2 deletions classes/Media/WP.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
namespace Imagify\Media;

defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );

/**
* Media class for the medias in the WP library.
*
Expand Down
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"Imagify\\ThirdParty\\EnableMediaReplace\\": "inc/3rd-party/enable-media-replace/classes/",
"Imagify\\ThirdParty\\FormidablePro\\": "inc/3rd-party/formidable-pro/classes/",
"Imagify\\ThirdParty\\NGG\\": "inc/3rd-party/nextgen-gallery/classes/",
"Imagify\\ThirdParty\\PerfectImages\\": "inc/3rd-party/PerfectImages/Classes/",
"Imagify\\ThirdParty\\RegenerateThumbnails\\": "inc/3rd-party/regenerate-thumbnails/classes/",
"Imagify\\ThirdParty\\WPRocket\\": "inc/3rd-party/wp-rocket/classes/"
},
Expand All @@ -63,7 +64,10 @@
]
},
"autoload-dev": {
"psr-4": { "Imagify\\Tests\\": "Tests/" }
"psr-4": {
"Imagify\\Tests\\": "Tests/",
"Imagify\\Tests\\Unit\\Inc\\ThirdParty\\": "Tests/Unit/inc/3rd-party/"
}
},
"extra": {
"mozart": {
Expand Down
1 change: 1 addition & 0 deletions inc/3rd-party/3rd-party.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
require IMAGIFY_PATH . 'inc/3rd-party/enable-media-replace/enable-media-replace.php';
require IMAGIFY_PATH . 'inc/3rd-party/formidable-pro/formidable-pro.php';
require IMAGIFY_PATH . 'inc/3rd-party/nextgen-gallery/nextgen-gallery.php';
require IMAGIFY_PATH . 'inc/3rd-party/perfect-images/perfect-images.php';
require IMAGIFY_PATH . 'inc/3rd-party/regenerate-thumbnails/regenerate-thumbnails.php';
require IMAGIFY_PATH . 'inc/3rd-party/screets-lc.php';
require IMAGIFY_PATH . 'inc/3rd-party/wp-real-media-library.php';
Expand Down
Loading