public function testImportWithErrorsShouldReturnArray() { $this->createUser(); $this->createContent(); $xml = '<gotcms> <document_types> <document_type id="test"> </document_type> <document_type id="40"> <created_at><![CDATA[2013-11-23 14:52:37.860722]]></created_at> <updated_at><![CDATA[2013-11-23 14:52:37.915158]]></updated_at> <name><![CDATA[Test]]></name> <description><![CDATA[Test]]></description> <icon_id><![CDATA[1]]></icon_id> <default_view_id><![CDATA[' . $this->view->getId() . ']]></default_view_id> <dependencies> <id>531351</id> <id>0</id> </dependencies> <available_views> <id>531351</id> <id>0</id> </available_views> <tabs> <tab id="test"></tab> <tab id="10"> <name>test</name> <description>test</description> <sort_order>test</sort_order> <properties> <property id="test"></property> <property id="10"></property> </properties> </tab> </tabs> </document_type> </document_types> <views> <view id="test"> </view> </views> <layouts> <layout id="test"> </layout> </layouts> <scripts> <script id="test"> </script> </scripts> <datatypes> <datatype id="test"> </datatype> </datatypes> <documents> <document id="test"> <properties> <property_value id="10"></property_value> <property_value id="10"></property_value> </properties> </document> </documents> <fake> </fake> </gotcms>'; $result = $this->object->import($xml); $this->assertInternalType('array', $result); $this->assertCount(7, $result); foreach ($result as $string) { $this->assertRegexp('~Cannot save (dependencies for )?(datatype|view|document type|document|script|layout) with( identifier \\(.*\\) or)? id \\(\\d+\\)~iU', $string); } $this->removeContent(); $this->removeUser(); }
/** * Download files as gzip * * @return \Zend\Stdlib\ResponseInterface */ public function downloadFilesAction() { $model = new Model\Files(); $content = $model->export(); $filename = 'files-backup-' . date('Y-m-d-H-i-s') . '.zip'; $headers = new Headers(); $headers->addHeaderLine('Pragma', 'public')->addHeaderLine('Cache-control', 'must-revalidate, post-check=0, pre-check=0')->addHeaderLine('Cache-control', 'private')->addHeaderLine('Expires', -1)->addHeaderLine('Content-Type', 'application/download')->addHeaderLine('Content-Transfer-Encoding', 'binary')->addHeaderLine('Content-Length', strlen($content))->addHeaderLine('Content-Disposition', 'attachment; filename=' . $filename); $response = $this->getResponse(); $response->setHeaders($headers); $response->setContent($content); return $response; }