mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02: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
1 changed files with 9 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue