Commit 2a530c90 authored by Carsten  Rose's avatar Carsten Rose
Browse files

ReportTest.php: added check for paged / modeAnswer / targetUrl

parent 197ad3cd
...@@ -997,7 +997,6 @@ EOF; ...@@ -997,7 +997,6 @@ EOF;
} }
/** /**
* *
*/ */
......
...@@ -8,6 +8,7 @@ require_once(__DIR__ . '/AbstractDatabaseTest.php'); ...@@ -8,6 +8,7 @@ require_once(__DIR__ . '/AbstractDatabaseTest.php');
require_once(__DIR__ . '/../../qfq/report/Report.php'); require_once(__DIR__ . '/../../qfq/report/Report.php');
require_once(__DIR__ . '/../../qfq/store/Store.php'); require_once(__DIR__ . '/../../qfq/store/Store.php');
require_once(__DIR__ . '/../../qfq/Evaluate.php'); require_once(__DIR__ . '/../../qfq/Evaluate.php');
require_once(__DIR__ . '/../../qfq/store/Session.php');
/** /**
* Created by PhpStorm. * Created by PhpStorm.
...@@ -667,6 +668,10 @@ EOF; ...@@ -667,6 +668,10 @@ EOF;
$result = $this->report->process("10.sql = SELECT 'U:table=Person&r=123' AS _paged FROM Person ORDER BY id LIMIT 1"); $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); $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);
// Check das via '_paged' SIP_MODE_ANSWER and SIP_TARGET_URL has been set.
$result = \qfq\Session::get('badcaffee1234');
$this->assertEquals('_modeAnswer=html&_targetUrl=localhost&r=123&table=Person', $result);
// _paged: incl. alert // _paged: incl. alert
$result = $this->report->process("10.sql = SELECT 'U:form=Person&r=123' AS _paged FROM Person ORDER BY id LIMIT 1"); $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); $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);
...@@ -705,11 +710,11 @@ alert.show(); ...@@ -705,11 +710,11 @@ alert.show();
return false;" return false;"
EOF; EOF;
// _paged: incl. alert // _Paged: incl. alert
$result = $this->report->process("10.sql = SELECT 'table=Person&r=123' AS _Paged FROM Person ORDER BY id LIMIT 1"); $result = $this->report->process("10.sql = SELECT '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); $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. // _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('Do you really want to delete the record?', 'Move to trash?', $js);
$js = str_replace("type: 'info'", "type: 'success'", $js); $js = str_replace("type: 'info'", "type: 'success'", $js);
$js = str_replace('Ok', 'yes', $js); $js = str_replace('Ok', 'yes', $js);
...@@ -723,7 +728,6 @@ EOF; ...@@ -723,7 +728,6 @@ EOF;
$result = $this->report->process("10.sql = SELECT 'table=Person&r=123|click me||Move to trash?:success:yes:no:10:0' AS _Paged FROM Person ORDER BY id LIMIT 1"); $result = $this->report->process("10.sql = SELECT 'table=Person&r=123|click me||Move to trash?:success:yes:no:10:0' 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); $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);
} }
/** /**
......
...@@ -56,6 +56,10 @@ class SipTest extends \PHPUnit_Framework_TestCase { ...@@ -56,6 +56,10 @@ class SipTest extends \PHPUnit_Framework_TestCase {
} }
/**
* @throws CodeException
* @throws UserFormException
*/
public function testGetVarsFromSip() { public function testGetVarsFromSip() {
$sip = new Sip('fakesessionname', true); $sip = new Sip('fakesessionname', true);
$sip->sipUniqId('badcaffee1234'); $sip->sipUniqId('badcaffee1234');
...@@ -85,6 +89,9 @@ class SipTest extends \PHPUnit_Framework_TestCase { ...@@ -85,6 +89,9 @@ class SipTest extends \PHPUnit_Framework_TestCase {
} }
/**
*
*/
public function testFakeUniqId() { public function testFakeUniqId() {
$sip = new Sip('fakesessionname', true); $sip = new Sip('fakesessionname', true);
$this->assertEquals('badcaffee1234', $sip->sipUniqId('badcaffee1234')); $this->assertEquals('badcaffee1234', $sip->sipUniqId('badcaffee1234'));
...@@ -93,6 +100,9 @@ class SipTest extends \PHPUnit_Framework_TestCase { ...@@ -93,6 +100,9 @@ class SipTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals('badcaffee5678', $sip->sipUniqId('badcaffee5678')); $this->assertEquals('badcaffee5678', $sip->sipUniqId('badcaffee5678'));
} }
/**
* @throws CodeException
*/
public function testGetSipFromUrlParam() { public function testGetSipFromUrlParam() {
$sip = new Sip('fakesessionname', true); $sip = new Sip('fakesessionname', true);
...@@ -113,6 +123,9 @@ class SipTest extends \PHPUnit_Framework_TestCase { ...@@ -113,6 +123,9 @@ class SipTest extends \PHPUnit_Framework_TestCase {
} }
/**
*
*/
public function testSipUniqId() { public function testSipUniqId() {
$sip = new Sip('fakesessionname', true); $sip = new Sip('fakesessionname', true);
$sip->sipUniqId('badcaffee1234'); $sip->sipUniqId('badcaffee1234');
...@@ -121,6 +134,9 @@ class SipTest extends \PHPUnit_Framework_TestCase { ...@@ -121,6 +134,9 @@ class SipTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals('badcaffee1234', $s); $this->assertEquals('badcaffee1234', $s);
} }
/**
* @throws CodeException
*/
public function testGetQueryStringFromSip() { public function testGetQueryStringFromSip() {
$sip = new Sip('fakesessionname', true); $sip = new Sip('fakesessionname', true);
$sip->sipUniqId('badcaffee1234'); $sip->sipUniqId('badcaffee1234');
......
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