Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

1. add test case for sub class of schema 2. refactor the code for better UT coverage #419

Closed
wants to merge 3 commits into from

2 participants

@adamgsoc2013

refactor the code for better UT coverage
1. change class Table_Stats to Table_Stats_$type
2. change class Relation_Stats to Relation_Stats_$type

@adamgsoc2013 adamgsoc2013 add test case for sub class of schema
refactor the code for better UT coverage
1. change class Table_Stats to Table_Stats_$type
2. change class Relation_Stats to Relation_Stats_$type
5ed324e
@adamgsoc2013

Hi Michal, I found that the source code

https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/schema/Dia_Relation_Schema.class.php#L766

the "exit" will make the UT run exit unexpectedly, can we remove "exit" ? thanks

@adamgsoc2013

same with all sub class of schema

@nijel
Owner
@adamgsoc2013

thanks Michal,

Close it for more investigation since the block of unit testing.

will reopen when things are ready. thanks

@adamgsoc2013 adamgsoc2013 reopened this
@adamgsoc2013

Hi Michial, I have tested it is ok to remove the "exit()" statement.the usage of every sub-class of PMA_Export_Relation_Schema is when export the table's schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 12, 2013
  1. @adamgsoc2013

    add test case for sub class of schema

    adamgsoc2013 authored
    refactor the code for better UT coverage
    1. change class Table_Stats to Table_Stats_$type
    2. change class Relation_Stats to Relation_Stats_$type
Commits on Jun 13, 2013
  1. @adamgsoc2013
  2. @adamgsoc2013
This page is out of date. Refresh to see the latest.
View
31 libraries/schema/Dia_Relation_Schema.class.php
@@ -194,10 +194,10 @@ function showOutput($fileName)
* and helps in drawing/generating the Tables in dia XML document.
*
* @package PhpMyAdmin
- * @name Table_Stats
+ * @name Table_Stats_DIA
* @see PMA_DIA
*/
-class Table_Stats
+class Table_Stats_DIA
{
/**
* Defines properties
@@ -210,7 +210,7 @@ class Table_Stats
public $tableColor;
/**
- * The "Table_Stats" constructor
+ * The "Table_Stats_DIA" constructor
*
* @param string $tableName The table name
* @param integer $pageNumber The current page number (from the
@@ -475,10 +475,10 @@ public function tableDraw($changeColor)
* in dia XML document.
*
* @package PhpMyAdmin
- * @name Relation_Stats
+ * @name Relation_Stats_DIA
* @see PMA_DIA
*/
-class Relation_Stats
+class Relation_Stats_DIA
{
/**
* Defines properties
@@ -494,7 +494,7 @@ class Relation_Stats
public $referenceColor;
/**
- * The "Relation_Stats" constructor
+ * The "Relation_Stats_DIA" constructor
*
* @param string $master_table The master table name
* @param string $master_field The relation field in the master table
@@ -503,7 +503,7 @@ class Relation_Stats
*
* @return void
*
- * @see Relation_Stats::_getXy
+ * @see Relation_Stats_DIA::_getXy
*/
function __construct($master_table, $master_field, $foreign_table,
$foreign_field
@@ -708,7 +708,7 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
* that user can download
*
* @return void
- * @see PMA_DIA,Table_Stats,Relation_Stats
+ * @see PMA_DIA,Table_Stats_DIA,Relation_Stats_DIA
*/
function __construct()
{
@@ -730,7 +730,7 @@ function __construct()
$alltables = $this->getAllTables($db, $this->pageNumber);
foreach ($alltables as $table) {
if (! isset($this->tables[$table])) {
- $this->_tables[$table] = new Table_Stats(
+ $this->_tables[$table] = new Table_Stats_DIA(
$table, $this->pageNumber, $this->showKeys
);
}
@@ -763,7 +763,6 @@ function __construct()
}
$dia->endDiaDoc();
$dia->showOutput($db . '-' . $this->pageNumber);
- exit();
}
/**
@@ -778,22 +777,22 @@ function __construct()
* @return void
*
* @access private
- * @see Table_Stats::__construct(),Relation_Stats::__construct()
+ * @see Table_Stats_DIA::__construct(),Relation_Stats_DIA::__construct()
*/
private function _addRelation($masterTable, $masterField, $foreignTable,
$foreignField, $showKeys
) {
if (! isset($this->_tables[$masterTable])) {
- $this->_tables[$masterTable] = new Table_Stats(
+ $this->_tables[$masterTable] = new Table_Stats_DIA(
$masterTable, $this->pageNumber, $showKeys
);
}
if (! isset($this->_tables[$foreignTable])) {
- $this->_tables[$foreignTable] = new Table_Stats(
+ $this->_tables[$foreignTable] = new Table_Stats_DIA(
$foreignTable, $this->pageNumber, $showKeys
);
}
- $this->_relations[] = new Relation_Stats(
+ $this->_relations[] = new Relation_Stats_DIA(
$this->_tables[$masterTable], $masterField,
$this->_tables[$foreignTable], $foreignField
);
@@ -811,7 +810,7 @@ private function _addRelation($masterTable, $masterField, $foreignTable,
* @return void
*
* @access private
- * @see Relation_Stats::relationDraw()
+ * @see Relation_Stats_DIA::relationDraw()
*/
private function _drawRelations($changeColor)
{
@@ -831,7 +830,7 @@ private function _drawRelations($changeColor)
* @return void
*
* @access private
- * @see Table_Stats::tableDraw()
+ * @see Table_Stats_DIA::tableDraw()
*/
private function _drawTables($changeColor)
{
View
35 libraries/schema/Eps_Relation_Schema.class.php
@@ -371,10 +371,10 @@ function showOutput($fileName)
* and helps in drawing/generating the Tables in EPS.
*
* @package PhpMyAdmin
- * @name Table_Stats
+ * @name Table_Stats_EPS
* @see PMA_EPS
*/
-class Table_Stats
+class Table_Stats_EPS
{
/**
* Defines properties
@@ -392,7 +392,7 @@ class Table_Stats
public $primary = array();
/**
- * The "Table_Stats" constructor
+ * The "Table_Stats_EPS" constructor
*
* @param string $tableName The table name
* @param string $font The font name
@@ -409,8 +409,8 @@ class Table_Stats
* @global string The current db name
*
* @access private
- * @see PMA_EPS, Table_Stats::Table_Stats_setWidth,
- * Table_Stats::Table_Stats_setHeight
+ * @see PMA_EPS, Table_Stats_EPS::Table_Stats_setWidth,
+ * Table_Stats_EPS::Table_Stats_setHeight
*/
function __construct(
$tableName, $font, $fontSize, $pageNumber, &$same_wide_width,
@@ -609,10 +609,10 @@ public function tableDraw($showColor)
* in EPS document.
*
* @package PhpMyAdmin
- * @name Relation_Stats
+ * @name Relation_Stats_EPS
* @see PMA_EPS
*/
-class Relation_Stats
+class Relation_Stats_EPS
{
/**
* Defines properties
@@ -624,14 +624,14 @@ class Relation_Stats
public $wTick = 10;
/**
- * The "Relation_Stats" constructor
+ * The "Relation_Stats_EPS" constructor
*
* @param string $master_table The master table name
* @param string $master_field The relation field in the master table
* @param string $foreign_table The foreign table name
* @param string $foreign_field The relation field in the foreign table
*
- * @see Relation_Stats::_getXy
+ * @see Relation_Stats_EPS::_getXy
*/
function __construct($master_table, $master_field, $foreign_table, $foreign_field)
{
@@ -787,7 +787,7 @@ public function relationDraw($changeColor)
}
}
/*
-* end of the "Relation_Stats" class
+* end of the "Relation_Stats_EPS" class
*/
/**
@@ -847,7 +847,7 @@ function __construct()
foreach ($alltables as $table) {
if (! isset($this->_tables[$table])) {
- $this->_tables[$table] = new Table_Stats(
+ $this->_tables[$table] = new Table_Stats_EPS(
$table, $eps->getFont(), $eps->getFontSize(), $this->pageNumber,
$this->_tablewidth, $this->showKeys, $this->tableDimension
);
@@ -886,7 +886,6 @@ function __construct()
$this->_drawTables($this->showColor);
$eps->endEpsDoc();
$eps->showOutput($db.'-'.$this->pageNumber);
- exit();
}
/**
@@ -903,25 +902,25 @@ function __construct()
* @return void
*
* @access private
- * @see _setMinMax,Table_Stats::__construct(),Relation_Stats::__construct()
+ * @see _setMinMax,Table_Stats_EPS::__construct(),Relation_Stats_EPS::__construct()
*/
private function _addRelation(
$masterTable, $font, $fontSize, $masterField,
$foreignTable, $foreignField, $showInfo
) {
if (! isset($this->_tables[$masterTable])) {
- $this->_tables[$masterTable] = new Table_Stats(
+ $this->_tables[$masterTable] = new Table_Stats_EPS(
$masterTable, $font, $fontSize, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
}
if (! isset($this->_tables[$foreignTable])) {
- $this->_tables[$foreignTable] = new Table_Stats(
+ $this->_tables[$foreignTable] = new Table_Stats_EPS(
$foreignTable, $font, $fontSize, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
}
- $this->_relations[] = new Relation_Stats(
+ $this->_relations[] = new Relation_Stats_EPS(
$this->_tables[$masterTable], $masterField,
$this->_tables[$foreignTable], $foreignField
);
@@ -936,7 +935,7 @@ private function _addRelation(
* @return void
*
* @access private
- * @see Relation_Stats::relationDraw()
+ * @see Relation_Stats_EPS::relationDraw()
*/
private function _drawRelations($changeColor)
{
@@ -953,7 +952,7 @@ private function _drawRelations($changeColor)
* @return void
*
* @access private
- * @see Table_Stats::Table_Stats_tableDraw()
+ * @see Table_Stats_EPS::Table_Stats_tableDraw()
*/
private function _drawTables($changeColor)
{
View
31 libraries/schema/Pdf_Relation_Schema.class.php
@@ -357,11 +357,11 @@ function NbLines($w, $txt)
* This class preserves the table co-ordinates,fields
* and helps in drawing/generating the Tables in PDF document.
*
- * @name Table_Stats
+ * @name Table_Stats_PDF
* @package PhpMyAdmin
* @see PMA_Schema_PDF
*/
-class Table_Stats
+class Table_Stats_PDF
{
/**
* Defines properties
@@ -379,7 +379,7 @@ class Table_Stats
private $_ff = PMA_PDF_FONT;
/**
- * The "Table_Stats" constructor
+ * The "Table_Stats_PDF" constructor
*
* @param string $tableName The table name
* @param integer $fontSize The font size
@@ -395,8 +395,8 @@ class Table_Stats
*
* @return void
*
- * @see PMA_Schema_PDF, Table_Stats::Table_Stats_setWidth,
- * Table_Stats::Table_Stats_setHeight
+ * @see PMA_Schema_PDF, Table_Stats_PDF::Table_Stats_setWidth,
+ * Table_Stats_PDF::Table_Stats_setHeight
*/
function __construct($tableName, $fontSize, $pageNumber, &$sameWideWidth,
$showKeys = false, $showInfo = false
@@ -623,12 +623,12 @@ public function tableDraw($fontSize, $withDoc, $setColor = 0)
* master table's master field to foreign table's foreign key
* in PDF document.
*
- * @name Relation_Stats
+ * @name Relation_Stats_PDF
* @package PhpMyAdmin
* @see PMA_Schema_PDF::SetDrawColor, PMA_Schema_PDF::setLineWidthScale,
* PMA_Schema_PDF::lineScale
*/
-class Relation_Stats
+class Relation_Stats_PDF
{
/**
* Defines properties
@@ -640,7 +640,7 @@ class Relation_Stats
public $wTick = 5;
/**
- * The "Relation_Stats" constructor
+ * The "Relation_Stats_PDF" constructor
*
* @param string $master_table The master table name
* @param string $master_field The relation field in the master table
@@ -649,7 +649,7 @@ class Relation_Stats
*
* @return void
*
- * @see Relation_Stats::_getXy
+ * @see Relation_Stats_PDF::_getXy
*/
function __construct($master_table, $master_field, $foreign_table,
$foreign_field
@@ -897,7 +897,7 @@ function __construct()
/* snip */
foreach ($alltables as $table) {
if (! isset($this->_tables[$table])) {
- $this->_tables[$table] = new Table_Stats(
+ $this->_tables[$table] = new Table_Stats_PDF(
$table,
null,
$this->pageNumber,
@@ -968,7 +968,6 @@ function __construct()
}
$this->_drawTables($this->showColor);
$this->_showOutput($this->pageNumber);
- exit();
}
/**
@@ -1007,20 +1006,20 @@ private function _addRelation($masterTable, $masterField, $foreignTable,
$foreignField, $showInfo
) {
if (! isset($this->_tables[$masterTable])) {
- $this->_tables[$masterTable] = new Table_Stats(
+ $this->_tables[$masterTable] = new Table_Stats_PDF(
$masterTable, null, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
$this->_setMinMax($this->_tables[$masterTable]);
}
if (! isset($this->_tables[$foreignTable])) {
- $this->_tables[$foreignTable] = new Table_Stats(
+ $this->_tables[$foreignTable] = new Table_Stats_PDF(
$foreignTable, null, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
$this->_setMinMax($this->_tables[$foreignTable]);
}
- $this->relations[] = new Relation_Stats(
+ $this->relations[] = new Relation_Stats_PDF(
$this->_tables[$masterTable], $masterField,
$this->_tables[$foreignTable], $foreignField
);
@@ -1099,7 +1098,7 @@ private function _strokeGrid()
*
* @return void
*
- * @see Relation_Stats::relationdraw()
+ * @see Relation_Stats_PDF::relationdraw()
*/
private function _drawRelations($changeColor)
{
@@ -1119,7 +1118,7 @@ private function _drawRelations($changeColor)
*
* @return void
*
- * @see Table_Stats::tableDraw()
+ * @see Table_Stats_PDF::tableDraw()
*/
private function _drawTables($changeColor = 0)
{
View
35 libraries/schema/Svg_Relation_Schema.class.php
@@ -336,10 +336,10 @@ function getStringWidth($text,$font,$fontSize)
* and helps in drawing/generating the Tables in SVG XML document.
*
* @package PhpMyAdmin
- * @name Table_Stats
+ * @name Table_Stats_SVG
* @see PMA_SVG
*/
-class Table_Stats
+class Table_Stats_SVG
{
/**
* Defines properties
@@ -357,7 +357,7 @@ class Table_Stats
public $primary = array();
/**
- * The "Table_Stats" constructor
+ * The "Table_Stats_SVG" constructor
*
* @param string $tableName The table name
* @param string $font Font face
@@ -375,8 +375,8 @@ class Table_Stats
*
* @access private
*
- * @see PMA_SVG, Table_Stats::Table_Stats_setWidth,
- * Table_Stats::Table_Stats_setHeight
+ * @see PMA_SVG, Table_Stats_SVG::Table_Stats_setWidth,
+ * Table_Stats_SVG::Table_Stats_setHeight
*/
function __construct(
$tableName, $font, $fontSize, $pageNumber,
@@ -591,10 +591,10 @@ public function tableDraw($showColor)
* in SVG XML document.
*
* @package PhpMyAdmin
- * @name Relation_Stats
+ * @name Relation_Stats_SVG
* @see PMA_SVG::printElementLine
*/
-class Relation_Stats
+class Relation_Stats_SVG
{
/**
* Defines properties
@@ -606,7 +606,7 @@ class Relation_Stats
public $wTick = 10;
/**
- * The "Relation_Stats" constructor
+ * The "Relation_Stats_SVG" constructor
*
* @param string $master_table The master table name
* @param string $master_field The relation field in the master table
@@ -615,7 +615,7 @@ class Relation_Stats
*
* @return void
*
- * @see Relation_Stats::_getXy
+ * @see Relation_Stats_SVG::_getXy
*/
function __construct($master_table, $master_field, $foreign_table, $foreign_field)
{
@@ -757,7 +757,7 @@ public function relationDraw($changeColor)
}
}
/*
-* end of the "Relation_Stats" class
+* end of the "Relation_Stats_SVG" class
*/
/**
@@ -822,7 +822,7 @@ function __construct()
foreach ($alltables as $table) {
if (! isset($this->_tables[$table])) {
- $this->_tables[$table] = new Table_Stats(
+ $this->_tables[$table] = new Table_Stats_SVG(
$table, $svg->getFont(), $svg->getFontSize(), $this->pageNumber,
$this->_tablewidth, $this->showKeys, $this->tableDimension
);
@@ -861,7 +861,6 @@ function __construct()
$this->_drawTables($this->showColor);
$svg->endSvgDoc();
$svg->showOutput($db.'-'.$this->pageNumber);
- exit();
}
/**
@@ -894,27 +893,27 @@ private function _setMinMax($table)
* @access private
* @return void
*
- * @see _setMinMax,Table_Stats::__construct(),Relation_Stats::__construct()
+ * @see _setMinMax,Table_Stats_SVG::__construct(),Relation_Stats_SVG::__construct()
*/
private function _addRelation(
$masterTable,$font,$fontSize, $masterField,
$foreignTable, $foreignField, $showInfo
) {
if (! isset($this->_tables[$masterTable])) {
- $this->_tables[$masterTable] = new Table_Stats(
+ $this->_tables[$masterTable] = new Table_Stats_SVG(
$masterTable, $font, $fontSize, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
$this->_setMinMax($this->_tables[$masterTable]);
}
if (! isset($this->_tables[$foreignTable])) {
- $this->_tables[$foreignTable] = new Table_Stats(
+ $this->_tables[$foreignTable] = new Table_Stats_SVG(
$foreignTable, $font, $fontSize, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
$this->_setMinMax($this->_tables[$foreignTable]);
}
- $this->_relations[] = new Relation_Stats(
+ $this->_relations[] = new Relation_Stats_SVG(
$this->_tables[$masterTable], $masterField,
$this->_tables[$foreignTable], $foreignField
);
@@ -930,7 +929,7 @@ private function _addRelation(
* @return void
* @access private
*
- * @see Relation_Stats::relationDraw()
+ * @see Relation_Stats_SVG::relationDraw()
*/
private function _drawRelations($changeColor)
{
@@ -947,7 +946,7 @@ private function _drawRelations($changeColor)
* @return void
* @access private
*
- * @see Table_Stats::Table_Stats_tableDraw()
+ * @see Table_Stats_SVG::Table_Stats_tableDraw()
*/
private function _drawTables($changeColor)
{
View
95 test/classes/schema/Dia_Relation_Schema_test.php
@@ -0,0 +1,95 @@
+<?php
+/**
+ * Tests for PMA_Dia_Relation_Schema class
+ *
+ * @package PhpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+
+require_once 'libraries/schema/Dia_Relation_Schema.class.php';
+
+/**
+ * Tests for PMA_Dia_Relation_Schema class
+ *
+ * @package PhpMyAdmin-test
+ */
+class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @access protected
+ */
+ protected $object;
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ * @return void
+ */
+ protected function setUp()
+ {
+ $_POST['pdf_page_number'] = 33;
+ $_POST['show_grid'] = true;
+ $_POST['show_color'] = 'on';
+ $_POST['show_keys'] = true;
+ $_POST['orientation'] = 'orientation';
+ $_POST['paper'] = 'paper';
+ $_POST['export_type'] = 'PMA_ExportType';
+ $this->object = new PMA_Dia_Relation_Schema();
+ }
+
+ /**
+ * 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 construct
+ *
+ * @return void
+ *
+ * @group medium
+ */
+ public function testConstructor()
+ {
+ $this->assertEquals(
+ 33,
+ $this->object->pageNumber
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->showGrid
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->showColor
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->showKeys
+ );
+ $this->assertEquals(
+ 'P',
+ $this->object->orientation
+ );
+ $this->assertEquals(
+ 'paper',
+ $this->object->paper
+ );
+ $this->assertEquals(
+ 'PMA_ExportType',
+ $this->object->exportType
+ );
+ }
+}
View
113 test/classes/schema/Eps_Relation_Schema_test.php
@@ -0,0 +1,113 @@
+<?php
+/**
+ * Tests for PMA_Eps_Relation_Schema class
+ *
+ * @package PhpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+
+require_once 'libraries/schema/Eps_Relation_Schema.class.php';
+
+/**
+ * Tests for PMA_Eps_Relation_Schema class
+ *
+ * @package PhpMyAdmin-test
+ */
+class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @access protected
+ */
+ protected $object;
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ * @return void
+ */
+ protected function setUp()
+ {
+ $_POST['pdf_page_number'] = 33;
+ $_POST['show_grid'] = true;
+ $_POST['show_color'] = 'on';
+ $_POST['show_keys'] = true;
+ $_POST['orientation'] = 'orientation';
+ $_POST['show_table_dimension'] = 'on';
+ $_POST['all_tables_same_width'] = 'on';
+ $_POST['paper'] = 'paper';
+ $_POST['export_type'] = 'PMA_ExportType';
+ $this->object = new PMA_Eps_Relation_Schema();
+ }
+
+ /**
+ * 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 construct
+ *
+ * @return void
+ *
+ * @group medium
+ */
+ public function testConstructor()
+ {
+ $this->assertEquals(
+ 33,
+ $this->object->pageNumber
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->showColor
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->showKeys
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->tableDimension
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->sameWide
+ );
+ $this->assertEquals(
+ 'L',
+ $this->object->orientation
+ );
+ $this->assertEquals(
+ 'PMA_ExportType',
+ $this->object->exportType
+ );
+ }
+
+ /**
+ * Test for setPageNumber
+ *
+ * @return void
+ *
+ * @group medium
+ */
+ public function testSetPageNumbere()
+ {
+ $this->object->setPageNumber(33);
+ $this->assertEquals(
+ 33,
+ $this->object->pageNumber
+ );
+ }
+}
View
110 test/classes/schema/Pdf_Relation_Schema_test.php
@@ -0,0 +1,110 @@
+<?php
+/**
+ * Tests for PMA_Pdf_Relation_Schema class
+ *
+ * @package PhpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+
+require_once 'libraries/schema/Pdf_Relation_Schema.class.php';
+
+/**
+ * Tests for PMA_Pdf_Relation_Schema class
+ *
+ * @package PhpMyAdmin-test
+ */
+class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @access protected
+ */
+ protected $object;
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ * @return void
+ */
+ protected function setUp()
+ {
+ $_POST['pdf_page_number'] = 33;
+ $_POST['show_grid'] = true;
+ $_POST['show_color'] = 'on';
+ $_POST['show_keys'] = true;
+ $_POST['orientation'] = 'orientation';
+ $_POST['show_table_dimension'] = 'on';
+ $_POST['all_tables_same_width'] = 'on';
+ $_POST['paper'] = 'paper';
+ $_POST['export_type'] = 'PMA_ExportType';
+ $_POST['with_doc'] = 'on';
+ $this->object = new PMA_Pdf_Relation_Schema();
+ }
+
+ /**
+ * 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 construct
+ *
+ * @return void
+ *
+ * @group medium
+ */
+ public function testConstructor()
+ {
+ $this->assertEquals(
+ 33,
+ $this->object->pageNumber
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->showGrid
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->showColor
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->showKeys
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->tableDimension
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->sameWide
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->withDoc
+ );
+ $this->assertEquals(
+ 'L',
+ $this->object->orientation
+ );
+ $this->assertEquals(
+ 'PMA_ExportType',
+ $this->object->exportType
+ );
+ $this->assertEquals(
+ 'paper',
+ $this->object->paper
+ );
+ }
+}
View
94 test/classes/schema/Svg_Relation_Schema_test.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Tests for PMA_Svg_Relation_Schema class
+ *
+ * @package PhpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+
+require_once 'libraries/schema/Svg_Relation_Schema.class.php';
+
+/**
+ * Tests for PMA_Svg_Relation_Schema class
+ *
+ * @package PhpMyAdmin-test
+ */
+class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @access protected
+ */
+ protected $object;
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ * @return void
+ */
+ protected function setUp()
+ {
+ $_POST['pdf_page_number'] = 33;
+ $_POST['show_grid'] = true;
+ $_POST['show_color'] = 'on';
+ $_POST['show_keys'] = true;
+ $_POST['orientation'] = 'orientation';
+ $_POST['show_table_dimension'] = 'on';
+ $_POST['all_tables_same_width'] = 'on';
+ $_POST['paper'] = 'paper';
+ $_POST['export_type'] = 'PMA_ExportType';
+ $_POST['with_doc'] = 'on';
+ $this->object = new PMA_Svg_Relation_Schema();
+ }
+
+ /**
+ * 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 construct
+ *
+ * @return void
+ *
+ * @group medium
+ */
+ public function testConstructor()
+ {
+ $this->assertEquals(
+ 33,
+ $this->object->pageNumber
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->showColor
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->showKeys
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->tableDimension
+ );
+ $this->assertEquals(
+ 1,
+ $this->object->sameWide
+ );
+ $this->assertEquals(
+ 'PMA_ExportType',
+ $this->object->exportType
+ );
+ }
+}
Something went wrong with that request. Please try again.