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

Remove warning from setup/src/Magento/Setup/Module/I18n/Dictionary/Writer/Csv.php #8306

Merged
merged 1 commit into from
Feb 1, 2017

Conversation

dmanners
Copy link
Contributor

During the running of the unit test suite you will see the following error cause be a warning being thrown in the class setup/src/Magento/Setup/Module/I18n/Dictionary/Writer/Csv.php.

vagrant@vagrant /v/w/h/mage2-github> ./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist setup/src/Magento/Setup/Test/Unit/Module/I18n/Dictionary/Writer/CsvTest.php
PHPUnit 4.1.0 by Sebastian Bergmann.

Configuration read from /var/www/html/mage2-github/dev/tests/unit/phpunit.xml.dist

E..

Time: 80 ms, Memory: 4.00MB

There was 1 error:

1) Magento\Setup\Test\Unit\Module\I18n\Dictionary\Writer\CsvTest::testWrongOutputFile
PHPUnit_Framework_Exception: Warning: fclose() expects parameter 1 to be resource, null given in /var/www/html/mage2-github/setup/src/Magento/Setup/Module/I18n/Dictionary/Writer/Csv.php:70.

/var/www/html/mage2-github/dev/tests/unit/framework/bootstrap.php:51
/var/www/html/mage2-github/lib/internal/Magento/Framework/TestFramework/Unit/Helper/ObjectManager.php:165
/var/www/html/mage2-github/setup/src/Magento/Setup/Test/Unit/Module/I18n/Dictionary/Writer/CsvTest.php:61

Caused by
InvalidArgumentException: Cannot open file for write dictionary: "wrong/path"

/var/www/html/mage2-github/setup/src/Magento/Setup/Module/I18n/Dictionary/Writer/Csv.php:32
/var/www/html/mage2-github/lib/internal/Magento/Framework/TestFramework/Unit/Helper/ObjectManager.php:165
/var/www/html/mage2-github/setup/src/Magento/Setup/Test/Unit/Module/I18n/Dictionary/Writer/CsvTest.php:61

FAILURES!
Tests: 3, Assertions: 6, Errors: 1.

The fix I have put in place is to check for the handle is actually a resource before passing it to fclose. Now the tests run without the error.

vagrant@vagrant /v/w/h/mage2-github> ./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist setup/src/Magento/Setup/Test/Unit/Module/I18n/Dictionary/Writer/CsvTest.php
PHPUnit 4.1.0 by Sebastian Bergmann.

Configuration read from /var/www/html/mage2-github/dev/tests/unit/phpunit.xml.dist

...

Time: 54 ms, Memory: 4.00MB

OK (3 tests, 8 assertions)

…fclose. This was causing a warning and making the CsvTest.php fail
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Jan 27, 2017

CLA assistant check
All committers have signed the CLA.

@ishakhsuvarov ishakhsuvarov self-assigned this Jan 31, 2017
@mmansoor-magento mmansoor-magento merged commit 7d42e36 into magento:develop Feb 1, 2017
@ishakhsuvarov
Copy link
Contributor

@dmanners Thank you for your contribution. Your Pull Request had been processed and merged to develop branch.

@dmanners dmanners deleted the fix-csv-unit-test branch February 3, 2017 12:26
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.

5 participants