phpmyadmin/test/classes/plugin/transformations/Text_Plain_Sql_test.php
Jeff Chan 659efe1a88 Import dependencies to make unit tests friendlier to running independently
The HHVM test runner runs the unit tests in parallel. Currently some tests
fail because not all the dependencies are properly included.

This is similar to 840f7b1215

Signed-off-by: Jeff Chan <jefftchan@gmail.com>
2014-03-09 08:16:24 +00:00

137 lines
2.7 KiB
PHP

<?php
/**
* Tests for Text_Plain_Sql class
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
/* Each PluginObserver instance contains a PluginManager instance */
require_once 'libraries/Util.class.php';
require_once 'libraries/plugins/PluginManager.class.php';
require_once 'libraries/plugins/transformations/Text_Plain_Sql.class.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/sqlparser.lib.php';
/**
* Tests for Text_Plain_Sql class
*
* @package PhpMyAdmin-test
*/
class Text_Plain_Sql_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_Sql(new PluginManager());
}
/**
* 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 = 'Formats text as SQL query with syntax highlighting.';
$this->assertEquals(
$info,
Text_Plain_Sql::getInfo()
);
}
/**
* Test for getName
*
* @return void
*
* @group medium
*/
public function testGetName()
{
$this->assertEquals(
"SQL",
Text_Plain_Sql::getName()
);
}
/**
* Test for getMIMEType
*
* @return void
*
* @group medium
*/
public function testGetMIMEType()
{
$this->assertEquals(
"Text",
Text_Plain_Sql::getMIMEType()
);
}
/**
* Test for getMIMESubtype
*
* @return void
*
* @group medium
*/
public function testGetMIMESubtype()
{
$this->assertEquals(
"Plain",
Text_Plain_Sql::getMIMESubtype()
);
}
/**
* Test for applyTransformation
*
* @return void
*
* @group medium
*/
public function testApplyTransformation()
{
$buffer = "select *";
$options = array("option1", "option2");
$result = '<code class="sql"><pre>' . "\n"
. 'select *' . "\n"
. '</pre></code>';
$this->assertEquals(
$result,
$this->object->applyTransformation($buffer, $options)
);
}
}