136 lines
2.8 KiB
PHP
136 lines
2.8 KiB
PHP
<?php
|
|
/**
|
|
* Tests for Text_Plain_Link class
|
|
*
|
|
* @package PhpMyAdmin-test
|
|
*/
|
|
|
|
/*
|
|
* Include to test.
|
|
*/
|
|
|
|
/* Each PluginObserver instance contains a PluginManager instance */
|
|
require_once 'libraries/plugins/PluginManager.class.php';
|
|
require_once 'libraries/plugins/transformations/Text_Plain_Link.class.php';
|
|
|
|
/**
|
|
* Tests for Text_Plain_Link class
|
|
*
|
|
* @package PhpMyAdmin-test
|
|
*/
|
|
class Text_Plain_Link_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_Link(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 =
|
|
'Displays a link; the column contains the filename. The first option'
|
|
. ' is a URL prefix like "http://www.example.com/". The second option'
|
|
. ' is a title for the link.';
|
|
$this->assertEquals(
|
|
$info,
|
|
Text_Plain_Link::getInfo()
|
|
);
|
|
|
|
}
|
|
|
|
/**
|
|
* Test for getName
|
|
*
|
|
* @return void
|
|
*
|
|
* @group medium
|
|
*/
|
|
public function testGetName()
|
|
{
|
|
$this->assertEquals(
|
|
"TextLink",
|
|
Text_Plain_Link::getName()
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Test for getMIMEType
|
|
*
|
|
* @return void
|
|
*
|
|
* @group medium
|
|
*/
|
|
public function testGetMIMEType()
|
|
{
|
|
$this->assertEquals(
|
|
"Text",
|
|
Text_Plain_Link::getMIMEType()
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Test for getMIMESubtype
|
|
*
|
|
* @return void
|
|
*
|
|
* @group medium
|
|
*/
|
|
public function testGetMIMESubtype()
|
|
{
|
|
$this->assertEquals(
|
|
"Plain",
|
|
Text_Plain_Link::getMIMESubtype()
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Test for applyTransformation
|
|
*
|
|
* @return void
|
|
*
|
|
* @group medium
|
|
*/
|
|
public function testApplyTransformation()
|
|
{
|
|
$buffer = "PMA_TXT_LINK";
|
|
$options = array("./php/", "text_name");
|
|
$result = '<a href="./php/PMA_TXT_LINK"'
|
|
. ' title="text_name" target="_new">text_name</a>';
|
|
$this->assertEquals(
|
|
$result,
|
|
$this->object->applyTransformation($buffer, $options)
|
|
);
|
|
}
|
|
}
|