MDL-68658 phpunit: Ensure that the configured proxy is applied always

Previously, if the RSS feed (extests) was being served locally,
CFG->proxybypass was applied and causing the test to fail (proxy
ignored).

In that exact test we need the configured proxy to be applied
always, because the test is exaclty about detecting the problem
when a wrong proxy is used.
This commit is contained in:
Eloy Lafuente (stronk7) 2020-05-10 16:54:14 +02:00
parent 71965a8572
commit 200570558d

View File

@ -118,11 +118,15 @@ EOD;
$oldproxy = $CFG->proxyhost;
$CFG->proxyhost = 'xxxxxxxxxxxxxxx.moodle.org';
$oldproxybypass = $CFG->proxybypass; // Ensure we don't get locally served extests bypassing the proxy.
$CFG->proxybypass = '';
$feed = new moodle_simplepie($this->getExternalTestFileUrl('/rsstest.xml'));
$this->assertNotEmpty($feed->error());
$this->assertEmpty($feed->get_title());
$CFG->proxyhost = $oldproxy;
$CFG->proxybypass = $oldproxybypass;
}
/*