Skip to content
This repository was archived by the owner on May 27, 2023. It is now read-only.
This repository was archived by the owner on May 27, 2023. It is now read-only.

HTTPS for unsecure baseurl not working #272

Description

@mobilizer

If baseurl is using HTTPS simple controller tests doing a dispatch exit with 0.

E.g.: $this->dispatch('');

There is a 302 redirect and an exit, due to Mage_Core_Controller_Varien_Router_Standard::_checkShouldBeSecure(...).
and
$request->isSecure() is false because $_SERVER['HTTPS'] is not defined.

local.xml.phpunit looks like:

<config>
   <global>
      ...
   </global>
   <default>
      <web>
         <seo>
            <use_rewrites>1</use_rewrites>
         </seo>
         <secure>
            <base_url>https://xyz.dev/</base_url>
         </secure>
         <unsecure>
            <base_url>https://xyz.dev/</base_url>
         </unsecure>
         <url>
            <redirect_to_base>0</redirect_to_base>
         </url>
      </web>
   </default>
   <phpunit>
      <allow_same_db>0</allow_same_db>
   </phpunit>
</config>

core config is:
web/unsecure/base_url https://xyz.dev/

I can work around the issue by manually setting $_SERVER['HTTPS'] in the test.

class XYZ_Subaccounts_Test_Controller_SimpleTest extends EcomDev_PHPUnit_Test_Case_Controller {

/**
 * @test
 * @group simpletest
 */
public function cmsindexTest() {
    // Workarround if unsecure baseurl is also httpS
    $_SERVER['HTTPS'] = 'on';

    $this->dispatch('');
    $this->assertRequestRoute('cms/index/index');
}

}

Don't know if there is a misconfiguration. I used dev branch. It is on OS X. PHP 5.6,5.5, PHPUnit 4.8.26.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions