Commit d2792e13 authored by alexpott's avatar alexpott

Issue #3057370 by Wim Leers, seanB: MediaLibraryState::fromRequest() may...

Issue #3057370 by Wim Leers, seanB: MediaLibraryState::fromRequest() may result in invalid MediaLibraryState::create() call
parent 83d88242
......@@ -93,7 +93,7 @@ public static function fromRequest(Request $request) {
// all validation runs.
$state = static::create(
$query->get('media_library_opener_id'),
$query->get('media_library_allowed_types'),
$query->get('media_library_allowed_types', []),
$query->get('media_library_selected_type'),
$query->get('media_library_remaining')
);
......
......@@ -281,6 +281,15 @@ public function testFromRequest(array $query_overrides, $exception_expected) {
$this->assertInstanceOf(MediaLibraryState::class, $state);
}
/**
* @covers ::fromRequest
*/
public function testFromRequestQueryLess() {
$this->setExpectedException(\InvalidArgumentException::class, 'The opener ID parameter is required and must be a string.');
$state = MediaLibraryState::fromRequest(new Request());
$this->assertInstanceOf(MediaLibraryState::class, $state);
}
/**
* Data provider for testFromRequest().
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment