Update tests

Signed-off-by: Bimal Yashodha <kb.yashodha@gmail.com>
This commit is contained in:
Bimal Yashodha 2014-08-10 00:16:57 +05:30
parent 7259665f94
commit a32465f398
7 changed files with 204 additions and 197 deletions

View File

@ -54,6 +54,16 @@ class PMA_Export_Relation_Schema
$this->pageNumber = $value;
}
/**
* Returns the schema page number
*
* @return integer schema page number
*/
public function getPageNumber()
{
return $this->pageNumber;
}
/**
* Sets showColor
*
@ -66,6 +76,16 @@ class PMA_Export_Relation_Schema
$this->showColor = $value;
}
/**
* Returns whether to show colors
*
* @return boolean whether to show colors
*/
public function isShowColor()
{
return $this->showColor;
}
/**
* Set Table Dimension
*
@ -80,6 +100,16 @@ class PMA_Export_Relation_Schema
$this->tableDimension = $value;
}
/**
* Returns whether to show table dimensions
*
* @return boolean whether to show table dimensions
*/
public function isTableDimension()
{
return $this->tableDimension;
}
/**
* Set same width of All Tables
*
@ -94,6 +124,16 @@ class PMA_Export_Relation_Schema
$this->sameWide = $value;
}
/**
* Returns whether to use same width for all tables or not
*
* @return boolean whether to use same width for all tables or not
*/
public function isAllTableSameWidth()
{
return $this->sameWide;
}
/**
* Set Show only keys
*
@ -108,6 +148,16 @@ class PMA_Export_Relation_Schema
$this->showKeys = $value;
}
/**
* Returns whether to show keys
*
* @return boolean whether to show keys
*/
public function isShowKeys()
{
return $this->showKeys;
}
/**
* Set Orientation
*
@ -122,6 +172,16 @@ class PMA_Export_Relation_Schema
$this->orientation = ($value == 'P') ? 'P' : 'L';
}
/**
* Returns orientation
*
* @return string orientation
*/
public function getOrientation()
{
return $this->orientation;
}
/**
* Set type of paper
*
@ -136,10 +196,20 @@ class PMA_Export_Relation_Schema
$this->paper = $value;
}
/**
* Returns the paper size
*
* @return string paper size
*/
public function getPaper()
{
return $this->paper;
}
/**
* Set whether the document is generated from client side DB
*
* @param string $value 'on' if offline
* @param string $value offline or not
*
* @return void
*

View File

@ -610,7 +610,17 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
*/
public function setShowGrid($value)
{
$this->_showGrid = (isset($value) && $value == 'on');
$this->_showGrid = $value;
}
/**
* Returns whether to show grid
*
* @return boolean whether to show grid
*/
public function isShowGrid()
{
return $this->_showGrid;
}
/**
@ -624,7 +634,17 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
*/
public function setWithDataDictionary($value)
{
$this->_withDoc = (isset($value) && $value == 'on');
$this->_withDoc = $value;
}
/**
* Return whether to show selected database data dictionary or not
*
* @return boolean whether to show selected database data dictionary or not
*/
public function isWithDataDictionary()
{
return $this->_withDoc;
}
/**

View File

@ -16,7 +16,7 @@ require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/Index.class.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/Response.class.php';
require_once 'libraries/schema/Dia_Relation_Schema.class.php';
require_once 'libraries/plugins/schema/dia/Dia_Relation_Schema.class.php';
/**
* Tests for PMA_Dia_Relation_Schema class
@ -39,14 +39,13 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
*/
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';
$_POST['offline_export'] = false;
$_REQUEST['page_number'] = 33;
$_REQUEST['offline_export'] = false;
$_REQUEST['dia_show_color'] = true;
$_REQUEST['dia_show_keys'] = true;
$_REQUEST['dia_orientation'] = 'orientation';
$_REQUEST['dia_paper'] = 'paper';
$GLOBALS['server'] = 1;
$GLOBALS['controllink'] = null;
$GLOBALS['db'] = 'information_schema';
@ -153,31 +152,23 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
{
$this->assertEquals(
33,
$this->object->pageNumber
$this->object->getPageNumber()
);
$this->assertEquals(
1,
$this->object->showGrid
true,
$this->object->isShowColor()
);
$this->assertEquals(
1,
$this->object->showColor
);
$this->assertEquals(
1,
$this->object->showKeys
true,
$this->object->isShowKeys()
);
$this->assertEquals(
'P',
$this->object->orientation
$this->object->getOrientation()
);
$this->assertEquals(
'paper',
$this->object->paper
);
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType
$this->object->getPaper()
);
}
}

View File

@ -15,7 +15,7 @@ require_once 'libraries/sqlparser.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/Index.class.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/schema/Eps_Relation_Schema.class.php';
require_once 'libraries/plugins/schema/eps/Eps_Relation_Schema.class.php';
/**
* Tests for PMA_Eps_Relation_Schema class
@ -38,16 +38,14 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
*/
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['offline_export'] = false;
$_REQUEST['page_number'] = 33;
$_REQUEST['offline_export'] = false;
$_REQUEST['eps_show_color'] = true;
$_REQUEST['eps_show_keys'] = true;
$_REQUEST['eps_orientation'] = 'orientation';
$_REQUEST['eps_show_table_dimension'] = true;
$_REQUEST['eps_all_tables_same_width'] = true;
$GLOBALS['server'] = 1;
$GLOBALS['controllink'] = null;
$GLOBALS['db'] = 'information_schema';
@ -154,31 +152,27 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
{
$this->assertEquals(
33,
$this->object->pageNumber
$this->object->getPageNumber()
);
$this->assertEquals(
1,
$this->object->showColor
true,
$this->object->isShowColor()
);
$this->assertEquals(
1,
$this->object->showKeys
true,
$this->object->isShowKeys()
);
$this->assertEquals(
1,
$this->object->tableDimension
true,
$this->object->isTableDimension()
);
$this->assertEquals(
1,
$this->object->sameWide
true,
$this->object->isAllTableSameWidth()
);
$this->assertEquals(
'L',
$this->object->orientation
);
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType
$this->object->getOrientation()
);
}
@ -194,7 +188,7 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$this->object->setPageNumber(33);
$this->assertEquals(
33,
$this->object->pageNumber
$this->object->getPageNumber()
);
}
}

View File

@ -13,7 +13,7 @@ require_once 'libraries/relation.lib.php';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/schema/Export_Relation_Schema.class.php';
require_once 'libraries/plugins/schema/Export_Relation_Schema.class.php';
/**
* Tests for PMA_Export_Relation_Schema class
@ -36,6 +36,8 @@ class PMA_Export_Relation_Schema_Test extends PHPUnit_Framework_TestCase
*/
protected function setUp()
{
$_REQUEST['page_number'] = 33;
$_REQUEST['offline_export'] = false;
$this->object = new PMA_Export_Relation_Schema();
}
@ -63,44 +65,7 @@ class PMA_Export_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$this->object->setPageNumber(33);
$this->assertEquals(
33,
$this->object->pageNumber
);
}
/**
* Test for setShowGrid
*
* @return void
*
* @group medium
*/
public function testSetShowGrid()
{
$this->object->setShowGrid('on');
$this->assertEquals(
1,
$this->object->showGrid
);
$this->object->setShowGrid('off');
$this->assertEquals(
0,
$this->object->showGrid
);
}
/**
* Test for setExportType
*
* @return void
*
* @group medium
*/
public function testSetExportType()
{
$this->object->setExportType('PMA_ExportType');
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType
$this->object->getPageNumber()
);
}
@ -113,15 +78,15 @@ class PMA_Export_Relation_Schema_Test extends PHPUnit_Framework_TestCase
*/
public function testSetShowColor()
{
$this->object->setShowColor('on');
$this->object->setShowColor(true);
$this->assertEquals(
1,
$this->object->showColor
true,
$this->object->isShowColor()
);
$this->object->setShowColor('off');
$this->object->setShowColor(false);
$this->assertEquals(
0,
$this->object->showColor
false,
$this->object->isShowColor()
);
}
@ -137,12 +102,12 @@ class PMA_Export_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$this->object->setOrientation('P');
$this->assertEquals(
'P',
$this->object->orientation
$this->object->getOrientation()
);
$this->object->setOrientation('A');
$this->assertEquals(
'L',
$this->object->orientation
$this->object->getOrientation()
);
}
@ -155,15 +120,15 @@ class PMA_Export_Relation_Schema_Test extends PHPUnit_Framework_TestCase
*/
public function testSetTableDimension()
{
$this->object->setTableDimension('on');
$this->object->setTableDimension(true);
$this->assertEquals(
1,
$this->object->tableDimension
true,
$this->object->isTableDimension()
);
$this->object->setTableDimension('off');
$this->object->setTableDimension(false);
$this->assertEquals(
0,
$this->object->tableDimension
false,
$this->object->isTableDimension()
);
}
@ -179,12 +144,12 @@ class PMA_Export_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$this->object->setPaper('A5');
$this->assertEquals(
'A5',
$this->object->paper
$this->object->getPaper()
);
$this->object->setPaper('A4');
$this->assertEquals(
'A4',
$this->object->paper
$this->object->getPaper()
);
}
@ -197,36 +162,15 @@ class PMA_Export_Relation_Schema_Test extends PHPUnit_Framework_TestCase
*/
public function testSetAllTablesSameWidth()
{
$this->object->setAllTablesSameWidth('on');
$this->object->setAllTablesSameWidth(true);
$this->assertEquals(
1,
$this->object->sameWide
true,
$this->object->isAllTableSameWidth()
);
$this->object->setAllTablesSameWidth('off');
$this->object->setAllTablesSameWidth(false);
$this->assertEquals(
0,
$this->object->sameWide
);
}
/**
* Test for setWithDataDictionary
*
* @return void
*
* @group medium
*/
public function testSetWithDataDictionary()
{
$this->object->setWithDataDictionary('on');
$this->assertEquals(
1,
$this->object->withDoc
);
$this->object->setWithDataDictionary('off');
$this->assertEquals(
0,
$this->object->withDoc
false,
$this->object->isAllTableSameWidth()
);
}
@ -239,15 +183,15 @@ class PMA_Export_Relation_Schema_Test extends PHPUnit_Framework_TestCase
*/
public function testSetShowKeys()
{
$this->object->setShowKeys('on');
$this->object->setShowKeys(true);
$this->assertEquals(
1,
$this->object->showKeys
true,
$this->object->isShowKeys()
);
$this->object->setShowKeys('off');
$this->object->setShowKeys(false);
$this->assertEquals(
0,
$this->object->showKeys
false,
$this->object->isShowKeys()
);
}
}

View File

@ -17,7 +17,7 @@ require_once 'libraries/Index.class.php';
require_once 'libraries/Table.class.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/transformations.lib.php';
require_once 'libraries/schema/Pdf_Relation_Schema.class.php';
require_once 'libraries/plugins/schema/pdf/Pdf_Relation_Schema.class.php';
/**
* Tests for PMA_Pdf_Relation_Schema class
@ -40,17 +40,17 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
*/
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';
$_POST['offline_export'] = false;
$_REQUEST['page_number'] = 33;
$_REQUEST['offline_export'] = false;
$_REQUEST['pdf_show_grid'] = true;
$_REQUEST['pdf_show_color'] = true;
$_REQUEST['pdf_show_keys'] = true;
$_REQUEST['pdf_orientation'] = 'orientation';
$_REQUEST['pdf_show_table_dimension'] = true;
$_REQUEST['pdf_all_tables_same_width'] = true;
$_REQUEST['pdf_paper'] = 'paper';
$_REQUEST['pdf_with_doc'] = true;
$GLOBALS['server'] = 1;
$GLOBALS['controllink'] = null;
$GLOBALS['db'] = 'information_schema';
@ -203,43 +203,39 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
{
$this->assertEquals(
33,
$this->object->pageNumber
$this->object->getPageNumber()
);
$this->assertEquals(
1,
$this->object->showGrid
true,
$this->object->isShowGrid()
);
$this->assertEquals(
1,
$this->object->showColor
true,
$this->object->isShowColor()
);
$this->assertEquals(
1,
$this->object->showKeys
true,
$this->object->isShowKeys()
);
$this->assertEquals(
1,
$this->object->tableDimension
true,
$this->object->isTableDimension()
);
$this->assertEquals(
1,
$this->object->sameWide
true,
$this->object->isAllTableSameWidth()
);
$this->assertEquals(
1,
$this->object->withDoc
true,
$this->object->isWithDataDictionary()
);
$this->assertEquals(
'L',
$this->object->orientation
);
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType
$this->object->getOrientation()
);
$this->assertEquals(
'paper',
$this->object->paper
$this->object->getPaper()
);
}
}

View File

@ -15,7 +15,7 @@ require_once 'libraries/sqlparser.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/Index.class.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/schema/Svg_Relation_Schema.class.php';
require_once 'libraries/plugins/schema/svg/Svg_Relation_Schema.class.php';
/**
* Tests for PMA_Svg_Relation_Schema class
@ -38,17 +38,13 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
*/
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';
$_POST['offline_export'] = false;
$_REQUEST['page_number'] = 33;
$_REQUEST['offline_export'] = false;
$_REQUEST['svg_show_color'] = true;
$_REQUEST['svg_show_keys'] = true;
$_REQUEST['svg_show_table_dimension'] = true;
$_REQUEST['svg_all_tables_same_width'] = true;
$GLOBALS['server'] = 1;
$GLOBALS['controllink'] = null;
$GLOBALS['db'] = 'information_schema';
@ -155,27 +151,23 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
{
$this->assertEquals(
33,
$this->object->pageNumber
$this->object->getPageNumber()
);
$this->assertEquals(
1,
$this->object->showColor
true,
$this->object->isShowColor()
);
$this->assertEquals(
1,
$this->object->showKeys
true,
$this->object->isShowKeys()
);
$this->assertEquals(
1,
$this->object->tableDimension
true,
$this->object->isTableDimension()
);
$this->assertEquals(
1,
$this->object->sameWide
);
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType
true,
$this->object->isAllTableSameWidth()
);
}
}