Commit 6bb0927c authored by Carsten  Rose's avatar Carsten Rose
Browse files

#4606 / _link: qualifier to render bootstrap button - update php unit tests

parent bc8c1142
......@@ -163,7 +163,7 @@ class Support {
$value = implode(' ', $value);
}
if ($flagOmitEmpty && $value === "") {
if ($flagOmitEmpty && trim($value) === "") {
return '';
}
......
......@@ -883,7 +883,7 @@ class Link {
}
//TODO: Old way to detect if BS Button should be rendered - should be replaced by 'b:'
if ($vars[NAME_GLYPH] !== '' && $vars[NAME_EXTRA_CONTENT_WRAP] == '') {
if ($vars[NAME_GLYPH] !== '' && $vars[NAME_EXTRA_CONTENT_WRAP] == '' && $vars[NAME_BOOTSTRAP_BUTTON] == '') {
$class = 'btn btn-default ' . $class;
}
......@@ -1391,7 +1391,7 @@ EOF;
*/
private function buildHelp($vars, $value) {
$vars[NAME_GLYPH] = 'glyphicon ' . GLYPH_ICON_HELP;
$vars[NAME_GLYPH] = GLYPH_ICON_HELP;
$vars[NAME_GLYPH_TITLE] = "Help";
$vars[NAME_LINK_CLASS_DEFAULT] = NO_CLASS;
......@@ -1408,7 +1408,7 @@ EOF;
*/
private function buildInfo($vars, $value) {
$vars[NAME_GLYPH] = 'glyphicon ' . GLYPH_ICON_INFO;
$vars[NAME_GLYPH] = GLYPH_ICON_INFO;
$vars[NAME_GLYPH_TITLE] = "Information";
$vars[NAME_LINK_CLASS_DEFAULT] = NO_CLASS;
......@@ -1442,7 +1442,7 @@ EOF;
*/
private function buildShow($vars, $value) {
$vars[NAME_GLYPH] = 'glyphicon ' . GLYPH_ICON_SHOW;
$vars[NAME_GLYPH] = GLYPH_ICON_SHOW;
$vars[NAME_GLYPH_TITLE] = "Details";
$vars[NAME_LINK_CLASS_DEFAULT] = NO_CLASS;
......@@ -1459,7 +1459,7 @@ EOF;
*/
private function buildGlyph($vars, $value) {
$vars[NAME_GLYPH] = 'glyphicon ' . $value;
$vars[NAME_GLYPH] = $value;
$vars[NAME_GLYPH_TITLE] = "Details";
$vars[NAME_LINK_CLASS_DEFAULT] = NO_CLASS;
......
......@@ -32,7 +32,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
public function testUnknownTokenException1() {
$link = new Link($this->sip, true);
$link->renderLink('b:hello world');
$link->renderLink('x:hello world');
}
/**
......@@ -642,13 +642,13 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Delete" ><span class="glyphicon glyphicon-trash" ></span></a>', $result);
$result = $link->renderLink('u:http://example.com|H');
$this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon glyphicon-question-sign" ></span></a>', $result);
$this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon-question-sign" ></span></a>', $result);
$result = $link->renderLink('u:http://example.com|I');
$this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon glyphicon-info-sign" ></span></a>', $result);
$this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon-info-sign" ></span></a>', $result);
$result = $link->renderLink('u:http://example.com|S');
$this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon glyphicon-search" ></span></a>', $result);
$this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon-search" ></span></a>', $result);
$result = $link->renderLink('u:http://example.com|E|o:specific');
$this->assertEquals('<a href="http://example.com" class="btn btn-default" title="specific" ><span class="glyphicon glyphicon-pencil" ></span></a>', $result);
......@@ -723,7 +723,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
$link = new Link($this->sip, true);
$result = $link->renderLink('u:http://example.com|G:glyphicon-envelope');
$this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon glyphicon-envelope" ></span></a>', $result);
$this->assertEquals('<a href="http://example.com" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon-envelope" ></span></a>', $result);
}
/**
......
......@@ -242,19 +242,19 @@ class ReportTest extends AbstractDatabaseTest {
// page & Help
$result = $this->report->process("10.sql = SELECT 'p:form&r=123&a=hello&type=5&L=3&final=world|H' AS _page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon glyphicon-question-sign" ></span></a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon-question-sign" ></span></a>', $result);
// page & Information
$result = $this->report->process("10.sql = SELECT 'p:form&r=123&a=hello&type=5&L=3&final=world|I' AS _page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon glyphicon-info-sign" ></span></a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon-info-sign" ></span></a>', $result);
// page & Show
$result = $this->report->process("10.sql = SELECT 'p:form&r=123&a=hello&type=5&L=3&final=world|S' AS _page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon glyphicon-search" ></span></a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon-search" ></span></a>', $result);
// page & Show & Text
$result = $this->report->process("10.sql = SELECT 'p:form&r=123&a=hello&type=5&L=3&final=world|S|t:Person' AS _page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon glyphicon-search" ></span> Person</a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon-search" ></span> Person</a>', $result);
}
/**
......@@ -590,7 +590,7 @@ EOF;
// _Page: incl. alert
$result = $this->report->process("10.sql = SELECT 'p:form' AS _pagec FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" class="internal" ' . $js . ' >index.php?id=form&s=badcaffee1234</a>', $result);
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" class="btn btn-default internal" ' . $js . ' >index.php?id=form&s=badcaffee1234</a>', $result);
// _Page: other than defaults for the alert.
$js = str_replace('Please confirm!', 'Do you like to open', $js);
......@@ -600,11 +600,11 @@ EOF;
$js = str_replace('timeout: 0', 'timeout: 10000', $js);
$js = str_replace('modal: true', 'modal: false', $js);
$result = $this->report->process("10.sql = SELECT 'p:form|q:Do you like to open:success:yes:no:10:0' AS _pagec FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" class="internal" ' . $js . ' >index.php?id=form&s=badcaffee1234</a>', $result);
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" class="btn btn-default internal" ' . $js . ' >index.php?id=form&s=badcaffee1234</a>', $result);
$result = $this->report->process("10.sql = SELECT 'p:form|q:Do you like to open:success:yes:no:10:0|t:click me' AS _pagec FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" class="internal" ' . $js . ' >click me</a>', $result);
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" class="btn btn-default internal" ' . $js . ' >click me</a>', $result);
}
......@@ -628,7 +628,7 @@ EOF;
// _Page: incl. alert
$result = $this->report->process("10.sql = SELECT 'form' AS _Pagec FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" class="internal" ' . $js . ' >index.php?id=form&s=badcaffee1234</a>', $result);
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" class="btn btn-default internal" ' . $js . ' >index.php?id=form&s=badcaffee1234</a>', $result);
// _Page: other than defaults for the alert.
$js = str_replace('Please confirm!', 'Do you like to open', $js);
......@@ -638,11 +638,11 @@ EOF;
$js = str_replace('timeout: 0', 'timeout: 10000', $js);
$js = str_replace('modal: true', 'modal: false', $js);
$result = $this->report->process("10.sql = SELECT 'form|||Do you like to open:success:yes:no:10:0' AS _Pagec FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" class="internal" ' . $js . ' >index.php?id=form&s=badcaffee1234</a>', $result);
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" class="btn btn-default internal" ' . $js . ' >index.php?id=form&s=badcaffee1234</a>', $result);
$result = $this->report->process("10.sql = SELECT 'form|click me||Do you like to open:success:yes:no:10:0' AS _Pagec FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" class="internal" ' . $js . ' >click me</a>', $result);
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" class="btn btn-default internal" ' . $js . ' >click me</a>', $result);
}
......@@ -819,10 +819,10 @@ EOF;
// _paged: incl. alert
$result = $this->report->process("10.sql = SELECT 'p:form&a=1&r=3&type=4' AS _pageh FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon glyphicon-question-sign" ></span></a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon-question-sign" ></span></a>', $result);
$result = $this->report->process("10.sql = SELECT 'p:form&a=1&r=3&type=4|t:click me' AS _pageh FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon glyphicon-question-sign" ></span> click me</a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon-question-sign" ></span> click me</a>', $result);
}
/**
......@@ -832,10 +832,10 @@ EOF;
// _paged: incl. alert
$result = $this->report->process("10.sql = SELECT 'form&a=1&r=3&type=4' AS _Pageh FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon glyphicon-question-sign" ></span></a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon-question-sign" ></span></a>', $result);
$result = $this->report->process("10.sql = SELECT 'form&a=1&r=3&type=4|click me' AS _Pageh FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon glyphicon-question-sign" ></span> click me</a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Help" ><span class="glyphicon glyphicon-question-sign" ></span> click me</a>', $result);
}
/**
......@@ -845,10 +845,10 @@ EOF;
// _paged: incl. alert
$result = $this->report->process("10.sql = SELECT 'p:form&a=1&r=3&type=4' AS _pagei FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon glyphicon-info-sign" ></span></a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon-info-sign" ></span></a>', $result);
$result = $this->report->process("10.sql = SELECT 'p:form&a=1&r=3&type=4|t:click me' AS _pagei FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon glyphicon-info-sign" ></span> click me</a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon-info-sign" ></span> click me</a>', $result);
}
/**
......@@ -858,10 +858,10 @@ EOF;
// _paged: incl. alert
$result = $this->report->process("10.sql = SELECT 'form&a=1&r=3&type=4' AS _Pagei FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon glyphicon-info-sign" ></span></a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon-info-sign" ></span></a>', $result);
$result = $this->report->process("10.sql = SELECT 'form&a=1&r=3&type=4|click me' AS _Pagei FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon glyphicon-info-sign" ></span> click me</a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Information" ><span class="glyphicon glyphicon-info-sign" ></span> click me</a>', $result);
}
/**
......@@ -897,10 +897,10 @@ EOF;
// _paged: incl. alert
$result = $this->report->process("10.sql = SELECT 'p:form&a=1&r=3&type=4' AS _pages FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon glyphicon-search" ></span></a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon-search" ></span></a>', $result);
$result = $this->report->process("10.sql = SELECT 'p:form&a=1&r=3&type=4|t:click me' AS _pages FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon glyphicon-search" ></span> click me</a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon-search" ></span> click me</a>', $result);
}
/**
......@@ -910,10 +910,10 @@ EOF;
// _paged: incl. alert
$result = $this->report->process("10.sql = SELECT 'form&a=1&r=3&type=4' AS _Pages FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon glyphicon-search" ></span></a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon-search" ></span></a>', $result);
$result = $this->report->process("10.sql = SELECT 'form&a=1&r=3&type=4|click me' AS _Pages FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon glyphicon-search" ></span> click me</a>', $result);
$this->assertEquals('<a href="index.php?id=form&type=4&s=badcaffee1234" class="btn btn-default" title="Details" ><span class="glyphicon glyphicon-search" ></span> click me</a>', $result);
}
/**
......
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