/** * @covers \fpoirotte\XRL\Decoder::decodeResponse */ public function testDecodeSuccessfulResponse() { $content = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'testdata' . DIRECTORY_SEPARATOR . 'responses' . DIRECTORY_SEPARATOR . 'success.xml'); $decoder = new \fpoirotte\XRL\Decoder(); $response = $decoder->decodeResponse('data://;base64,' . base64_encode($content)); $this->assertInstanceOf('\\fpoirotte\\XRL\\Types\\ArrayType', $response); $this->assertSame(2, count($response)); $this->assertInstanceOf('\\fpoirotte\\XRL\\Types\\I4', $response[0]); $this->assertInstanceOf('\\fpoirotte\\XRL\\Types\\StringType', $response[1]); }
/** * Launch an XML bomb against the client. * * @expectedException \fpoirotte\XRL\Faults\NotWellFormedException * @expectedExceptionMessage parse error. not well formed */ public function testClientXmlBomb() { $content = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'testdata' . DIRECTORY_SEPARATOR . 'attacks' . DIRECTORY_SEPARATOR . 'client' . DIRECTORY_SEPARATOR . 'bomb.xml'); $decoder = new \fpoirotte\XRL\Decoder(); $response = $decoder->decodeResponse('data://;base64,' . base64_encode($content)); }