public function wrapCdata()
{
$command = new GenerateCommand();
$refl = new \ReflectionClass($command);
$method = $refl->getMethod('_wrapCData');
$method->setAccessible(true);
$sujet = function ($string) use($method, $command) {
return $method->invoke($command, $string);
};
$this->assertSame('', $sujet(null));
$this->assertSame('<![CDATA[CDATA]]>', $sujet('CDATA'));
$this->assertSame('<![CDATA[]]]]>', $sujet(']]'));
$this->assertSame('<![CDATA[ with terminator "]]>]]><![CDATA[" inside ]]>', $sujet(' with terminator "]]>" inside '));
$this->assertSame(']]><![CDATA[ at the start ]]>', $sujet(']]> at the start '));
$this->assertSame('<![CDATA[ at the end ]]>]]>', $sujet(' at the end ]]>'));
}