mirror of
https://github.com/moodle/moodle.git
synced 2025-02-25 20:43:33 +01:00
MDL-79477 tool_moodlenet: better handling of network download test.
We can't assume the presense of `Content-Length` header in response to a HEAD request. Modify test assertion to account for this.
This commit is contained in:
parent
83b4c96cad
commit
2aa56c770d
@ -98,7 +98,15 @@ class remote_resource_test extends \advanced_testcase {
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertGreaterThan(0, $remoteres->get_download_size());
|
||||
// We need to handle size of -1 (missing "Content-Length" header), or where it is set and greater than zero.
|
||||
$this->assertThat(
|
||||
$remoteres->get_download_size(),
|
||||
$this->logicalOr(
|
||||
$this->equalTo(-1),
|
||||
$this->greaterThan(0),
|
||||
),
|
||||
);
|
||||
|
||||
[$path, $name] = $remoteres->download_to_requestdir();
|
||||
$this->assertIsString($path);
|
||||
$this->assertEquals('test.html', $name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user