OpenMage / magento-lts

Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes! Download the source code for free or contribute to OpenMage LTS | Security vulnerability patches, bug fixes, performance improvements and more.
https://www.openmage.org
Open Software License 3.0
863 stars 438 forks source link

Fixed `array_keys(null)` and call to undefined method in `Mage_Eav_Model_Config` #4036

Closed F1Red5 closed 2 days ago

F1Red5 commented 3 weeks ago

Description (*)

Issue 1: array_keys(null) fixed arround line 573.

Issue 2: undifiened method getDefaultAttributes() for invoice, creditmemo, ... fixed arround line 372

Related Pull Requests

  1. See OpenMage/magento-lts#2993

Fixed Issues (if relevant)

  1. See OpenMage/magento-lts#4034

Manual testing scenarios (*)

  1. install n98/magerun:dev-develop (v3.0.0)
  2. add custom attributes to all entity types
Test script ```php 'text', 'input' => 'text', 'label' => 'Test Attribute']; foreach (self::entityTypeProvider() as $entityType) { $this->createAttribute(array_values($entityType)[0], $attributeCode, $data); } } /** * From N98-magerun unit test */ public static function entityTypeProvider() { return [['catalog_category'], ['catalog_product'], ['creditmemo'], ['customer'], ['customer_address'], ['invoice'], ['order'], ['shipment']]; } /** * From N98-magerun unit test * * @param string $entityType * @param string $attributeCode * @param array $data */ protected function createAttribute($entityType, $attributeCode, $data) { $setup = Mage::getModel('eav/entity_setup', 'core_setup'); $setup->addAttribute($entityType, $attributeCode, $data); } } $test = new Test4034(); $test->prepare(); ```
  1. test eav:attribute:view creditmemo crazyCoolAttribute and eav:attribute:remove creditmemo crazyCoolAttribute

Questions or comments

After adding/removing EAV cache has to be cleaned, but this should be done in N98-magerun. (???) Not sure if it fixes all errors in unit tests, but these two issues should be easy to reproduce.

Todo: add Mage::app()->getCacheInstance()->cleanType('eav');

kiatng commented 3 days ago

I don't get this:

test eav:attribute:view creditmemo crazyCoolAttribute and eav:attribute:remove creditmemo crazyCoolAttribute

How to test the above?

fballiano commented 3 days ago

I guess it's n98-magerun eav:attribute:view creditmemo crazyCoolAttribute

fballiano commented 2 days ago

magerun build doesn't work on mac and I can't find any doc, I'll blindly review this PR