cancel
Showing results for 
Search instead for 
Did you mean: 

Change default tests behaviour

Change default tests behaviour

Hi,

I've created simple Magento 2 module that switches Magento whole website to https doing it via plugin for class 

Magento\Framework\Url\SecurityInfo

 That always returns true for method 

isSecure

 

 

Method works, all urls are being generated as secure, and all pages are automatically redirected via 302 header to secure versions.

However, running integration tests I noticed that integration test

Magento\Framework\UrlTest:testGetBaseUrlConfigured

now returns failure due to expecting http version for unsecure pages.

Is there a way of modifying behaviour of core integrations tests without actually modifying core files?

Is there a better way ensuring Magento 2 whole site is set as secure and not breaking tests?

2 REPLIES

Re: Change default tests behaviour

@Kamil Szewczyk, just curious, isn't it easier to switch to all https by specifying https for unsecure urls in configuration?

Re: Change default tests behaviour

@sivashchenko - that what we were always doing in M1, however we were advised that this is not the correct approach to switching whole site as secure, as the modules might behave unexpectedly when using https as base url for unsecure content.

 

Plugin method was the quickest way of ensuring that all calls will be done as secure url