public/phpmyadmin/test/classes/Plugins/Export/ExportMediawikiTest.php
/**
     * Test for ExportMediaWiki::exportStructure
     *
     * @return void
     */
Test for ExportMediaWiki::exportStructure
@return void
Test for ExportMediaWiki :: exportStructure @return void
public function testExportStructure()
    {
        $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface')
            ->disableOriginalConstructor()
            ->getMock();
        $columns = array(
            array(
                'Null' => 'Yes',
                'Field' => 'name1',
                'Key' => 'PRI',
                'Type' => 'set(abc)enum123',
                'Default' => '',
                'Extra' => ''
            ),
            array(
                'Null' => 'NO',
                'Field' => 'fields',
                'Key' => 'COMP',
                'Type' => '',
                'Default' => 'def',
                'Extra' => 'ext'
            )
        );
        $dbi->expects($this->at(0))
            ->method('getColumns')
            ->with('db', 'table')
            ->will($this->returnValue($columns));
        $GLOBALS['dbi'] = $dbi;
        $GLOBALS['mediawiki_caption'] = true;
        $GLOBALS['mediawiki_headers'] = true;
        ob_start();
        $this->assertTrue(
            $this->object->exportStructure(
                'db', 'table', "\n", "example.com", "create_table", "test"
            )
        );
        $result = ob_get_clean();
        $this->assertEquals(
            "\n<!--\n" .
            "Table structure for `table`\n" .
            "-->\n" .
            "\n" .
            "{| class=\"wikitable\" style=\"text-align:center;\"\n" .
            "|+'''table'''\n" .
            "|- style=\"background:#ffdead;\"\n" .
            "! style=\"background:#ffffff\" | \n" .
            " | name1\n" .
            " | fields\n" .
            "|-\n" .
            "! Type\n" .
            " | set(abc)enum123\n" .
            " | \n" .
            "|-\n" .
            "! Null\n" .
            " | Yes\n" .
            " | NO\n" .
            "|-\n" .
            "! Default\n" .
            " | \n" .
            " | def\n" .
            "|-\n" .
            "! Extra\n" .
            " | \n" .
            " | ext\n" .
            "|}\n\n",
            $result
        );
    }
public function testExportStructure ( ) { $ dbi = $ this -> getMockBuilder ( 'PhpMyAdmin\DatabaseInterface' ) -> disableOriginalConstructor ( ) -> getMock ( ) ; $ columns = array ( array ( 'Null' => 'Yes' , 'Field' => 'name1' , 'Key' => 'PRI' , 'Type' => 'set(abc)enum123' , 'Default' => '' , 'Extra' => '' ) , array ( 'Null' => 'NO' , 'Field' => 'fields' , 'Key' => 'COMP' , 'Type' => '' , 'Default' => 'def' , 'Extra' => 'ext' ) ) ; $ dbi -> expects ( $ this -> at ( 0 ) ) -> method ( 'getColumns' ) -> with ( 'db' , 'table' ) -> will ( $ this -> returnValue ( $ columns ) ) ; $ GLOBALS [ 'dbi' ] = $ dbi ; $ GLOBALS [ 'mediawiki_caption' ] = true ; $ GLOBALS [ 'mediawiki_headers' ] = true ; ob_start ( ) ; $ this -> assertTrue ( $ this -> object -> exportStructure ( 'db' , 'table' , " \n " , " example.com " , " create_table " , " test " ) ) ; $ result = ob_get_clean ( ) ; $ this -> assertEquals ( " \n <!-- \n " . " Table structure for `table` \n " . " --> \n " . " \n " . " {| class= \" wikitable \"  style= \" text-align:center; \" \n " . " |+'''table''' \n " . " |- style= \" background:#ffdead; \" \n " . " ! style= \" background:#ffffff \"  |  \n " . "  | name1 \n " . "  | fields \n " . " |- \n " . " ! Type \n " . "  | set(abc)enum123 \n " . "  |  \n " . " |- \n " . " ! Null \n " . "  | Yes \n " . "  | NO \n " . " |- \n " . " ! Default \n " . "  |  \n " . "  | def \n " . " |- \n " . " ! Extra \n " . "  |  \n " . "  | ext \n " . " |} \n \n " , $ result ) ; }
Test for ExportMediaWiki::exportStructure
 @return void
Test for ExportMediaWiki :: exportStructure @return void