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

{ASI} :- Image size is not passed to image-uploader when inserting an image from new media gallery #27388

Conversation

konarshankar07
Copy link
Contributor

@konarshankar07 konarshankar07 commented Mar 22, 2020

Description (*)

This PR is the part of Adobe stock integration

Dependent to

magento/adobe-stock-integration#1021

Fixed Issues (if relevant)

  1. Image size is not passed to image-uploader when inserting an image from new media gallery adobe-stock-integration#1010: Image size is not passed to image-uploader when inserting an image from new media gallery

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Mar 22, 2020

Hi @konarshankar07. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

* @param array $data
* @param object $model
*/
protected function checkAssetValues(array $expectedData, array $data, $model)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest using private scope for the private methods. protected scope assumes that we consider an inheritance of this test class by another test class. It's not a big deal, however, it's recommended to be strict with scoping and hide implementation details in such cases.

@rogyar
Copy link
Contributor

rogyar commented Mar 22, 2020

@magento run all tests

Copy link
Member

@sivaschenko sivaschenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request @konarshankar07 ! Please see my code review notes

@@ -65,6 +65,13 @@ public function getHeight(): int;
*/
public function getWidth(): int;

/**
* Retrieve full licensed asset's size
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Retrieve full licensed asset's size
* Retrieve asset file size in bytes

@@ -14,6 +14,7 @@
<column xsi:type="varchar" name="content_type" length="255" nullable="true" comment="Content Type"/>
<column xsi:type="int" name="width" padding="10" unsigned="true" nullable="false" identity="false" default="0" comment="Width"/>
<column xsi:type="int" name="height" padding="10" unsigned="true" nullable="false" identity="false" default="0" comment="Height"/>
<column xsi:type="int" name="size" padding="10" unsigned="true" nullable="false" identity="false" default="0" comment="Size"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<column xsi:type="int" name="size" padding="10" unsigned="true" nullable="false" identity="false" default="0" comment="Size"/>
<column xsi:type="int" name="size" padding="10" unsigned="true" nullable="false" identity="false" comment="Asset file size in bytes"/>

@@ -122,7 +144,7 @@ public function assetProvider()
],
'Keyword conversion without interface' => [
Keyword::class,
null,
'',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this value should be either a valid interface name or null

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per function argument type declarations for the method is string so instead of null I just replaced with the empty string

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it logically correct: it should be either interface name as string or null

@@ -54,22 +53,41 @@ public function testExtractData(string $class, $interfaceClass, array $expectedD
'data' => $data,
]
);
$receivedData = $this->dataExtractor->extract($model, $interfaceClass);
$this->checkValues($expectedData, $receivedData, $model);
if ($interfaceClass) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the reason to change the test logic after adding a size field. Only data provider should be changed. What is the reason for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to improve the Unit test for this line

$this->assertEquals(array_keys($expectedData), array_keys($expectedData));

@sivaschenko
Copy link
Member

Failed tests look to be random and not relevant to the changes in the PR

@sivaschenko sivaschenko added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label Mar 24, 2020
@magento-engcom-team
Copy link
Contributor

Hi @sivaschenko, thank you for the review.
ENGCOM-7196 has been created to process this Pull Request
✳️ @sivaschenko, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Bravo
Copy link
Contributor

✔️ QA Passed

Switched to the related Adobe Stock Integration PR 1021 and to the current PR

The image size is displayed, no NaN undefined error
27388_image size

@engcom-Echo engcom-Echo self-assigned this Mar 24, 2020
@engcom-Echo
Copy link
Contributor

Failed functional tests not related to the changes in this PR

@magento-engcom-team
Copy link
Contributor

Hi @rogyar, thank you for the review.
ENGCOM-7196 has been created to process this Pull Request

@m2-assistant
Copy link

m2-assistant bot commented Mar 28, 2020

Hi @konarshankar07, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants