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

phpunit: fix problems.

parent 1713abf3
Pipeline #1216 passed with stage
in 1 minute and 38 seconds
...@@ -195,6 +195,10 @@ class FormActionTest extends AbstractDatabaseTest { ...@@ -195,6 +195,10 @@ class FormActionTest extends AbstractDatabaseTest {
$this->store->setVar('city', '', STORE_FORM, true); $this->store->setVar('city', '', STORE_FORM, true);
$feSpecAction[FE_REQUIRED_LIST] = 'street,city,downtown'; $feSpecAction[FE_REQUIRED_LIST] = 'street,city,downtown';
$formAction->elements(0, [$feSpecAction], FE_TYPE_BEFORE_LOAD . ',' . FE_TYPE_AFTER_LOAD . ',' . FE_TYPE_AFTER_UPDATE . ',' . FE_TYPE_BEFORE_SAVE); $formAction->elements(0, [$feSpecAction], FE_TYPE_BEFORE_LOAD . ',' . FE_TYPE_AFTER_LOAD . ',' . FE_TYPE_AFTER_UPDATE . ',' . FE_TYPE_BEFORE_SAVE);
# Fake to suppress phpUnit about missing test.
$this->assertEquals('', '');
} }
/** /**
...@@ -245,6 +249,9 @@ class FormActionTest extends AbstractDatabaseTest { ...@@ -245,6 +249,9 @@ class FormActionTest extends AbstractDatabaseTest {
$feSpecAction[FE_SQL_VALIDATE] = '{{!SELECT id FROM Person LIMIT 2}}'; $feSpecAction[FE_SQL_VALIDATE] = '{{!SELECT id FROM Person LIMIT 2}}';
$feSpecAction[FE_EXPECT_RECORDS] = '2'; $feSpecAction[FE_EXPECT_RECORDS] = '2';
$formAction->elements(0, [$feSpecAction, $feSpecAction], FE_TYPE_BEFORE_LOAD . ',' . FE_TYPE_AFTER_LOAD . ',' . FE_TYPE_AFTER_UPDATE . ',' . FE_TYPE_BEFORE_SAVE); $formAction->elements(0, [$feSpecAction, $feSpecAction], FE_TYPE_BEFORE_LOAD . ',' . FE_TYPE_AFTER_LOAD . ',' . FE_TYPE_AFTER_UPDATE . ',' . FE_TYPE_BEFORE_SAVE);
# Fake to suppress phpUnit about missing test.
$this->assertEquals('', '');
} }
/** /**
......
...@@ -35,6 +35,9 @@ class SupportTest extends TestCase { ...@@ -35,6 +35,9 @@ class SupportTest extends TestCase {
unset($_GET); unset($_GET);
$this->store->setVar(TYPO3_PAGE_ID, 1, STORE_TYPO3, true);
$this->store->setVar(TYPO3_PAGE_TYPE, 2, STORE_TYPO3, true);
$this->store->setVar(TYPO3_PAGE_LANGUAGE, 3, STORE_TYPO3, true);
$queryArray = array(); $queryArray = array();
Support::appendTypo3ParameterToArray($queryArray); Support::appendTypo3ParameterToArray($queryArray);
$this->assertEquals(['id' => 1, 'type' => 2, 'L' => 3], $queryArray); $this->assertEquals(['id' => 1, 'type' => 2, 'L' => 3], $queryArray);
......
...@@ -1253,28 +1253,28 @@ EOF; ...@@ -1253,28 +1253,28 @@ EOF;
// Report Delete action, default: 'Report', no Icon // Report Delete action, default: 'Report', no Icon
$result = $link->renderLink('U:form=Person&r=123|x'); $result = $link->renderLink('U:form=Person&r=123|x');
$this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/delete.php?s=badcaffee1234" >typo3conf/ext/qfq/qfq/api/delete.php?s=badcaffee1234</a>', $result); $this->assertEquals('<a href="typo3conf/ext/qfq/Source/api/delete.php?s=badcaffee1234" >typo3conf/ext/qfq/Source/api/delete.php?s=badcaffee1234</a>', $result);
// Check das via '_paged' SIP_MODE_ANSWER and SIP_TARGET_URL has been set. // Check das via '_paged' SIP_MODE_ANSWER and SIP_TARGET_URL has been set.
$result = \qfq\Session::get('badcaffee1234'); $result = \qfq\Session::get('badcaffee1234');
$this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&form=Person&r=123', $result); $this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&form=Person&r=123', $result);
// Report Delete action, explicit 'Report', no Icon // Report Delete action, explicit 'Report', no Icon
$result = $link->renderLink('U:form=PersonA&r=1234|x:r'); $result = $link->renderLink('U:form=PersonA&r=1234|x:r');
$this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/delete.php?s=badcaffee1234" >typo3conf/ext/qfq/qfq/api/delete.php?s=badcaffee1234</a>', $result); $this->assertEquals('<a href="typo3conf/ext/qfq/Source/api/delete.php?s=badcaffee1234" >typo3conf/ext/qfq/Source/api/delete.php?s=badcaffee1234</a>', $result);
// Check das via '_paged' SIP_MODE_ANSWER and SIP_TARGET_URL has been set. // Check das via '_paged' SIP_MODE_ANSWER and SIP_TARGET_URL has been set.
$result = \qfq\Session::get('badcaffee1234'); $result = \qfq\Session::get('badcaffee1234');
$this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&form=PersonA&r=1234', $result); $this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&form=PersonA&r=1234', $result);
// Report Delete action, explicit 'Report', Text // Report Delete action, explicit 'Report', Text
$result = $link->renderLink('U:form=PersonAa&r=2234|x:r|t:Delete Record'); $result = $link->renderLink('U:form=PersonAa&r=2234|x:r|t:Delete Record');
$this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/delete.php?s=badcaffee1234" >Delete Record</a>', $result); $this->assertEquals('<a href="typo3conf/ext/qfq/Source/api/delete.php?s=badcaffee1234" >Delete Record</a>', $result);
// Check das via '_paged' SIP_MODE_ANSWER and SIP_TARGET_URL has been set. // Check das via '_paged' SIP_MODE_ANSWER and SIP_TARGET_URL has been set.
$result = \qfq\Session::get('badcaffee1234'); $result = \qfq\Session::get('badcaffee1234');
$this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&form=PersonAa&r=2234', $result); $this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&form=PersonAa&r=2234', $result);
// Report Delete action, with Icon // Report Delete action, with Icon
$result = $link->renderLink('U:form=PersonB&r=1235|x|D'); $result = $link->renderLink('U:form=PersonB&r=1235|x|D');
$this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/delete.php?s=badcaffee1234" class="btn btn-default" title="Delete" ><span class="glyphicon glyphicon-trash" ></span></a>', $result); $this->assertEquals('<a href="typo3conf/ext/qfq/Source/api/delete.php?s=badcaffee1234" class="btn btn-default" title="Delete" ><span class="glyphicon glyphicon-trash" ></span></a>', $result);
// Check das via '_paged' SIP_MODE_ANSWER and SIP_TARGET_URL has been set. // Check das via '_paged' SIP_MODE_ANSWER and SIP_TARGET_URL has been set.
$result = \qfq\Session::get('badcaffee1234'); $result = \qfq\Session::get('badcaffee1234');
$this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&form=PersonB&r=1235', $result); $this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&form=PersonB&r=1235', $result);
...@@ -1364,27 +1364,27 @@ EOF; ...@@ -1364,27 +1364,27 @@ EOF;
// Single file // Single file
$result = $link->renderLink('d|F:file.pdf'); $result = $link->renderLink('d|F:file.pdf');
$this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/download.php?mode=pdf&_exportFilename=&_b64_download=RjpmaWxlLnBkZg==" class="0" title="Download" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: " data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));"><span class="glyphicon glyphicon-file" ></span></span></a>', $result); $this->assertEquals('<a href="typo3conf/ext/qfq/Source/api/download.php?mode=pdf&_exportFilename=&_b64_download=RjpmaWxlLnBkZg==" class="0" title="Download" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: " data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));"><span class="glyphicon glyphicon-file" ></span></span></a>', $result);
// With download filename // With download filename
$result = $link->renderLink('d:download.pdf|F:file.pdf'); $result = $link->renderLink('d:download.pdf|F:file.pdf');
$this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/download.php?mode=pdf&_exportFilename=download.pdf&_b64_download=RjpmaWxlLnBkZg==" class="0" title="Download" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: download.pdf" data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));"><span class="glyphicon glyphicon-file" ></span></span></a>', $result); $this->assertEquals('<a href="typo3conf/ext/qfq/Source/api/download.php?mode=pdf&_exportFilename=download.pdf&_b64_download=RjpmaWxlLnBkZg==" class="0" title="Download" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: download.pdf" data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));"><span class="glyphicon glyphicon-file" ></span></span></a>', $result);
// Two files // Two files
$result = $link->renderLink('d|F:file.pdf|F:file2.pdf'); $result = $link->renderLink('d|F:file.pdf|F:file2.pdf');
$this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/download.php?mode=pdf&_exportFilename=&_b64_download=RjpmaWxlLnBkZnxGOmZpbGUyLnBkZg==" class="0" title="Download" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: " data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));"><span class="glyphicon glyphicon-file" ></span></span></a>', $result); $this->assertEquals('<a href="typo3conf/ext/qfq/Source/api/download.php?mode=pdf&_exportFilename=&_b64_download=RjpmaWxlLnBkZnxGOmZpbGUyLnBkZg==" class="0" title="Download" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: " data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));"><span class="glyphicon glyphicon-file" ></span></span></a>', $result);
// Mode: PDF // Mode: PDF
$result = $link->renderLink('d|F:file.pdf|M:pdf'); $result = $link->renderLink('d|F:file.pdf|M:pdf');
$this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/download.php?mode=pdf&_exportFilename=&_b64_download=RjpmaWxlLnBkZg==" class="0" title="Download" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: " data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));"><span class="glyphicon glyphicon-file" ></span></span></a>', $result); $this->assertEquals('<a href="typo3conf/ext/qfq/Source/api/download.php?mode=pdf&_exportFilename=&_b64_download=RjpmaWxlLnBkZg==" class="0" title="Download" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: " data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));"><span class="glyphicon glyphicon-file" ></span></span></a>', $result);
// Download with Tooltip // Download with Tooltip
$result = $link->renderLink('d|F:file.pdf|o:Tooltip'); $result = $link->renderLink('d|F:file.pdf|o:Tooltip');
$this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/download.php?mode=pdf&_exportFilename=&_b64_download=RjpmaWxlLnBkZg==" class="0" title="Tooltip" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: " data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));"><span class="glyphicon glyphicon-file" ></span></span></a>', $result); $this->assertEquals('<a href="typo3conf/ext/qfq/Source/api/download.php?mode=pdf&_exportFilename=&_b64_download=RjpmaWxlLnBkZg==" class="0" title="Tooltip" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: " data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));"><span class="glyphicon glyphicon-file" ></span></span></a>', $result);
// Download & Button Text // Download & Button Text
$result = $link->renderLink('d|F:file.pdf|t:Button text'); $result = $link->renderLink('d|F:file.pdf|t:Button text');
$this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/download.php?mode=pdf&_exportFilename=&_b64_download=RjpmaWxlLnBkZg==" class="0" title="Download" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: " data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));"><span class="glyphicon glyphicon-file" ></span> Button text</span></a>', $result); $this->assertEquals('<a href="typo3conf/ext/qfq/Source/api/download.php?mode=pdf&_exportFilename=&_b64_download=RjpmaWxlLnBkZg==" class="0" title="Download" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: " data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));"><span class="glyphicon glyphicon-file" ></span> Button text</span></a>', $result);
// Download, r:3 // Download, r:3
$result = $link->renderLink('d|F:file.pdf|r:3'); $result = $link->renderLink('d|F:file.pdf|r:3');
...@@ -1397,7 +1397,7 @@ EOF; ...@@ -1397,7 +1397,7 @@ EOF;
// Single file // Single file
$result = $link->renderLink('d|F:file.pdf|t:DL|b:0'); $result = $link->renderLink('d|F:file.pdf|t:DL|b:0');
$this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/download.php?mode=pdf&_exportFilename=&_b64_download=RjpmaWxlLnBkZg==" class="0" ><span data-toggle="modal" data-target="#qfqModal101" data-title="Download: " data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));">DL</span></a>', $result); $this->assertEquals('<a href="typo3conf/ext/qfq/Source/api/download.php?mode=pdf&_exportFilename=&_b64_download=RjpmaWxlLnBkZg==" class="0" ><span data-toggle="modal" data-target="#qfqModal101" data-title="Download: " data-text="Please wait" data-backdrop="static" data-keyboard="false" onclick="$(\'#qfqModalTitle101\').text($(this).data(\'title\')); $(\'#qfqModalText101\').text($(this).data(\'text\'));">DL</span></a>', $result);
// Single file // Single file
$result = $link->renderLink('d|F:file.pdf|t:DL|b:0|r:3'); $result = $link->renderLink('d|F:file.pdf|t:DL|b:0|r:3');
......
...@@ -102,6 +102,8 @@ class ReportTest extends AbstractDatabaseTest { ...@@ -102,6 +102,8 @@ class ReportTest extends AbstractDatabaseTest {
} }
/** /**
* @expectedException \qfq\UserReportException
*
* @throws CodeException * @throws CodeException
* @throws DbException * @throws DbException
* @throws DownloadException * @throws DownloadException
...@@ -875,6 +877,8 @@ EOF; ...@@ -875,6 +877,8 @@ EOF;
/** /**
* Missing r, missing form or table * Missing r, missing form or table
* *
* @expectedException \qfq\UserReportException
*
* @throws CodeException * @throws CodeException
* @throws DbException * @throws DbException
* @throws DownloadException * @throws DownloadException
...@@ -891,6 +895,8 @@ EOF; ...@@ -891,6 +895,8 @@ EOF;
/** /**
* Missing r, given table * Missing r, given table
* *
* @expectedException \qfq\UserReportException
*
* @throws CodeException * @throws CodeException
* @throws DbException * @throws DbException
* @throws DownloadException * @throws DownloadException
...@@ -907,6 +913,8 @@ EOF; ...@@ -907,6 +913,8 @@ EOF;
/** /**
* Missing r, given form * Missing r, given form
* *
* @expectedException \qfq\UserReportException
*
* @throws CodeException * @throws CodeException
* @throws DbException * @throws DbException
* @throws DownloadException * @throws DownloadException
...@@ -923,6 +931,8 @@ EOF; ...@@ -923,6 +931,8 @@ EOF;
/** /**
* missing form, missing table * missing form, missing table
* *
* @expectedException \qfq\UserReportException
*
* @throws CodeException * @throws CodeException
* @throws DbException * @throws DbException
* @throws DownloadException * @throws DownloadException
...@@ -937,7 +947,10 @@ EOF; ...@@ -937,7 +947,10 @@ EOF;
} }
/** /**
* missng r, given table * missing r, given table
*
* @expectedException \qfq\UserReportException
*
* @throws CodeException * @throws CodeException
* @throws DbException * @throws DbException
* @throws DownloadException * @throws DownloadException
...@@ -952,6 +965,8 @@ EOF; ...@@ -952,6 +965,8 @@ EOF;
} }
/** /**
* @expectedException \qfq\UserReportException
*
* @throws CodeException * @throws CodeException
* @throws DbException * @throws DbException
* @throws DownloadException * @throws DownloadException
...@@ -966,6 +981,8 @@ EOF; ...@@ -966,6 +981,8 @@ EOF;
} }
/** /**
* @expectedException \qfq\UserReportException
*
* @throws CodeException * @throws CodeException
* @throws DbException * @throws DbException
* @throws DownloadException * @throws DownloadException
......
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