diff --git a/libraries/opendocument.lib.php b/libraries/opendocument.lib.php index b1325034dc..08ff2b16b7 100644 --- a/libraries/opendocument.lib.php +++ b/libraries/opendocument.lib.php @@ -19,6 +19,7 @@ $GLOBALS['OpenDocumentNS'] . 'xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" ' . 'xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" ' . 'xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" ' + . 'xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" ' . 'xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" '; /** diff --git a/test/classes/plugin/import/ImportLdi_test.php b/test/classes/plugin/import/ImportLdi_test.php new file mode 100644 index 0000000000..9a68cd191d --- /dev/null +++ b/test/classes/plugin/import/ImportLdi_test.php @@ -0,0 +1,148 @@ +object = new ImportLdi(); + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + * + * @access protected + * @return void + */ + protected function tearDown() + { + unset($this->object); + } + + /** + * Test for getProperties + * + * @return void + * + * @group medium + */ + public function testGetProperties() + { + $properties = $this->object->getProperties(); + $this->assertEquals( + __('CSV using LOAD DATA'), + $properties->getText() + ); + $this->assertEquals( + 'ldi', + $properties->getExtension() + ); + } + + /** + * Test for doImport + * + * @return void + * + * @group medium + */ + public function testDoImport() + { + //$sql_query_disabled will show the import SQL detail + global $sql_query, $sql_query_disabled; + $sql_query_disabled = false; + + //Mock DBI + $dbi = $this->getMockBuilder('PMA_DatabaseInterface') + ->disableOriginalConstructor() + ->getMock(); + $GLOBALS['dbi'] = $dbi; + + //Test function called + $this->object->doImport(); + + //asset that all sql are executed + $this->assertContains( + "LOAD DATA INFILE 'test/test_data/db_test_ldi.csv' INTO TABLE `phpmyadmintest`", + $sql_query + ); + + $this->assertEquals( + true, + $GLOBALS['finished'] + ); + + } +} + + + diff --git a/test/test_data/db_test_ldi.csv b/test/test_data/db_test_ldi.csv new file mode 100644 index 0000000000..569b95c599 --- /dev/null +++ b/test/test_data/db_test_ldi.csv @@ -0,0 +1 @@ +"1","dbbase",,"ddd","SELECT * FROM `db_content` WHERE 1"