public function testExportActionValidate()
 {
     $this->_config->expects($this->once())->method('__get')->with('validateXml')->willReturn('1');
     $document = $this->createMock('\\Protocol\\Message\\InventoryRequest');
     $document->expects($this->once())->method('forceValid');
     $client = $this->createMock('Model\\Client\\Client');
     $client->expects($this->once())->method('toDomDocument')->willReturn($document);
     $this->_clientManager->method('getClient')->willReturn($client);
     $this->dispatch('/console/client/export/?id=1');
     $this->assertResponseStatusCode(200);
 }
 public function testExportAction()
 {
     $xmlContent = "xml_content\n";
     $document = $this->getMock('\\Protocol\\Message\\InventoryRequest');
     $document->expects($this->once())->method('getFilename')->will($this->returnValue('filename.xml'));
     $document->expects($this->once())->method('saveXml')->will($this->returnValue($xmlContent));
     $client = $this->getMock('Model\\Client\\Client');
     $client->expects($this->once())->method('toDomDocument')->willReturn($document);
     $this->_clientManager->method('getClient')->willReturn($client);
     $this->dispatch('/console/client/export/?id=1');
     $this->assertResponseStatusCode(200);
     $this->assertResponseHeaderContains('Content-Type', 'text/xml; charset=utf-8');
     $this->assertResponseHeaderContains('Content-Disposition', 'attachment; filename="filename.xml"');
     $this->assertResponseHeaderContains('Content-Length', strlen($xmlContent));
     $this->assertEquals($xmlContent, $this->getResponse()->getContent());
 }