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

HTTPS for unsecure baseurl not working #272

Open
mobilizer opened this issue Jul 15, 2016 · 0 comments
Open

HTTPS for unsecure baseurl not working #272

mobilizer opened this issue Jul 15, 2016 · 0 comments

Comments

@mobilizer
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant