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 9208531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:38:14+00:00 2026-06-18T00:38:14+00:00

After some serious debugging I have found I can’t call to get a session

  • 0

After some serious debugging I have found I can’t call to get a session object in Magento when running a test with EcomDev_PHPUnit module

any singleton/model call i.e. Mage::getSingleton('admin/session') or Mage::getModel('customer/session') eventually throws an exception from EcomDev_PHPUnit_Controller_Request_Http::getHttpHost() saying Cannot run controller test, because the host is not set for base url. which is caused because the $_SERVER['HTTP_HOST'] index is not set

Is there something in the configuration that I could be missing to cause this?

  • 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-18T00:38:15+00:00Added an answer on June 18, 2026 at 12:38 am

    It is a problem related to Magento session initialization that is internal core part of Magento. In order to get rid of this error is to use a mock object, that does not use standard Magento session initialization process, since it uses core php session.

    The replacement of session object with mock can be done by using the following code if you’ve extended your test case from one of the EcomDev_PHPUnit_Test_Case classes.

    $sessionMock = $this->getModelMockBuilder('admin/session')
            ->disableOriginalConstructor() // This one removes session_start and other methods usage
            ->setMethods(null) // Enables original methods usage, because by default it overrides all methods
            ->getMock();
    $this->replaceByMock('singleton', 'admin/session', $sessionMock);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After some serious googleing I found out that the RandomAccessFile-class is not thread-safe. Now
After some time researching and trying different things I still cannot get my @ExceptionHandler
After some desperate assistance regarding prototype.js on Magento. Please see the below product page
After some recursive function I have an array: first iteration: Array ( [category_id] =>
after some processing my program shows a messagebox saying you can read a log
I've almost got what I want after shredding up some serious Xml--but after looking
I have a simple object like this public class Test { public string Name
I have a solution with multiple projects and we need to do some serious
I have some serious issues...I need to build a project from another developer in
We have started having some serious problems with our Java EE application. Specifically, the

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.