After I upgraded Magento manually (copied the files of 1.7 into my Magento 1.6) I had some errors coming from Code in app\code\local\Mage.

For example: Fatal error: Undefined class constant 'TYPE_BILLING' in [...]/app/code/core/Mage/Sales/Model/Quote.php on line 547

In this case the problem was in: app/code/local/Mage/Customer/Model/Address/Abstract.php I copied the new version of Abstract.php and put the changes into the new file.

There where some other similar errors that I fixed the same way.

Now I dont get any bugs anymore by clicked around, but how can I be sure I found everything? There is quite a lot in the app\code\local\Mage folder and to check all files manually will take forever.

So how do you check the custom adaptations in app\code\local\Mage?


The real answer is: get rid of all your app/code/local/Mage/ files as quickly as you can. Everything that has been modified there should be done by using event observers, class rewrites or the like but not by copying and editing core classes. In 99.9% of the cases you don't need to do this.

You should start this refactoring with this very upgrade. I know it may take time but the longer you wait the more time it will take. Now is the best time.

As how to test: in a perfect world you would have automated tests (unit tests, integration tests, ...) to cover this. But as this takes even more time to write them now the best advice I can give you is to test the new code thoroughly (and manually) using your browser. Think about all the ways customers or backend users have to go to use the functionalities important for your store and make sure they do work properly. Check var/report/, var/log/system.log and var/log/exception.log for possible errors.

If you want to want to do automated tests in the future you can use this opportunity and document how you do test all your business logic. Then you can use Selenium to write these tests down. Selenium can control your browser automatically and verify that everything works as intended.

  • Thank you for this informative post. It make sense that if there is core code in the local folder that it's not possible to automatic test if everything is fine. I am not an expert in Magento yet and still have much to lern. The project I upgraded is not mine and I think there is no way/budget to rewrite everything and use only observers. In another project I know about 1 case where the core didn't had an observer and we copied the core code just to add the observer we needed. PS: I can't upvote, no reputation. But you definitifly would have earned it. – nbar Sep 26 '13 at 14:43
  • 2
    Thanks. You should be able to accept my answer, though: meta.stackexchange.com/questions/5234/… – Matthias Zeis Sep 26 '13 at 15:03
  • 1
    And always do the initial upgrades on a DEV site so you aren't going through a panic when an otherwise usable upgrade snags up on a reef on the live site. As @MatthiasZeis says, all app/code/local/Mage overrides need to be modularized to minimize the amount of core being overloaded to a bare minimum. Go through two or three upgrades on DEV, test it all out and then usually the live site issues are only minor annoyances (such as your web maintainer not test creating a CMS page and finding the image library is missing due to being moved in the new version) that aren't show stoppers. – Fiasco Labs Sep 27 '13 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.