+
+ /**
+ * @covers Xml::listDropDownOptions
+ */
+ public function testListDropDownOptions() {
+ $this->assertEquals(
+ [
+ 'other reasons' => 'other',
+ 'Foo' => [
+ 'Foo 1' => 'Foo 1',
+ 'Example' => 'Example',
+ ],
+ 'Bar' => [
+ 'Bar 1' => 'Bar 1',
+ ],
+ ],
+ Xml::listDropDownOptions(
+ "* Foo\n** Foo 1\n** Example\n* Bar\n** Bar 1",
+ [ 'other' => 'other reasons' ]
+ )
+ );
+ }
+
+ /**
+ * @covers Xml::listDropDownOptionsOoui
+ */
+ public function testListDropDownOptionsOoui() {
+ $this->assertEquals(
+ [
+ [ 'data' => 'other', 'label' => 'other reasons' ],
+ [ 'optgroup' => 'Foo' ],
+ [ 'data' => 'Foo 1', 'label' => 'Foo 1' ],
+ [ 'data' => 'Example', 'label' => 'Example' ],
+ [ 'optgroup' => 'Bar' ],
+ [ 'data' => 'Bar 1', 'label' => 'Bar 1' ],
+ ],
+ Xml::listDropDownOptionsOoui( [
+ 'other reasons' => 'other',
+ 'Foo' => [
+ 'Foo 1' => 'Foo 1',
+ 'Example' => 'Example',
+ ],
+ 'Bar' => [
+ 'Bar 1' => 'Bar 1',
+ ],
+ ] )
+ );
+ }