Commit 0a13c705 authored by Carsten  Rose's avatar Carsten Rose

Fix problem: empty 'u' / 'm' checked to early - render mode might allow empty values.

parent 69048edd
......@@ -29,6 +29,7 @@ class Token {
switch ($key) {
case TOKEN_URL:
case TOKEN_MAIL:
break; // No check - can't be generally decided
case TOKEN_GLYPH:
throw new UserReportException ("Missing value for token '$key'", ERROR_MISSING_VALUE);
break;
......
......@@ -191,6 +191,9 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
$result = $link->renderLink('t:Example');
$this->assertEquals('', $result);
$result = $link->renderLink('u|t:Example');
$this->assertEquals('', $result);
$result = $link->renderLink('u:http://example.com|t:Example');
$this->assertEquals('<a href="http://example.com" >Example</a>', $result);
......@@ -200,6 +203,9 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
$result = $link->renderLink('t:Example|r:0');
$this->assertEquals('', $result);
$result = $link->renderLink('u|t:Example|r:0');
$this->assertEquals('', $result);
$result = $link->renderLink('u:http://example.com|t:Example|r:0');
$this->assertEquals('<a href="http://example.com" >Example</a>', $result);
......@@ -208,7 +214,9 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals('<a href="http://example.com" >http://example.com</a>', $result);
$result = $link->renderLink('t:Example|r:1');
// $this->assertEquals('<span >Example</span>', $result);
$this->assertEquals('Example', $result);
$result = $link->renderLink('u|t:Example|r:1');
$this->assertEquals('Example', $result);
$result = $link->renderLink('u:http://example.com|t:Example|r:1');
......@@ -221,6 +229,9 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
$result = $link->renderLink('t:Example|r:2');
$this->assertEquals('', $result);
$result = $link->renderLink('u|t:Example|r:2');
$this->assertEquals('', $result);
$result = $link->renderLink('u:http://example.com|t:Example|r:2');
$this->assertEquals('<a href="http://example.com" >Example</a>', $result);
......@@ -230,7 +241,9 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals('http://example.com', $result);
$result = $link->renderLink('t:Example|r:3');
// $this->assertEquals('<span >Example</span>', $result);
$this->assertEquals('Example', $result);
$result = $link->renderLink('u|t:Example|r:3');
$this->assertEquals('Example', $result);
$result = $link->renderLink('u:http://example.com|t:Example|r:3');
......@@ -239,11 +252,12 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
// r: 4
$result = $link->renderLink('u:http://example.com|r:4');
// $this->assertEquals('<span >http://example.com</span>', $result);
$this->assertEquals('http://example.com', $result);
$result = $link->renderLink('t:Example|r:4');
// $this->assertEquals('<span >Example</span>', $result);
$this->assertEquals('Example', $result);
$result = $link->renderLink('u|t:Example|r:4');
$this->assertEquals('Example', $result);
$result = $link->renderLink('u:http://example.com|t:Example|r:4');
......@@ -257,6 +271,9 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
$result = $link->renderLink('t:Example|r:5');
$this->assertEquals('', $result);
$result = $link->renderLink('u|t:Example|r:5');
$this->assertEquals('', $result);
$result = $link->renderLink('u:http://example.com|t:Example|r:5');
$this->assertEquals('', $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