Commit 197ad3cd authored by Carsten  Rose's avatar Carsten Rose
Browse files

LinkTest.php: comment link delete test - implizit delete is not supported anymore via link.

ReportTest.php: implemented various exception tests for missing parameter of _paged
parent 91859949
......@@ -554,9 +554,9 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
$result = $link->renderLink('u:http://example.com|N');
$this->assertEquals('<a href="http://example.com" class="btn btn-default" title="New" ><span class="glyphicon glyphicon-plus" ></span></a>', $result);
$result = $link->renderLink('u:http://example.com|D');
$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|D');
// $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);
......
......@@ -667,6 +667,10 @@ EOF;
$result = $this->report->process("10.sql = SELECT 'U:table=Person&r=123' AS _paged FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="' . API_DIR . '/' . API_DELETE_PHP . '?s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result);
// _paged: incl. alert
$result = $this->report->process("10.sql = SELECT 'U:form=Person&r=123' AS _paged FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="' . API_DIR . '/' . API_DELETE_PHP . '?s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result);
// _paged: other than defaults for the alert.
$js = str_replace('Do you really want to delete the record?', 'Move to trash?', $js);
$js = str_replace("type: 'info'", "type: 'success'", $js);
......@@ -681,7 +685,6 @@ EOF;
$result = $this->report->process("10.sql = SELECT 'U:table=Person&r=123|q:Move to trash?:success:yes:no:10:0|t:click me' AS _paged FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="' . API_DIR . '/' . API_DELETE_PHP . '?s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span> click me</a>', $result);
}
/**
......@@ -723,6 +726,62 @@ EOF;
}
/**
* Missing r, missing form or table
* @expectedException \qfq\UserReportException
*/
public function testMissingPagedParameterException1() {
$this->report->process("10.sql = SELECT '' AS _Paged FROM Person ORDER BY id LIMIT 1");
}
/**
* Missing r, given table
* @expectedException \qfq\UserReportException
*/
public function testMissingPagedParameterException2() {
$this->report->process("10.sql = SELECT 'table=Person' AS _Paged FROM Person ORDER BY id LIMIT 1");
}
/**
* Missing r, given form
* @expectedException \qfq\UserReportException
*/
public function testMissingPagedParameterException3() {
$this->report->process("10.sql = SELECT 'form=Person' AS _Paged FROM Person ORDER BY id LIMIT 1");
}
/**
* missing form, missing table
* @expectedException \qfq\UserReportException
*/
public function testMissingPagedParameterException4() {
$this->report->process("10.sql = SELECT 'r=123' AS _Paged FROM Person ORDER BY id LIMIT 1");
}
/**
* missng r, given table
* @expectedException \qfq\UserReportException
*/
public function testMissingPagedParameterException5() {
$this->report->process("10.sql = SELECT 'table=Person&r' AS _Paged FROM Person ORDER BY id LIMIT 1");
}
/**
* missing table, given r
* @expectedException \qfq\UserReportException
*/
public function testMissingPagedParameterException6() {
$this->report->process("10.sql = SELECT 'table&r=123' AS _Paged FROM Person ORDER BY id LIMIT 1");
}
/**
* missing form, given r
* @expectedException \qfq\UserReportException
*/
public function testMissingPagedParameterException7() {
$this->report->process("10.sql = SELECT 'form&r=123' AS _Paged FROM Person ORDER BY id LIMIT 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