Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed _Beans_Image_Editor::run() can return path instead of url #353

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion lib/api/image/class-beans-image-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function run() {
return $this->get_image_info( beans_path_to_url( $this->rebuilt_path ), true );
}

return $this->get_image_info( $this->src );
return $this->get_image_info( beans_path_to_url( $this->src ) );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function test_should_edit_store_image_and_return_its_url() {
* Test _Beans_Image_Editor::run() should return original src when the image does not exist.
*/
public function test_should_return_original_src_when_no_image() {
$src = 'path/does/not/exist/image.jpg';
$src = 'http://example.org/path/does/not/exist/image.jpg';
$editor = new _Beans_Image_Editor( $src, [ 'resize' => [ 800, false ] ] );

// Run the tests.
Expand Down Expand Up @@ -138,7 +138,7 @@ public function test_should_edit_store_image_and_return_indexed_array() {
* Test _Beans_Image_Editor::run() should return an indexed array with the original src when the image does not exist.
*/
public function test_should_return_indexed_array_with_original_src_when_no_image() {
$src = 'path/does/not/exist/image.jpg';
$src = 'http://example.org/path/does/not/exist/image.jpg';
$editor = new _Beans_Image_Editor( $src, [ 'resize' => [ 800, false ] ], ARRAY_N );

// Run the tests.
Expand Down Expand Up @@ -207,7 +207,7 @@ public function test_should_edit_store_image_and_return_object() {
* Test _Beans_Image_Editor::run() should return an object with the original src when the image does not exist.
*/
public function test_should_return_object_with_original_src_when_no_image() {
$src = 'path/does/not/exist/image.jpg';
$src = 'http://example.org/path/does/not/exist/image.jpg';
$editor = new _Beans_Image_Editor( $src, [ 'resize' => [ 800, false ] ], OBJECT );

// Run the tests.
Expand Down Expand Up @@ -289,7 +289,7 @@ public function test_should_edit_store_image_and_return_associative_array() {
* Test _Beans_Image_Editor::run() should return an array with the original src when the image does not exist.
*/
public function test_should_return_associative_array_with_original_src_when_no_image() {
$src = 'path/does/not/exist/image.jpg';
$src = 'http://example.org/path/does/not/exist/image.jpg';
$editor = new _Beans_Image_Editor( $src, [ 'resize' => [ 800, false ] ], ARRAY_A );

// Run the tests.
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/integration/api/image/beansEditImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function setUpBeforeClass() {
* Test beans_edit_image() should return original src when the image does not exist.
*/
public function test_should_return_original_src_when_no_image() {
$src = 'path/does/not/exist/image.jpg';
$src = 'http://example.org/path/does/not/exist/image.jpg';

// Run the tests.
$this->assertFileNotExists( $src );
Expand All @@ -53,7 +53,7 @@ public function test_should_return_original_src_when_no_image() {
* Test beans_edit_image() should return an indexed array with the original src when the image does not exist.
*/
public function test_should_return_indexed_array_with_original_src_when_no_image() {
$src = 'path/does/not/exist/image.jpg';
$src = 'http://example.org/path/does/not/exist/image.jpg';

// Run the tests.
$this->assertFileNotExists( $src );
Expand All @@ -67,7 +67,7 @@ public function test_should_return_indexed_array_with_original_src_when_no_image
* Test beans_edit_image() should return an object with the original src when the image does not exist.
*/
public function test_should_return_object_with_original_src_when_no_image() {
$src = 'path/does/not/exist/image.jpg';
$src = 'http://example.org/path/does/not/exist/image.jpg';

// Run the tests.
$this->assertFileNotExists( $src );
Expand All @@ -82,7 +82,7 @@ public function test_should_return_object_with_original_src_when_no_image() {
* Test beans_edit_image() should return an associative array with the original src when the image does not exist.
*/
public function test_should_return_associative_array_with_original_src_when_no_image() {
$src = 'path/does/not/exist/image.jpg';
$src = 'http://example.org/path/does/not/exist/image.jpg';

// Run the tests.
$this->assertFileNotExists( $src );
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/unit/api/image/beans-image-editor/run.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function( $edited_image_src ) use ( $actual_path ) {
* Test _Beans_Image_Editor::run() should return original src when the image does not exist.
*/
public function test_should_return_original_src_when_no_image() {
$src = 'path/does/not/exist/image.jpg';
$src = 'http://example.org/path/does/not/exist/image.jpg';
$editor = new _Beans_Image_Editor( $src, [ 'resize' => [ 800, false ] ] );

// Set up the mocks.
Expand Down Expand Up @@ -145,7 +145,7 @@ function( $edited_image_src ) use ( $actual_path ) {
* Test _Beans_Image_Editor::run() should return an indexed array with the original src when the image does not exist.
*/
public function test_should_return_indexed_array_with_original_src_when_no_image() {
$src = 'path/does/not/exist/image.jpg';
$src = 'http://example.org/path/does/not/exist/image.jpg';
$editor = new _Beans_Image_Editor( $src, [ 'resize' => [ 800, false ] ], ARRAY_N );

// Set up the mocks.
Expand Down Expand Up @@ -222,7 +222,7 @@ function( $edited_image_src ) use ( $actual_path ) {
* Test _Beans_Image_Editor::run() should return an object with the original src when the image does not exist.
*/
public function test_should_return_object_with_original_src_when_no_image() {
$src = 'path/does/not/exist/image.jpg';
$src = 'http://example.org/path/does/not/exist/image.jpg';
$editor = new _Beans_Image_Editor( $src, [ 'resize' => [ 800, false ] ], OBJECT );

// Set up the mocks.
Expand Down Expand Up @@ -311,7 +311,7 @@ function( $edited_image_src ) use ( $actual_path ) {
* Test _Beans_Image_Editor::run() should return an associative array with the original src when the image does not exist.
*/
public function test_should_return_associative_array_with_original_src_when_no_image() {
$src = 'path/does/not/exist/image.jpg';
$src = 'http://example.org/path/does/not/exist/image.jpg';
$editor = new _Beans_Image_Editor( $src, [ 'resize' => [ 800, false ] ], ARRAY_A );

// Set up the mocks.
Expand Down