Commit 1447b3a1 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fix PHPUnit tests

parent 0c4672ff
......@@ -150,7 +150,10 @@ class Report {
$this->pageDefaults[DEFAULT_BOOTSTRAP_BUTTON]["pages"] = TOKEN_BOOTSTRAP_BUTTON;
// Default should already set in QuickFormQuery() Constructor
$this->dbIndexData = $this->store->getVar(TOKEN_DB_INDEX, STORE_TYPO3 . STORE_EMPTY);
$this->dbIndexData = $this->store->getVar(TOKEN_DB_INDEX, STORE_TYPO3);
if ($this->dbIndexData === false) {
$this->dbIndexData = DB_INDEX_DEFAULT;
}
$this->db = new Database($this->dbIndexData);
$this->variables = new Variables($eval, $t3data["uid"]);
......
......@@ -16,7 +16,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
*/
public function testGetProcessFilter() {
$build = new \qfq\BuildFormPlain(array(), array(), array(), $this->dbArray);
$build = new \qfq\BuildFormPlain([F_DB_INDEX => DB_INDEX_DEFAULT], array(), array(), $this->dbArray);
$this->assertEquals(FORM_ELEMENTS_NATIVE, $build->getProcessFilter());
}
......@@ -25,7 +25,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
*
*/
public function testGetFormId() {
$build = new \qfq\BuildFormPlain(array(), array(), array(), $this->dbArray);
$build = new \qfq\BuildFormPlain([F_DB_INDEX => DB_INDEX_DEFAULT], array(), array(), $this->dbArray);
$formId1 = $build->getFormId();
$this->assertRegExp('/qfq-form-[0-9a-f]{13}/', $formId1);
......@@ -39,7 +39,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
*
*/
public function testWrapItem() {
$build = new \qfq\BuildFormPlain(array(), array(), array(), $this->dbArray);
$build = new \qfq\BuildFormPlain([F_DB_INDEX => DB_INDEX_DEFAULT], array(), array(), $this->dbArray);
$result = $build->wrapItem(WRAP_SETUP_ELEMENT, 'Hello World', false);
$this->assertEquals('<p>Hello World</p>', $result);
......@@ -58,7 +58,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
*
*/
public function testBuildLabel() {
$build = new \qfq\BuildFormPlain(array(), array(), array(), $this->dbArray);
$build = new \qfq\BuildFormPlain([F_DB_INDEX => DB_INDEX_DEFAULT], array(), array(), $this->dbArray);
$result = $build->buildLabel('myLabel:123', "Hello World");
$this->assertEquals('<label for="myLabel:123" class="control-label" >Hello World</label>', $result);
......@@ -471,6 +471,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
'bsNoteColumns' => '',
'parameter' => 'maxVisiblePill=>3',
'deleted' => 'no',
F_DB_INDEX => DB_INDEX_DEFAULT,
];
$formElement = [
......
......@@ -1145,35 +1145,35 @@ EOF;
$this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/delete.php?s=badcaffee1234" >typo3conf/ext/qfq/qfq/api/delete.php?s=badcaffee1234</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&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
$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);
// 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&form=PersonA&r=1234', $result);
$this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&form=PersonA&r=1234', $result);
// Report Delete action, explicit 'Report', Text
$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);
// 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&form=PersonAa&r=2234', $result);
$this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&form=PersonAa&r=2234', $result);
// Report Delete action, with Icon
$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);
// 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&form=PersonB&r=1235', $result);
$this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&form=PersonB&r=1235', $result);
// Report Delete action: explicit php file, default: 'Report', no Icon
$result = $link->renderLink('u:mydelete.php|U:form=PersonC&r=1236|x');
$this->assertEquals('<a href="mydelete.php?s=badcaffee1234" >mydelete.php?s=badcaffee1234</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&form=PersonC&r=1236', $result);
$this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&form=PersonC&r=1236', $result);
}
/**
......
......@@ -673,7 +673,7 @@ EOF;
// 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);
$this->assertEquals('__dbIndexData=1&_modeAnswer=html&_targetUrl=localhost&r=123&table=Person', $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");
......
......@@ -19,7 +19,7 @@ class SaveTest extends AbstractDatabaseTest {
public function testUpdateRecord() {
$save = new qfq\Save(array(), array(), array(), array());
$save = new qfq\Save([F_DB_INDEX => DB_INDEX_DEFAULT], array(), array(), array());
// $db = new qfq\Database();
$values = ['name' => 'Doe', 'firstName' => 'John'];
......@@ -37,7 +37,7 @@ class SaveTest extends AbstractDatabaseTest {
public function testInsertRecord() {
$save = new qfq\Save(array(), array(), array(), array());
$save = new qfq\Save([F_DB_INDEX => DB_INDEX_DEFAULT], array(), array(), array());
// $db = new qfq\Database();
$values = ['name' => 'Doe', 'firstName' => 'John'];
......
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