unit tests are finishing early in 5.1 branch
phil-davis opened this issue · 2 comments
phil-davis commented
https://github.com/sabre-io/http/actions/runs/5891207873/job/15977804886
PHPUnit 9.6.10 by Sebastian Bergmann and contributors.
Warning: Your XML configuration validates against a deprecated schema.
Suggestion: Migrate your XML configuration using "--migrate-configuration"!
............................................................... 63 / 167 ( 37%)
...array(1) {
[0]=>
string(17) "invalid_mime_type"
}
This comes from the unit test:
public function testParseMimeTypeOnInvalidMimeType()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Not a valid mime-type: invalid_mime_type');
parseMimeType('invalid_mime_type');
}
and that exercises the code in lib/functions.php
parseMimeType()
$mimeType = explode('/', $mimeType);
if (2 !== count($mimeType)) {
// Illegal value
var_dump($mimeType);
exit();
// throw new InvalidArgumentException('Not a valid mime-type: '.$str);
}
The output is caused by the var_dump
and the unit test run seems to stop there because of the exit()
Why does that code do an exit()
?
phil-davis commented
In 6.0 that code does throw an exception:
$mimeType = explode('/', $mimeType);
if (2 !== count($mimeType)) {
// Illegal value
throw new \InvalidArgumentException('Not a valid mime-type: '.$str);
}
I remember that we left the old behavior in v5 to maintain compatibility in major version 5.
I suppose that we need to skip the testParseMimeTypeOnInvalidMimeType()
unit test case in 5.1
phil-davis commented
Fixed by #223
Released in 5.1.9