fix : nettoyer le buffer libxml et pin de contrat sur les listes multi-enfants
This commit is contained in:
@@ -32,6 +32,24 @@ final class ZipMessageDecoderTest extends TestCase
|
||||
self::assertSame('F', (string) $decoded->Bovins->Bovin->IdentiteBovin->Sexe);
|
||||
}
|
||||
|
||||
public function testDecodeProducesArrayForMultiChildNodes(): void
|
||||
{
|
||||
$xml = '<?xml version="1.0" encoding="UTF-8"?>'
|
||||
.'<MessageIpBNotifGetInventaire>'
|
||||
.'<Bovins>'
|
||||
.'<Bovin><IdentiteBovin><Sexe>F</Sexe></IdentiteBovin></Bovin>'
|
||||
.'<Bovin><IdentiteBovin><Sexe>M</Sexe></IdentiteBovin></Bovin>'
|
||||
.'</Bovins>'
|
||||
.'</MessageIpBNotifGetInventaire>';
|
||||
|
||||
$decoded = new ZipMessageDecoder()->decode($this->makeZipBinary('message.xml', $xml));
|
||||
|
||||
self::assertIsArray($decoded->Bovins->Bovin);
|
||||
self::assertCount(2, $decoded->Bovins->Bovin);
|
||||
self::assertSame('F', (string) $decoded->Bovins->Bovin[0]->IdentiteBovin->Sexe);
|
||||
self::assertSame('M', (string) $decoded->Bovins->Bovin[1]->IdentiteBovin->Sexe);
|
||||
}
|
||||
|
||||
public function testDecodeThrowsOnEmptyBinary(): void
|
||||
{
|
||||
$this->expectException(RuntimeException::class);
|
||||
|
||||
Reference in New Issue
Block a user