Initial commit
This commit is contained in:
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for PMA\libraries\properties\options\OptionsPropertyGroup class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests for PMA\libraries\properties\options\OptionsPropertyGroup class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class OptionsPropertyGroupTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $stub;
|
||||
|
||||
/**
|
||||
* Configures global environment.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setup()
|
||||
{
|
||||
$this->stub = $this->getMockForAbstractClass('PMA\libraries\properties\options\OptionsPropertyGroup');
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown for test cases
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
unset($this->stub);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\OptionsPropertyGroup::addProperty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddProperty()
|
||||
{
|
||||
$properties = new \ReflectionProperty('PMA\libraries\properties\options\OptionsPropertyGroup', '_properties');
|
||||
$properties->setAccessible(true);
|
||||
|
||||
$properties->setValue($this->stub, array(1, 2, 3));
|
||||
|
||||
$this->assertNull(
|
||||
$this->stub->addProperty(2)
|
||||
);
|
||||
|
||||
$this->stub->addProperty('2');
|
||||
|
||||
$this->assertEquals(
|
||||
array(1, 2, 3, '2'),
|
||||
$properties->getValue($this->stub)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\OptionsPropertyGroup::removeProperty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testRemoveProperty()
|
||||
{
|
||||
$properties = new \ReflectionProperty('PMA\libraries\properties\options\OptionsPropertyGroup', '_properties');
|
||||
$properties->setAccessible(true);
|
||||
|
||||
$properties->setValue($this->stub, array(1, 2, 'test', 3));
|
||||
$this->stub->removeProperty('test');
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
0 => 1,
|
||||
1 => 2,
|
||||
3 => 3
|
||||
),
|
||||
$properties->getValue($this->stub)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\OptionsPropertyGroup::getGroup
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetGroup()
|
||||
{
|
||||
$this->assertInstanceOf(
|
||||
'PMA\libraries\properties\options\OptionsPropertyGroup',
|
||||
$this->stub->getGroup()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\OptionsPropertyGroup::getProperties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetProperties()
|
||||
{
|
||||
$properties = new \ReflectionProperty('PMA\libraries\properties\options\OptionsPropertyGroup', '_properties');
|
||||
$properties->setAccessible(true);
|
||||
$properties->setValue($this->stub, array(1, 2, 3));
|
||||
|
||||
$this->assertEquals(
|
||||
array(1, 2, 3),
|
||||
$this->stub->getProperties()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\OptionsPropertyGroup::getProperties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetNrOfProperties()
|
||||
{
|
||||
$properties = new \ReflectionProperty('PMA\libraries\properties\options\OptionsPropertyGroup', '_properties');
|
||||
$properties->setAccessible(true);
|
||||
$properties->setValue($this->stub, array(1, 2, 3));
|
||||
|
||||
$this->assertEquals(
|
||||
3,
|
||||
$this->stub->getNrOfProperties()
|
||||
);
|
||||
}
|
||||
}
|
107
#pma/test/classes/properties/options/OptionsPropertyItemTest.php
Normal file
107
#pma/test/classes/properties/options/OptionsPropertyItemTest.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for PMA\libraries\properties\options\OptionsPropertyItem class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests for PMA\libraries\properties\options\OptionsPropertyItem class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class OptionsPropertyItemTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $stub;
|
||||
|
||||
/**
|
||||
* Configures global environment.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setup()
|
||||
{
|
||||
$this->stub = $this->getMockForAbstractClass('PMA\libraries\properties\options\OptionsPropertyItem');
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown for test cases
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
unset($this->stub);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for
|
||||
* - PMA\libraries\properties\options\OptionsPropertyItem::getName
|
||||
* - PMA\libraries\properties\options\OptionsPropertyItem::setName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetSetName()
|
||||
{
|
||||
$this->stub->setName('name123');
|
||||
|
||||
$this->assertEquals(
|
||||
'name123',
|
||||
$this->stub->getName()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for
|
||||
* - PMA\libraries\properties\options\OptionsPropertyItem::getText
|
||||
* - PMA\libraries\properties\options\OptionsPropertyItem::setText
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetSetText()
|
||||
{
|
||||
$this->stub->setText('text123');
|
||||
|
||||
$this->assertEquals(
|
||||
'text123',
|
||||
$this->stub->getText()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for
|
||||
* - PMA\libraries\properties\options\OptionsPropertyItem::getForce
|
||||
* - PMA\libraries\properties\options\OptionsPropertyItem::setForce
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetSetForce()
|
||||
{
|
||||
$this->stub->setForce('force123');
|
||||
|
||||
$this->assertEquals(
|
||||
'force123',
|
||||
$this->stub->getForce()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\OptionsPropertyItem::getPropertyType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetPropertyType()
|
||||
{
|
||||
if ((defined('HHVM_VERSION')
|
||||
&& (version_compare(constant('HHVM_VERSION'), '3.8', 'lt')))
|
||||
) {
|
||||
$this->markTestSkipped('Due to a bug in early versions of HHVM, this test cannot be completed.');
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
'options',
|
||||
$this->stub->getPropertyType()
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for PMA\libraries\properties\options\OptionsPropertyOneItem class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests for PMA\libraries\properties\options\OptionsPropertyOneItem class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class OptionsPropertyOneItemTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $stub;
|
||||
|
||||
/**
|
||||
* Configures global environment.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setup()
|
||||
{
|
||||
$this->stub = $this->getMockForAbstractClass('PMA\libraries\properties\options\OptionsPropertyOneItem');
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown for test cases
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
unset($this->stub);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for
|
||||
* - PMA\libraries\properties\options\OptionsPropertyOneItem::getValues
|
||||
* - PMA\libraries\properties\options\OptionsPropertyOneItem::setValues
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetSetValues()
|
||||
{
|
||||
$this->stub->setValues(array(1, 2));
|
||||
|
||||
$this->assertEquals(
|
||||
array(1, 2),
|
||||
$this->stub->getValues()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for
|
||||
* - PMA\libraries\properties\options\OptionsPropertyOneItem::getLen
|
||||
* - PMA\libraries\properties\options\OptionsPropertyOneItem::setLen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetSetLen()
|
||||
{
|
||||
$this->stub->setLen(12);
|
||||
|
||||
$this->assertEquals(
|
||||
12,
|
||||
$this->stub->getLen()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for
|
||||
* - PMA\libraries\properties\options\OptionsPropertyOneItem::getForce
|
||||
* - PMA\libraries\properties\options\OptionsPropertyOneItem::setForce
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetSetForce()
|
||||
{
|
||||
$this->stub->setForce('force123');
|
||||
|
||||
$this->assertEquals(
|
||||
'force123',
|
||||
$this->stub->getForce()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for
|
||||
* - PMA\libraries\properties\options\OptionsPropertyOneItem::getDoc
|
||||
* - PMA\libraries\properties\options\OptionsPropertyOneItem::setDoc
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetSetDoc()
|
||||
{
|
||||
$this->stub->setDoc('doc123');
|
||||
|
||||
$this->assertEquals(
|
||||
'doc123',
|
||||
$this->stub->getDoc()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for
|
||||
* - PMA\libraries\properties\options\OptionsPropertyOneItem::getSize
|
||||
* - PMA\libraries\properties\options\OptionsPropertyOneItem::setSize
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetSetSize()
|
||||
{
|
||||
$this->stub->setSize(22);
|
||||
|
||||
$this->assertEquals(
|
||||
22,
|
||||
$this->stub->getSize()
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for PMA\libraries\properties\options\groups\OptionsPropertyMainGroup class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
use PMA\libraries\properties\options\groups\OptionsPropertyMainGroup;
|
||||
|
||||
/**
|
||||
* tests for PMA\libraries\properties\options\groups\OptionsPropertyMainGroup class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class OptionsPropertyMainGroupTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Configures global environment.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setup()
|
||||
{
|
||||
$this->object = new OptionsPropertyMainGroup();
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown for test cases
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
unset($this->object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\groups\OptionsPropertyMainGroup::getItemType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetItemType()
|
||||
{
|
||||
$this->assertEquals(
|
||||
'main',
|
||||
$this->object->getItemType()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for PMA\libraries\properties\options\groups\OptionsPropertyRootGroup class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
use PMA\libraries\properties\options\groups\OptionsPropertyRootGroup;
|
||||
|
||||
/**
|
||||
* tests for PMA\libraries\properties\options\groups\OptionsPropertyRootGroup class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class OptionsPropertyRootGroupTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Configures global environment.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setup()
|
||||
{
|
||||
$this->object = new OptionsPropertyRootGroup();
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown for test cases
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
unset($this->object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\groups\OptionsPropertyRootGroup::getItemType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetItemType()
|
||||
{
|
||||
$this->assertEquals(
|
||||
'root',
|
||||
$this->object->getItemType()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for PMA\libraries\properties\options\groups\OptionsPropertySubgroup class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
use PMA\libraries\properties\options\groups\OptionsPropertySubgroup;
|
||||
|
||||
/**
|
||||
* tests for PMA\libraries\properties\options\groups\OptionsPropertySubgroup class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class OptionsPropertySubgroupTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Configures global environment.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setup()
|
||||
{
|
||||
$this->object = new OptionsPropertySubgroup();
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown for test cases
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
unset($this->object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\groups\OptionsPropertySubgroup::getItemType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetItemType()
|
||||
{
|
||||
$this->assertEquals(
|
||||
'subgroup',
|
||||
$this->object->getItemType()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for
|
||||
* - PMA\libraries\properties\options\groups\OptionsPropertySubgroup::getSubgroupHeader
|
||||
* - PMA\libraries\properties\options\groups\OptionsPropertySubgroup::setSubgroupHeader
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetSetSubgroupHeader()
|
||||
{
|
||||
$this->object->setSubgroupHeader('subGroupHeader123');
|
||||
|
||||
$this->assertEquals(
|
||||
'subGroupHeader123',
|
||||
$this->object->getSubgroupHeader()
|
||||
);
|
||||
}
|
||||
}
|
174
#pma/test/classes/properties/options/items/PropertyItemsTest.php
Normal file
174
#pma/test/classes/properties/options/items/PropertyItemsTest.php
Normal file
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for *PMA\libraries\properties\PropertyItem class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
use PMA\libraries\properties\options\items\BoolPropertyItem;
|
||||
use PMA\libraries\properties\options\items\DocPropertyItem;
|
||||
use PMA\libraries\properties\options\items\HiddenPropertyItem;
|
||||
use PMA\libraries\properties\options\items\MessageOnlyPropertyItem;
|
||||
use PMA\libraries\properties\options\items\RadioPropertyItem;
|
||||
use PMA\libraries\properties\options\items\SelectPropertyItem;
|
||||
use PMA\libraries\properties\options\items\TextPropertyItem;
|
||||
|
||||
/**
|
||||
* tests for *PMA\libraries\properties\PropertyItem class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class PropertyItemsTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\items\BoolPropertyItem::getText
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBoolText()
|
||||
{
|
||||
$object = new BoolPropertyItem(null, 'Text');
|
||||
|
||||
$this->assertEquals(
|
||||
"Text",
|
||||
$object->getText()
|
||||
);
|
||||
|
||||
$object->setText('xtext2');
|
||||
|
||||
$this->assertEquals(
|
||||
"xtext2",
|
||||
$object->getText()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\items\BoolPropertyItem::getName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBoolName()
|
||||
{
|
||||
$object = new BoolPropertyItem('xname');
|
||||
|
||||
$this->assertEquals(
|
||||
"xname",
|
||||
$object->getName()
|
||||
);
|
||||
|
||||
$object->setName('xname2');
|
||||
|
||||
$this->assertEquals(
|
||||
"xname2",
|
||||
$object->getName()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\items\BoolPropertyItem::getItemType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBoolGetItemType()
|
||||
{
|
||||
$object = new BoolPropertyItem();
|
||||
|
||||
$this->assertEquals(
|
||||
"bool",
|
||||
$object->getItemType()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\items\DocPropertyItem::getItemType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetItemTypeDoc()
|
||||
{
|
||||
$object = new DocPropertyItem();
|
||||
|
||||
$this->assertEquals(
|
||||
"doc",
|
||||
$object->getItemType()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\items\HiddenPropertyItem::getItemType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetItemTypeHidden()
|
||||
{
|
||||
$object = new HiddenPropertyItem();
|
||||
|
||||
$this->assertEquals(
|
||||
"hidden",
|
||||
$object->getItemType()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\items\MessageOnlyPropertyItem::getItemType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetItemTypeMessageOnly()
|
||||
{
|
||||
$object = new MessageOnlyPropertyItem();
|
||||
|
||||
$this->assertEquals(
|
||||
"messageOnly",
|
||||
$object->getItemType()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\items\RadioPropertyItem::getItemType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetItemTypeRadio()
|
||||
{
|
||||
$object = new RadioPropertyItem();
|
||||
|
||||
$this->assertEquals(
|
||||
"radio",
|
||||
$object->getItemType()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\items\SelectPropertyItem::getItemType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetItemTypeSelect()
|
||||
{
|
||||
$object = new SelectPropertyItem();
|
||||
|
||||
$this->assertEquals(
|
||||
"select",
|
||||
$object->getItemType()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA\libraries\properties\options\items\TextPropertyItem::getItemType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetItemTypeText()
|
||||
{
|
||||
$object = new TextPropertyItem();
|
||||
|
||||
$this->assertEquals(
|
||||
"text",
|
||||
$object->getItemType()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user