phpmyadmin/test/classes/plugin/transformations/Text_Plain_Preappend_test.php
Chirayu Chiripal 1f324be4b1 RFE-637: Custom field handlers (input transformations)
Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>
2014-07-12 01:52:32 +05:30

134 lines
2.6 KiB
PHP

<?php
/**
* Tests for Text_Plain_PreApPend class
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/plugins/transformations/Text_Plain_Preappend.class.php';
/**
* Tests for Text_Plain_PreApPend class
*
* @package PhpMyAdmin-test
*/
class Text_Plain_PreApPend_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()
{
$this->object = new Text_Plain_PreApPend();
}
/**
* 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 getInfo
*
* @return void
*
* @group medium
*/
public function testGetInfo()
{
$info
= 'Prepends and/or Appends text to a string. First option is text'
. ' to be prepended, second is appended (enclosed in single'
. ' quotes, default empty string).';
$this->assertEquals(
$info,
Text_Plain_PreApPend::getInfo()
);
}
/**
* Test for getName
*
* @return void
*
* @group medium
*/
public function testGetName()
{
$this->assertEquals(
"PreApPend",
Text_Plain_PreApPend::getName()
);
}
/**
* Test for getMIMEType
*
* @return void
*
* @group medium
*/
public function testGetMIMEType()
{
$this->assertEquals(
"Text",
Text_Plain_PreApPend::getMIMEType()
);
}
/**
* Test for getMIMESubtype
*
* @return void
*
* @group medium
*/
public function testGetMIMESubtype()
{
$this->assertEquals(
"Plain",
Text_Plain_PreApPend::getMIMESubtype()
);
}
/**
* Test for applyTransformation
*
* @return void
*
* @group medium
*/
public function testApplyTransformation()
{
$buffer = 'My';
$options = array('php', 'Admin');
$result = 'phpMyAdmin';
$this->assertEquals(
$result,
$this->object->applyTransformation($buffer, $options)
);
}
}