Skip to content

Commit

Permalink
MDL-68658 phpunit: Ensure that the configured proxy is applied always
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stronk7 committed May 22, 2020
1 parent 184523e commit 47890d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/tests/rsslib_test.php
Expand Up @@ -118,11 +118,15 @@ public function test_failproxy() {
$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;
}

/*
Expand Down

0 comments on commit 47890d6

Please sign in to comment.