Commit b41f4cc6 authored by Carsten  Rose's avatar Carsten Rose
Browse files

LinkTest.php: two more exception tests

ReportTest.php: Link, render mode, mailto
parent 85b6c60d
......@@ -645,6 +645,27 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals('<a href="http://example.com" ><img src="typo3conf/ext/qfq/Resources/Public/icons/checked-yellow.gif" title="yellow" > </a>', $result);
}
/**
* @expectedException \qfq\UserReportException
*/
public function testPictureException1() {
$link = new Link(null, $this->sip, true);
// r: default (0)
$result = $link->renderLink('u:http://www.example.com|P:picture.gif|B');
}
/**
* @expectedException \qfq\UserReportException
*/
public function testPictureException2() {
$link = new Link(null, $this->sip, true);
// r: default (0)
$result = $link->renderLink('u:http://www.example.com|C|B');
}
/**
* @throws SyntaxReportException
*/
......
......@@ -111,6 +111,78 @@ class ReportTest extends AbstractDatabaseTest {
$this->assertEquals('1DoeSmithJohnJane2DoeSmithJohnJane', $result);
}
/**
*
*/
public function testReportLink() {
// link
$result = $this->report->process("10.sql = SELECT 'u:http://www.example.com' AS _link FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="http://www.example.com" class="external" >http://www.example.com</a>', $result);
// link, checked
$result = $this->report->process("10.sql = SELECT 'u:http://www.example.com|C' AS _link FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="http://www.example.com" ><img src="typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="green" > </a>', $result);
// linck, checked, text
$result = $this->report->process("10.sql = SELECT 'u:http://www.example.com|C|t:Hello World' AS _link FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="http://www.example.com" ><img src="typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="green" > Hello World</a>', $result);
// link, checked, text, tooltip
$result = $this->report->process("10.sql = SELECT 'u:http://www.example.com|C|t:Hello World|o:more information' AS _link FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="http://www.example.com" title="more information" ><img src="typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="green" > Hello World</a>', $result);
}
/**
*
*/
public function testReportLinkRenderMode() {
// r:0, url + text
$result = $this->report->process("10.sql = SELECT 'u:http://www.example.com|t:Hello World|r:0' AS _link FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="http://www.example.com" class="external" >Hello World</a>', $result);
// r:0, url
$result = $this->report->process("10.sql = SELECT 'u:http://www.example.com|r:0' AS _link FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="http://www.example.com" class="external" >http://www.example.com</a>', $result);
// r:0, text
$result = $this->report->process("10.sql = SELECT 'r:0|t:Hello World' AS _link FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('', $result);
// r:1, url + text
$result = $this->report->process("10.sql = SELECT 'u:http://www.example.com|t:Hello World|r:1' AS _link FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="http://www.example.com" class="external" >Hello World</a>', $result);
// r:1, url
$result = $this->report->process("10.sql = SELECT 'u:http://www.example.com|r:1' AS _link FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="http://www.example.com" class="external" >http://www.example.com</a>', $result);
// r:1, text
$result = $this->report->process("10.sql = SELECT 'r:1|t:Hello World' AS _link FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('Hello World', $result);
}
/**
*
*/
public function testReportMailto() {
// r:0, mailto
$result = $this->report->process("10.sql = SELECT 'm:john.doe@example.com' AS _link FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="mailto:john.doe@example.com" >mailto:john.doe@example.com</a>', $result);
$result = $this->report->process("10.sql = SELECT 'm:john.doe@example.com|e:0' AS _link FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="mailto:john.doe@example.com" >mailto:john.doe@example.com</a>', $result);
//TODO: enable encryption check
// $result = $this->report->process("10.sql = SELECT 'm:john.doe@example.com|e:1' AS _link FROM Person ORDER BY id LIMIT 1");
// $this->assertEquals('<a href="mailto:john.doe@example.com" >mailto:john.doe@example.com</a>', $result);
}
/**
* @throws Exception
*/
......@@ -123,10 +195,8 @@ class ReportTest extends AbstractDatabaseTest {
$this->executeSQLFile(__DIR__ . '/fixtures/Generic.sql', true);
}
}
class FakeTSFEReport {
public $id = 1;
public $type = 1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment