|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +/** |
| 6 | + * This file is part of littleredbutton/bigbluebutton-api-php. |
| 7 | + * |
| 8 | + * littleredbutton/bigbluebutton-api-php is free software: you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU Lesser General Public License as published by |
| 10 | + * the Free Software Foundation, either version 3 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * littleredbutton/bigbluebutton-api-php is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU Lesser General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU Lesser General Public License |
| 19 | + * along with littleredbutton/bigbluebutton-api-php. If not, see <http://www.gnu.org/licenses/>. |
| 20 | + */ |
| 21 | + |
| 22 | +namespace BigBlueButton\Tests\Unit\Util; |
| 23 | + |
| 24 | +use BigBlueButton\Tests\Common\TestCase; |
| 25 | +use BigBlueButton\Util\SimpleXMLElementExtended; |
| 26 | + |
| 27 | +/** |
| 28 | + * @covers \BigBlueButton\Util\SimpleXMLElementExtended |
| 29 | + */ |
| 30 | +final class SimpleXMLElementExtendedTest extends TestCase |
| 31 | +{ |
| 32 | + /** |
| 33 | + * Test adding a child element with CDATA content. |
| 34 | + */ |
| 35 | + public function testAddChildWithCData(): void |
| 36 | + { |
| 37 | + $xml = new SimpleXMLElementExtended('<?xml version="1.0" encoding="UTF-8"?><modules/>'); |
| 38 | + $module = $xml->addChildWithCData('module', '{"foo": {"foo": "baa"}}'); |
| 39 | + $module->addAttribute('name', 'clientSettingsOverride'); |
| 40 | + |
| 41 | + $expected = '<?xml version="1.0" encoding="UTF-8"?> |
| 42 | +<modules><module name="clientSettingsOverride"><![CDATA[{"foo": {"foo": "baa"}}]]></module></modules>'; |
| 43 | + |
| 44 | + $this->assertXmlStringEqualsXmlString($expected, $xml->asXML()); |
| 45 | + } |
| 46 | +} |
0 commit comments