Skip to content

\Magento\Framework\Filesystem\Io\File::read() should be able to accept resource in second argument #27869

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

Merged
merged 9 commits into from
Sep 25, 2020

Conversation

bnymn
Copy link
Contributor

@bnymn bnymn commented Apr 15, 2020

\Magento\Framework\Filesystem\Io\File::read() method is not compatible with the IoInterface. This PR aims to make it compatible.

Description (*)

Related Pull Requests

Fixed Issues (if relevant)

  1. \Magento\Framework\Filesystem\Io\File::read() method is not compatible with \Magento\Framework\Filesystem\Io\IoInterface::read() #27866: \Magento\Framework\Filesystem\Io\File::read() method is not compatible with \Magento\Framework\Filesystem\Io\IoInterface::read()

Manual testing scenarios (*)

  1. ...
  2. ...

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 Apr 15, 2020

Hi @bnymn. 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.

@sidolov sidolov added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Aug 17, 2020
@ghost ghost assigned lenaorobei Aug 18, 2020
Copy link
Contributor

@lenaorobei lenaorobei left a comment

Choose a reason for hiding this comment

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

Please sign CLA and address test failures.

@engcom-Charlie
Copy link
Contributor

Hi @bnymn, please sign CLA and look through failed tests. Otherwise, we can't proceed with your PR.

@engcom-Charlie
Copy link
Contributor

@magento run all tests

@lenaorobei
Copy link
Contributor

@magento run all tests

@lenaorobei
Copy link
Contributor

@magento run Static Tests

@engcom-Charlie
Copy link
Contributor

Hi, @bnymn can you please fix static tests?
Thank you.

@engcom-Charlie
Copy link
Contributor

@magento run all tests

@lenaorobei lenaorobei added Risk: high Auto-Tests: Covered All changes in Pull Request is covered by auto-tests labels Sep 3, 2020
@magento-engcom-team
Copy link
Contributor

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

@engcom-Delta
Copy link
Contributor

✔️ QA passed
Result:
Code snippet for testing:

$file = ObjectManager::getInstance()->get(File::class);
        if (!is_dir('var/tmp_1')) {
            // dir doesn't exist, make it
            mkdir('var/tmp_1');
        }
        file_put_contents('var/tmp_1/sample_file', 'Some test file');
        $targetHandle = fopen('var/tmp_1/' . rand(), 'w');
        $file->cd('var/tmp_1');
        $result = $file->read('sample_file', $targetHandle);
        $output->writeln($result);

Before:
❌ $result is null
image

After:
✔️ File content is copied to the target path
image

✔️ File is copied to the target file when second argument is string only: `$result = $file->read('sample_file', 'test');
image

@engcom-Delta engcom-Delta added the QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope label Sep 24, 2020
@engcom-Delta
Copy link
Contributor

Note: Automation tests are passed

@m2-assistant
Copy link

m2-assistant bot commented Sep 25, 2020

Hi @bnymn, 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
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Component: Filesystem Partner: Webjump partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Risk: high Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants