+
+ public function test_editor_type_change_to_wysiwyg_infers_type_from_request_or_uses_system_default()
+ {
+ $tests = [
+ [
+ 'setting' => 'wysiwyg',
+ 'request' => 'wysiwyg2024',
+ 'expected' => 'wysiwyg2024',
+ ],
+ [
+ 'setting' => 'wysiwyg2024',
+ 'request' => 'wysiwyg',
+ 'expected' => 'wysiwyg',
+ ],
+ [
+ 'setting' => 'wysiwyg',
+ 'request' => null,
+ 'expected' => 'wysiwyg',
+ ],
+ [
+ 'setting' => 'wysiwyg2024',
+ 'request' => null,
+ 'expected' => 'wysiwyg2024',
+ ]
+ ];
+
+ $page = $this->entities->page();
+ foreach ($tests as $test) {
+ $page->editor = 'markdown';
+ $page->save();
+
+ $this->setSettings(['app-editor' => $test['setting']]);
+ $this->asAdmin()->put($page->getUrl(), ['name' => $page->name, 'html' => '<p>Hello</p>', 'editor' => $test['request']]);
+ $this->assertEquals($test['expected'], $page->refresh()->editor, "Failed asserting global editor {$test['setting']} with request editor {$test['request']} results in {$test['expected']} set for the page");
+ }
+ }