Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8483657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:09:57+00:00 2026-06-10T20:09:57+00:00

I found a strange problem while doing some unit-testing on Magento. I have a

  • 0

I found a strange problem while doing some unit-testing on Magento.

I have a test function which test a value from core_config_data table. So in order to have access to that value for test, in the setUp() function I am saving the config value in database:

public function setUp()
{
    parent::setUp();
    $systemConfig = new Mage_Core_Model_Config();
    $systemConfig->saveConfig(
        'my/custom/path/config',
        12
    );
}

and in my test method I am getting that value from database likeso:

$productsNo = Mage::getStoreConfig(my/custom/path/config);

but its value is null, and not a string as expected.

This is strange, because if I am refreshing the database after running the test, the value it’s existing in database. And if I’m running the test again, the test will work and the value it’s not null anymore.

What am I doing wrong? I don’t save the value correctly, or I don’t fetch it in a good way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:09:59+00:00Added an answer on June 10, 2026 at 8:09 pm

    You only save the configuration value to the database, but you don’t refresh the config cache, which is used by Mage::getStoreConfig().

    To achieve saving and refreshing at the same time you could use:

    Mage::app()->getConfig()
        ->saveConfig('my/custom/path/config', 12)
        ->reinit();
    

    This way the configuration value will be available in the current and subsequent requests.

    In case you don’t really need persistence, that is, if you only need this configuration value for the current request, than I’d rather recommend to use:

    Mage:app()->getStore()
        ->setConfig('my/custom/path/config', 12);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While creating my testing framework I've found a strange problem. I want to create
I experience a very strange problem and I don't have found any help to
We have encountered a very strange class not found problem in our web app
I just got a strange problem. I am including some files from my index.php,
I have a 'strange' problem, the following code converts the location lat value into
I have a strange bug where I am doing an ajax load from an
I have a strange problem here. I'm trying to erase an iterator from a
I found a strange problem when I used class Generics Today: Setting some broke
I found a strange ToolStripButton double click problem. These steps will reproduce the problem:
Found very strange behavior of MS Access database when running queries from c#. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.