improve some tests and keep it working: #66

Closed
wants to merge 2 commits into
from

Projects

None yet

2 participants

Test/EnvironmentTest.php

  • getInstance will not throw an exception if all tests are running.
  • make set instance null possible and check for type magento_environtment.
  • implement skipped Varien_Date tests.
    is it correct that %s property will be ignored? the test failed yet.

Implementation of ImageMagickTest will not work under windows because touch is an unix command.
check for environtment and skip these tests.

you should think about using of vfsStream for file system tests.

Forestsoft-de added some commits Aug 17, 2012
@Forestsoft-de Forestsoft-de improve some tests and keep it working:
Test/EnvironmentTest.php
getInstance will not throw an exception if all tests are running.
make set instance null possible and check for type magento_environtment.

implement skipped Varien_Date tests.
is it correct that %s property will be ignored? the test failed yet.

Implementation of ImageMagickTest will not work under windows because touch is an unix command.
check for environtment and skip these tests.

you should think about using of vfsStream for file system tests.
c78704b
@Forestsoft-de Forestsoft-de Merge branch 'master' of git://github.com/magento/magento2 752a4cf
Contributor

@Forestsoft-de
Sebastian, thank you for valuable contribution. Let's dissect it and see what was done in result:

  • dev/tests/unit/framework/Magento/Test/Environment.php and related tests. After careful inspection we decided to remove it at all. After this change the unit testing framework happens to not have any other classes, so we removed the framework as well. With this change the unit tests in Magento become implemented using "out of the box" features of PHPUnit.
  • dev/tests/unit/testsuite/Varien/DateTest.php
    • Didn't accept contribution for convertZendToStrfTime(), because this method was eliminated during refactoring of calendar to jQuery. The change is stuck in one of development branches though, but we'll incorporate it into master branch in near future.
    • Accepted testFormatDate() as is -- thank you
  • dev/tests/unit/testsuite/Varien/Image/Adapter/ImageMagickTest.php -- partially accepted your contribution and also refactored the test to not create any files in the first place.
@magento-team magento-team added a commit that referenced this pull request Nov 12, 2012
@magento-team magento-team 2.0.0.0-dev30
* Framework changes
  * Added dependency injection of framework capability
    * Adopted Zend\Di component of Zend Framework 2 library
    * Implemented object manager in Magento application
    * Refactored multiple base classes to dependency injection principle (dependencies are declared in constructor)
  * Themes/View
    * Implemented storing themes registry in database, basic CRUD of themes, automatic registration of themes in database from file system out of the box
    * Renamed `Mage_Core_Model_Layout_Update` into `Mage_Core_Model_Layout_Merge`, the former becomes an entity domain model. Similar changes with `Mage_Core_Model_Resource_Layout` -> `Mage_Core_Model_Resource_Layout_Update`, `Mage_Core_Model_Layout_Data` -> `Mage_Core_Model_Layout_Update`
* Performance tests
  * Improved indexers running script `dev/shell/indexer.php` to return appropriate exit code upon success/failure
  * Implemented running the same performance scenario file with different parameters
  * Slightly refactored framework class `Magento_Performance_Testsuite_Optimizer` for better visibility of algorithm
* Visual design editor
  * Added ability to remove elements in editor UI
  * Revised history of changes VDE toolbar and algorithm of "compacting" operations (moving, removing elements) as a layout update XML
  * Added selection of themes to VDE launcher page
* Refactored JavaScript of some UI elements to jQuery:
  * "Simple" and "configurable" product view pages
  * "Create Account" page
  * "Shopping Cart" page
  * CAPTCHA
  * Newsletter subscription
* Tax management UX improvements
  * Split Basic and Advanced Settings for Tax Rule Management UI
  * Moved the Import/Export functionality to Tax Rate page
  * Moved Tax menu to System from Sales
* Implemented the editable multiselect JavaScript component
* Added mentioning sitemap in `robots.txt` after generation
* Removed creation of DB backup in integration testing framework
* Fixed logic of order of loading ACL resources in backend
* Fixed JavaScript error during installation when one of files in `pub/media` is not writable
* Fixed structure of legacy test fixtures that allowed ambiguous keys in declaration
* Fixed inability to restore admin password when CAPTCHA is enabled
* Various minor UX fixes (labels, buttons, redirects, etc...)
* GitHub requests:
  * [#59](#59) -- implemented handling of unexpected situations in admin/dashboard/tunnel action
  * [#66](#66)
    * refactored ImageMagick adapter unit test to avoid system operation
    * simplified unit testing framework -- removed unused classes, simplified handling logic of directory `dev/tests/unit/tmp` and removed it from VCS
  * [#73](#73), [#74](#74) -- fixes in docblock tags
  * [#75](#75), [#96](#96) -- fixed translation module contexts in a few places
  * [#80](#80) -- fixed some runtime errors in import/export module
  * [#81](#81) -- removed usage of "remove" directive in places where it is overridden by setting root template anyway
  * [#87](#87) -- changed paths of files to include from relative into absolute in `dev/shell/indexer.php` and `log.php`
  * [#88](#88) -- provided comments for values that can be configured in `app/etc/local.xml` file
  * [#90](#90) -- slightly optimized logic of implementation of loading configurable product attributes
0f2900a
@NikolasSumrak NikolasSumrak added a commit to NikolasSumrak/magento2 that referenced this pull request Aug 30, 2016
@NikolasSumrak NikolasSumrak Fix for Product Attribute's Conditions
Fix for Product Attribute's Conditions if attribute option is deleted.

Description bug:
1. Create new cart rule or edit existing.
2. Add condition with multiselect product attribute (ex. attr activity in magento2+sample data)
3. Choose one option of attribute in condition and save rule
4. Delete this option in Stores->Product attributes
5. Reload Cart Rule Page in admin

1 exception(s):
Exception #0 (Exception): Warning: iconv_strlen() expects parameter 1 to be string, array given in /var/www/sources/sumrak/dev21/vendor/magento/framework/Stdlib/StringUtils.php on line 151

Exception #0 (Exception): Warning: iconv_strlen() expects parameter 1 to be string, array given in /var/www/sources/sumrak/dev21/vendor/magento/framework/Stdlib/StringUtils.php on line 151
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'iconv_strlen() ...', '/var/www/source...', 151, Array)
#1 /var/www/sources/sumrak/dev21/vendor/magento/framework/Stdlib/StringUtils.php(151): iconv_strlen(Array, 'UTF-8')
#2 /var/www/sources/sumrak/dev21/vendor/magento/framework/Filter/Truncate.php(76): Magento\Framework\Stdlib\StringUtils->strlen(Array)
#3 /var/www/sources/sumrak/dev21/vendor/magento/framework/Filter/FilterManager.php(133): Magento\Framework\Filter\Truncate->filter(Array)
#4 /var/www/sources/sumrak/dev21/vendor/magento/module-rule/Block/Editable.php(74): Magento\Framework\Filter\FilterManager->__call('truncate', Array)
#5 /var/www/sources/sumrak/dev21/vendor/magento/module-rule/Block/Editable.php(74): Magento\Framework\Filter\FilterManager->truncate(Array, Array)
#6 /var/www/sources/sumrak/dev21/vendor/magento/framework/Data/Form/Element/AbstractElement.php(453): Magento\Rule\Block\Editable->render(Object(Magento\Framework\Data\Form\Element\Multiselect))
#7 /var/www/sources/sumrak/dev21/vendor/magento/module-rule/Model/Condition/AbstractCondition.php(649): Magento\Framework\Data\Form\Element\AbstractElement->getHtml()
#8 /var/www/sources/sumrak/dev21/vendor/magento/module-rule/Model/Condition/AbstractCondition.php(477): Magento\Rule\Model\Condition\AbstractCondition->getValueElementHtml()
#9 /var/www/sources/sumrak/dev21/vendor/magento/module-rule/Model/Condition/AbstractCondition.php(488): Magento\Rule\Model\Condition\AbstractCondition->asHtml()
#10 /var/www/sources/sumrak/dev21/vendor/magento/module-rule/Model/Condition/Combine.php(292): Magento\Rule\Model\Condition\AbstractCondition->asHtmlRecursive()
#11 /var/www/sources/sumrak/dev21/vendor/magento/module-rule/Model/Condition/Combine.php(292): Magento\Rule\Model\Condition\Combine->asHtmlRecursive()
#12 /var/www/sources/sumrak/dev21/vendor/magento/module-rule/Block/Conditions.php(19): Magento\Rule\Model\Condition\Combine->asHtmlRecursive()
#13 /var/www/sources/sumrak/dev21/vendor/magento/framework/Data/Form/Element/AbstractElement.php(453): Magento\Rule\Block\Conditions->render(Object(Magento\Framework\Data\Form\Element\Text))
#14 /var/www/sources/sumrak/dev21/vendor/magento/framework/Data/Form/Element/Text.php(43): Magento\Framework\Data\Form\Element\AbstractElement->getHtml()
#15 /var/www/sources/sumrak/dev21/vendor/magento/framework/Data/Form/Element/AbstractElement.php(467): Magento\Framework\Data\Form\Element\Text->getHtml()
#16 /var/www/sources/sumrak/dev21/vendor/magento/framework/Data/Form/Element/Fieldset.php(229): Magento\Framework\Data\Form\Element\AbstractElement->toHtml()
#17 /var/www/sources/sumrak/dev21/vendor/magento/framework/Data/Form/Element/Fieldset.php(80): Magento\Framework\Data\Form\Element\Fieldset->_elementsToHtml(Array)
#18 /var/www/sources/sumrak/dev21/vendor/magento/module-catalog-rule/view/adminhtml/templates/promo/fieldset.phtml(23): Magento\Framework\Data\Form\Element\Fieldset->getChildrenHtml()
#19 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/var/www/source...')
#20 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Element/Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Backend\Block\Widget\Form\Renderer\Fieldset), '/var/www/source...', Array)
#21 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Element/Template.php(279): Magento\Framework\View\Element\Template->fetchView('/var/www/source...')
#22 /var/www/sources/sumrak/dev21/vendor/magento/module-backend/Block/Template.php(104): Magento\Framework\View\Element\Template->_toHtml()
#23 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Element/AbstractBlock.php(659): Magento\Backend\Block\Template->_toHtml()
#24 /var/www/sources/sumrak/dev21/vendor/magento/module-backend/Block/Widget/Form/Renderer/Fieldset.php(45): Magento\Framework\View\Element\AbstractBlock->toHtml()
#25 /var/www/sources/sumrak/dev21/vendor/magento/framework/Data/Form/Element/AbstractElement.php(453): Magento\Backend\Block\Widget\Form\Renderer\Fieldset->render(Object(Magento\Framework\Data\Form\Element\Fieldset))
#26 /var/www/sources/sumrak/dev21/vendor/magento/framework/Data/Form/Element/AbstractElement.php(467): Magento\Framework\Data\Form\Element\AbstractElement->getHtml()
#27 /var/www/sources/sumrak/dev21/vendor/magento/framework/Data/Form.php(322): Magento\Framework\Data\Form\Element\AbstractElement->toHtml()
#28 /var/www/sources/sumrak/dev21/vendor/magento/framework/Data/Form.php(337): Magento\Framework\Data\Form->toHtml()
#29 /var/www/sources/sumrak/dev21/vendor/magento/module-backend/Block/Widget/Form.php(98): Magento\Framework\Data\Form->getHtml()
#30 /var/www/sources/sumrak/dev21/vendor/magento/module-backend/view/adminhtml/templates/widget/form.phtml(15): Magento\Backend\Block\Widget\Form->getFormHtml()
#31 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/var/www/source...')
#32 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Element/Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Conditions), '/var/www/source...', Array)
#33 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Element/Template.php(279): Magento\Framework\View\Element\Template->fetchView('/var/www/source...')
#34 /var/www/sources/sumrak/dev21/vendor/magento/module-backend/Block/Template.php(104): Magento\Framework\View\Element\Template->_toHtml()
#35 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Element/AbstractBlock.php(659): Magento\Backend\Block\Template->_toHtml()
#36 /var/www/sources/sumrak/dev21/vendor/magento/module-ui/Component/HtmlContent.php(50): Magento\Framework\View\Element\AbstractBlock->toHtml()
#37 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Layout/Generator/UiComponent.php(148): Magento\Ui\Component\HtmlContent->prepare()
#38 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Layout/Generator/UiComponent.php(145): Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent(Object(Magento\Ui\Component\HtmlContent))
#39 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Layout/Generator/UiComponent.php(145): Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent(Object(Magento\Ui\Component\Container))
#40 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Layout/Generator/UiComponent.php(145): Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent(Object(Magento\Ui\Component\Form\Fieldset))
#41 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Layout/Generator/UiComponent.php(126): Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent(Object(Magento\Ui\Component\Form))
#42 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Layout/Generator/UiComponent.php(93): Magento\Framework\View\Layout\Generator\UiComponent->generateComponent(Object(Magento\Framework\View\Layout\Data\Structure), 'sales_rule_form', Array, Object(Magento\Framework\View\Layout\Interceptor))
#43 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Layout/GeneratorPool.php(86): Magento\Framework\View\Layout\Generator\UiComponent->process(Object(Magento\Framework\View\Layout\Reader\Context), Object(Magento\Framework\View\Layout\Generator\Context))
#44 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Layout.php(327): Magento\Framework\View\Layout\GeneratorPool->process(Object(Magento\Framework\View\Layout\Reader\Context), Object(Magento\Framework\View\Layout\Generator\Context))
#45 /var/www/sources/sumrak/dev21/var/generation/Magento/Framework/View/Layout/Interceptor.php(89): Magento\Framework\View\Layout->generateElements()
#46 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Layout/Builder.php(129): Magento\Framework\View\Layout\Interceptor->generateElements()
#47 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Page/Builder.php(55): Magento\Framework\View\Layout\Builder->generateLayoutBlocks()
#48 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Layout/Builder.php(65): Magento\Framework\View\Page\Builder->generateLayoutBlocks()
#49 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Layout.php(244): Magento\Framework\View\Layout\Builder->build()
#50 /var/www/sources/sumrak/dev21/vendor/magento/framework/View/Layout.php(859): Magento\Framework\View\Layout->build()
#51 /var/www/sources/sumrak/dev21/var/generation/Magento/Framework/View/Layout/Interceptor.php(414): Magento\Framework\View\Layout->getBlock('promo_sales_rul...')
#52 /var/www/sources/sumrak/dev21/vendor/magento/module-sales-rule/Controller/Adminhtml/Promo/Quote/Edit.php(59): Magento\Framework\View\Layout\Interceptor->getBlock('promo_sales_rul...')
#53 /var/www/sources/sumrak/dev21/var/generation/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Edit/Interceptor.php(24): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Edit->execute()
#54 /var/www/sources/sumrak/dev21/vendor/magento/framework/App/Action/Action.php(102): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Edit\Interceptor->execute()
#55 /var/www/sources/sumrak/dev21/vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#56 /var/www/sources/sumrak/dev21/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#57 /var/www/sources/sumrak/dev21/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Edit\Interceptor->___callParent('dispatch', Array)
#58 /var/www/sources/sumrak/dev21/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\SalesRu...', 'dispatch', Object(Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Edit\Interceptor), Array, 'adminAuthentica...')
#59 /var/www/sources/sumrak/dev21/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#60 /var/www/sources/sumrak/dev21/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Edit\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#61 /var/www/sources/sumrak/dev21/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\SalesRu...', 'dispatch', Object(Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Edit\Interceptor), Array, 'adminMassaction...')
#62 /var/www/sources/sumrak/dev21/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Edit\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#63 /var/www/sources/sumrak/dev21/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Edit\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#64 /var/www/sources/sumrak/dev21/var/generation/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Edit/Interceptor.php(39): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Edit\Interceptor->___callPlugins('dispatch', Array, Array)
#65 /var/www/sources/sumrak/dev21/vendor/magento/framework/App/FrontController.php(55): Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Edit\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#66 /var/www/sources/sumrak/dev21/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#67 /var/www/sources/sumrak/dev21/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#68 /var/www/sources/sumrak/dev21/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#69 /var/www/sources/sumrak/dev21/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#70 /var/www/sources/sumrak/dev21/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#71 /var/www/sources/sumrak/dev21/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#72 /var/www/sources/sumrak/dev21/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#73 /var/www/sources/sumrak/dev21/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#74 /var/www/sources/sumrak/dev21/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
c158dc8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment