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

Refs #7860. Add unit test

parent 9ab4c52c
Pipeline #2338 passed with stages
in 2 minutes and 35 seconds
......@@ -236,6 +236,68 @@ class ReportTest extends AbstractDatabaseTest {
$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);
$result = $this->report->process("10.sql = SELECT '' AS _mailto FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('', $result);
$result = $this->report->process("10.sql = SELECT '|' AS _mailto FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('', $result);
$result = $this->report->process("10.sql = SELECT '|Some Text' AS _mailto FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('', $result);
$code = <<<EOF
<script language=javascript><!--
var email = "john.doe"
var emailHost = "example.com"
var contact = "Some Text"
document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost+ "><span>" + contact
+ "</span></a>")
//--></script>
EOF;
$result = $this->report->process("10.sql = SELECT 'john.doe@example.com|Some Text' AS _mailto FROM Person ORDER BY id LIMIT 1");
$this->assertEquals($code, $result);
$code = <<<EOF
<script language=javascript><!--
var email = "john.doe"
var emailHost = "example.com"
var contactHost = "example.com"
var contact = "john.doe@"
document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost+ "><span>" + contact
+ "</span><span>" + contactHost + "</span></a>")
//--></script>
EOF;
$result = $this->report->process("10.sql = SELECT 'john.doe@example.com' AS _mailto FROM Person ORDER BY id LIMIT 1");
$this->assertEquals($code, $result);
$code = <<<EOF
<script language=javascript><!--
var email = "john.doe"
var emailHost = "broken.email.address"
var contact = "john.doe"
document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost+ "><span>" + contact
+ "</span></a>")
//--></script>
EOF;
$result = $this->report->process("10.sql = SELECT 'john.doe' AS _mailto FROM Person ORDER BY id LIMIT 1");
$this->assertEquals($code, $result);
$code = <<<EOF
<script language=javascript><!--
var email = "john.doe"
var emailHost = "broken.email.address"
var contact = "Some Text"
document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost+ "><span>" + contact
+ "</span></a>")
//--></script>
EOF;
$result = $this->report->process("10.sql = SELECT 'john.doe|Some Text' AS _mailto FROM Person ORDER BY id LIMIT 1");
$this->assertEquals($code, $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);
......
Markdown is supported
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