Commit f042144c authored by Marc Egger's avatar Marc Egger
Browse files

Refs #12588 fix some tests, rename BASE_DIR_FAKE to BASE_URL_FAKE, set baseUrl...

Refs #12588 fix some tests, rename BASE_DIR_FAKE to BASE_URL_FAKE, set baseUrl to BASE_DIR_FAKE during unittests
parent 6402f2aa
Pipeline #5414 failed with stages
in 2 minutes and 7 seconds
......@@ -2079,4 +2079,4 @@ const HTTP_STATUS = 'http-status';
const ERROR_MESSAGE = 'error-message';
// Misc
const BASE_DIR_FAKE = 'http://xxxxxxxxxxxxxxxxxxxxxxxxxxxx/qfq/';
const BASE_URL_FAKE = 'http://i_am_set_in_constants_php/qfq/';
......@@ -112,6 +112,11 @@ class Config {
self::checkMandatoryParameter($config);
if (defined('PHPUNIT_QFQ')) {
// fake baseUrl in unittests
$config[SYSTEM_BASE_URL] = BASE_URL_FAKE;
}
self::$config = $config;
// Set log paths
......
......@@ -413,32 +413,32 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
$this->store->setStore(['id' => 1], STORE_RECORD, true);
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="table table-hover qfq-subrecord-table qfq-color-grey-2" id="1-123" ><thead><tr><th>id</th><th>name</th><th>firstName</th></tr></thead><tbody ><tr class="record" ><td><span class="text-muted">1</span></td><td>Doe</td><td>John</td></tr><tr class="record" ><td><span class="text-muted">2</span></td><td>Smith</td><td>Jane</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="table table-hover qfq-subrecord-table qfq-color-grey-2" id="123-123" ><thead><tr><th>id</th><th>name</th><th>firstName</th></tr></thead><tbody ><tr class="record" ><td><span class="text-muted">1</span></td><td>Doe</td><td>John</td></tr><tr class="record" ><td><span class="text-muted">2</span></td><td>Smith</td><td>Jane</td></tr></tbody></table>', $result);
// _id: 1, name: Doe,
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>name</th></tr></thead><tbody ><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>name</th></tr></thead><tbody ><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></tbody></table>', $result);
// _id: 1, name: Doe,title=''
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name AS "title=" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th></th></tr></thead><tbody ><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th></th></tr></thead><tbody ><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></tbody></table>', $result);
// _id: 1, name: Doe, column: _Person
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name AS "unused|width=2|title=_Person", firstName FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>firstName</th></tr></thead><tbody ><tr class="record" ><td>John</td></tr><tr class="record" ><td>Jane</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>firstName</th></tr></thead><tbody ><tr class="record" ><td>John</td></tr><tr class="record" ><td>Jane</td></tr></tbody></table>', $result);
// _id: 1, name: Doe, title: PERSON
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name AS "PERSON" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>PERSON</th></tr></thead><tbody ><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>PERSON</th></tr></thead><tbody ><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></tbody></table>', $result);
// _id: 1, "This is a much longer text than necessary": Default max:20
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", "This is a much longer text than necessary" FROM Person ORDER BY id LIMIT 1');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>This is a much longe</th></tr></thead><tbody ><tr class="record" ><td>This is a much longe</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>This is a much longe</th></tr></thead><tbody ><tr class="record" ><td>This is a much longe</td></tr></tbody></table>', $result);
// _id: 1, name: Jo (width:2)
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name AS "2" FROM Person ORDER BY id LIMIT 2');
......@@ -448,72 +448,72 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
// _id: 1, name: Jo (width:2)
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name AS "2|PERSON" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>PE</th></tr></thead><tbody ><tr class="record" ><td>Do</td></tr><tr class="record" ><td>Sm</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>PE</th></tr></thead><tbody ><tr class="record" ><td>Do</td></tr><tr class="record" ><td>Sm</td></tr></tbody></table>', $result);
// _id: 1, name: Doe ('width':3)
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name AS "Name|width=3" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>Nam</th></tr></thead><tbody ><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smi</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>Nam</th></tr></thead><tbody ><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smi</td></tr></tbody></table>', $result);
// _id: 1, name: Doe (width:3, title:PERSON)
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name AS "3|title=PERSON" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>PER</th></tr></thead><tbody ><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smi</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>PER</th></tr></thead><tbody ><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smi</td></tr></tbody></table>', $result);
// _id: 1, name: <b>Doe</b>
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", CONCAT("<b>", name, "</b>") AS "Name" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>Name</th></tr></thead><tbody ><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>Name</th></tr></thead><tbody ><tr class="record" ><td>Doe</td></tr><tr class="record" ><td>Smith</td></tr></tbody></table>', $result);
// _id: 1, name: <b>Doe</b>, width=2
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", CONCAT("<b>", name, "</b>") AS "Name|2" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>Na</th></tr></thead><tbody ><tr class="record" ><td>Do</td></tr><tr class="record" ><td>Sm</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>Na</th></tr></thead><tbody ><tr class="record" ><td>Do</td></tr><tr class="record" ><td>Sm</td></tr></tbody></table>', $result);
// _id: 1, name: <b>Doe</b> , nostrip
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", CONCAT("<b>", name, "</b>") AS "Name|nostrip" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>Name</th></tr></thead><tbody ><tr class="record" ><td><b>Doe</b></td></tr><tr class="record" ><td><b>Smith</b></td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>Name</th></tr></thead><tbody ><tr class="record" ><td><b>Doe</b></td></tr><tr class="record" ><td><b>Smith</b></td></tr></tbody></table>', $result);
// _id: 1, icon: bullet-green.gif
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", "bullet-green.gif" AS "Status|icon" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>Status</th></tr></thead><tbody ><tr class="record" ><td><image src=\'http://xxxxxxxxxxxxxxxxxxxxxxxxxxxx/qfq/typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif\'></td></tr><tr class="record" ><td><image src=\'http://xxxxxxxxxxxxxxxxxxxxxxxxxxxx/qfq/typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif\'></td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>Status</th></tr></thead><tbody ><tr class="record" ><td><image src=\'http://xxxxxxxxxxxxxxxxxxxxxxxxxxxx/qfq/typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif\'></td></tr><tr class="record" ><td><image src=\'http://xxxxxxxxxxxxxxxxxxxxxxxxxxxx/qfq/typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif\'></td></tr></tbody></table>', $result);
// _id: 1, mailto: john@doe.com
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", "john@doe.com" AS "EMail|mailto" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>EMail</th></tr></thead><tbody ><tr class="record" ><td><a href="mailto:john@doe.com" >john@doe.com</a></td></tr><tr class="record" ><td><a href="mailto:john@doe.com" >john@doe.com</a></td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>EMail</th></tr></thead><tbody ><tr class="record" ><td><a href="mailto:john@doe.com" >john@doe.com</a></td></tr><tr class="record" ><td><a href="mailto:john@doe.com" >john@doe.com</a></td></tr></tbody></table>', $result);
// _id: 1, url: www.uzh.ch
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", "www.uzh.ch" AS "URL|url" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>URL</th></tr></thead><tbody ><tr class="record" ><td><a href="www.uzh.ch" >www.uzh.ch</a></td></tr><tr class="record" ><td><a href="www.uzh.ch" >www.uzh.ch</a></td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>URL</th></tr></thead><tbody ><tr class="record" ><td><a href="www.uzh.ch" >www.uzh.ch</a></td></tr><tr class="record" ><td><a href="www.uzh.ch" >www.uzh.ch</a></td></tr></tbody></table>', $result);
// _id: 1, name: Doe, _rowclass (text)
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name, IF(id=1,"text-warning", "text-danger") AS _rowClass FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>name</th></tr></thead><tbody ><tr class="record text-warning" ><td>Doe</td></tr><tr class="record text-danger" ><td>Smith</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>name</th></tr></thead><tbody ><tr class="record text-warning" ><td>Doe</td></tr><tr class="record text-danger" ><td>Smith</td></tr></tbody></table>', $result);
// _id: 1, name: Doe, _rowClass (text & background)
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name, IF(id=1,"text-warning active", "text-danger success") AS _rowClass FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>name</th></tr></thead><tbody ><tr class="record text-warning active" ><td>Doe</td></tr><tr class="record text-danger success" ><td>Smith</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>name</th></tr></thead><tbody ><tr class="record text-warning active" ><td>Doe</td></tr><tr class="record text-danger success" ><td>Smith</td></tr></tbody></table>', $result);
// _id: 1, name: Doe, _rowTitle
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name, firstName AS _rowTitle FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>name</th></tr></thead><tbody ><tr class="record" title="John" ><td>Doe</td></tr><tr class="record" title="Jane" ><td>Smith</td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>name</th></tr></thead><tbody ><tr class="record" title="John" ><td>Doe</td></tr><tr class="record" title="Jane" ><td>Smith</td></tr></tbody></table>', $result);
// _id: 1, name: Doe, title, width, nostrip
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name, "<b>This again is a very long text</b>" AS "title=Important|width=10|nostrip" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>name</th><th>Important</th></tr></thead><tbody ><tr class="record" ><td>Doe</td><td><b>This again is a very long text</b></td></tr><tr class="record" ><td>Smith</td><td><b>This again is a very long text</b></td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>name</th><th>Important</th></tr></thead><tbody ><tr class="record" ><td>Doe</td><td><b>This again is a very long text</b></td></tr><tr class="record" ><td>Smith</td><td><b>This again is a very long text</b></td></tr></tbody></table>', $result);
// _id: 1, name: Doe, link
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id AS "_id", name, CONCAT("s:1|p:form&form=person&r=" , id , "|t:", name) AS "link" FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="1-123" ><thead><tr><th>name</th><th></th></tr></thead><tbody ><tr class="record" ><td>Doe</td><td><a href="index.php?id=form&s=badcaffee1234" >Doe</a></td></tr><tr class="record" ><td>Smith</td><td><a href="index.php?id=form&s=badcaffee1234" >Smith</a></td></tr></tbody></table>', $result);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" id="123-123" ><thead><tr><th>name</th><th></th></tr></thead><tbody ><tr class="record" ><td>Doe</td><td><a href="index.php?id=form&s=badcaffee1234" >Doe</a></td></tr><tr class="record" ><td>Smith</td><td><a href="index.php?id=form&s=badcaffee1234" >Smith</a></td></tr></tbody></table>', $result);
}
/**
......
......@@ -31,7 +31,7 @@ class HelperFileTest extends TestCase {
$this->assertEquals('', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_AUTO, ''));
$base = (strpos(HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_JAVASCRIPT, ''), BASE_DIR_FAKE) === false) ? BASE_DIR_FAKE : '';
$base = (strpos(HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_JAVASCRIPT, ''), BASE_URL_FAKE) === false) ? BASE_URL_FAKE : '';
$this->assertEquals(Path::urlExt(Path::EXT_TO_HIGHLIGHT_JSON) . '/javascript.json', $base . HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_JAVASCRIPT, ''));
$this->assertEquals(Path::urlExt(Path::EXT_TO_HIGHLIGHT_JSON) . '/highlight.qfq.json', $base . HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_QFQ, ''));
$this->assertEquals(Path::urlExt(Path::EXT_TO_HIGHLIGHT_JSON) . '/highlight.py.json', $base . HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_PYTHON, ''));
......@@ -73,7 +73,7 @@ class HelperFileTest extends TestCase {
protected function setUp() {
parent::setUp();
Path::setUrlApp(BASE_DIR_FAKE);
Path::setUrlApp(BASE_URL_FAKE);
}
}
......
......@@ -1278,7 +1278,7 @@ class SupportTest extends TestCase {
protected function setUp() {
parent::setUp();
Path::setUrlApp(BASE_DIR_FAKE);
Path::setUrlApp(BASE_URL_FAKE);
$GLOBALS["TSFE"] = new FakeTSFE();
$this->store = Store::getInstance('', true);
}
......
......@@ -113,20 +113,20 @@ class LinkTest extends TestCase {
// 1 Parameter
$expect = $args;
$expect['page'] = BASE_DIR_FAKE . '/page1';
$expect['page'] = BASE_URL_FAKE . 'page1';
$result = $link->fillParameter(array(), 'p:page1', $rcTokenGiven);
$this->assertEquals($expect, $result);
// 1 Parameter, 1 Default
$expect = $args;
$expect['page'] = BASE_DIR_FAKE . '/page1';
$expect['page'] = BASE_URL_FAKE . 'page1';
$expect['text'] = 'comment';
$result = $link->fillParameter(array(), 'p:page1', $rcTokenGiven, 't:comment');
$this->assertEquals($expect, $result);
// 1 Parameter, 1 Default
$expect = $args;
$expect['page'] = BASE_DIR_FAKE . '/page1';
$expect['page'] = BASE_URL_FAKE . 'page1';
$expect['text'] = 'comment';
$expect['sip'] = '1';
$result = $link->fillParameter(array(), 'p:page1|t:comment', $rcTokenGiven, 'p:page1|t:comment|s');
......@@ -147,14 +147,14 @@ class LinkTest extends TestCase {
$result = $link->fillParameter(array(), 'p:page1|t:text', $rcTokenGiven, 'd:download.pdf');
// unit test behaves different on webwork16/crose/qfq and gitlab runner: so remove problematic BASE_DIR_FAKE
$result = str_replace(BASE_DIR_FAKE, '', $result);
$result = str_replace(BASE_URL_FAKE, '', $result);
$this->assertEquals($expect, $result);
$expect['mode'] = 'file';
$expect['downloadElements'] = ['p:page1', 'F:file.pdf'];
$result = $link->fillParameter(array(), 'p:page1|t:text|d:download.pdf', $rcTokenGiven, 's|M:file|d|F:file.pdf');
// unit test behaves different on webwork16/crose/qfq and gitlab runner: so remove problematic BASE_DIR_FAKE
$result = str_replace(BASE_DIR_FAKE, '', $result);
$result = str_replace(BASE_URL_FAKE, '', $result);
$this->assertEquals($expect, $result);
}
......@@ -212,22 +212,22 @@ class LinkTest extends TestCase {
Store::setVar(TYPO3_PAGE_SLUG, '/firstPage', STORE_TYPO3);
$result = $link->renderLink('p');
$this->assertEquals('<a href="' . BASE_DIR_FAKE . '/firstPage" >' . BASE_DIR_FAKE . '/firstPage</a>', $result);
$this->assertEquals('<a href="' . BASE_URL_FAKE . 'firstPage" >' . BASE_URL_FAKE . '/firstPage</a>', $result);
$result = $link->renderLink('p:');
$this->assertEquals('<a href="' . BASE_DIR_FAKE . '/firstPage" >' . BASE_DIR_FAKE . '/firstPage</a>', $result);
$this->assertEquals('<a href="' . BASE_URL_FAKE . 'firstPage" >' . BASE_URL_FAKE . '/firstPage</a>', $result);
$result = $link->renderLink('p:secondPage');
$this->assertEquals('<a href="' . BASE_DIR_FAKE . '/secondPage" >' . BASE_DIR_FAKE . '/secondPage</a>', $result);
$this->assertEquals('<a href="' . BASE_URL_FAKE . 'secondPage" >' . BASE_URL_FAKE . '/secondPage</a>', $result);
$result = $link->renderLink('p:id=secondPage');
$this->assertEquals('<a href="' . BASE_DIR_FAKE . '/secondPage" >' . BASE_DIR_FAKE . '/secondPage</a>', $result);
$this->assertEquals('<a href="' . BASE_URL_FAKE . 'secondPage" >' . BASE_URL_FAKE . '/secondPage</a>', $result);
$result = $link->renderLink('p:id=secondPage&id=100&t=2&param=hello');
$this->assertEquals('<a href="' . BASE_DIR_FAKE . '/secondPage?id=100&t=2&param=hello" >' . BASE_DIR_FAKE . '/secondPage?id=100&t=2&param=hello</a>', $result);
$this->assertEquals('<a href="' . BASE_URL_FAKE . 'secondPage?id=100&t=2&param=hello" >' . BASE_URL_FAKE . '/secondPage?id=100&t=2&param=hello</a>', $result);
$result = $link->renderLink('p:secondPage|t:Hello world');
$this->assertEquals('<a href="' . BASE_DIR_FAKE . '/secondPage" >Hello world</a>', $result);
$this->assertEquals('<a href="' . BASE_URL_FAKE . 'secondPage" >Hello world</a>', $result);
}
/**
......@@ -672,7 +672,7 @@ class LinkTest extends TestCase {
$result = $link->renderLink('u:http://example.com|B:yellow');
// phpunit on `webwork16/crose/qfq` returns 'typo3conf/ext/qfq/Resources/Public/...' - on gitlab runner they return BASE_DIR_FAKE
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="http://example.com" ><img alt="Bullet yellow" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/bullet-yellow.gif" title="yellow" ></a>', $result);
$result = $link->renderLink('t:Example|B:yellow');
......@@ -810,7 +810,7 @@ class LinkTest extends TestCase {
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
$result = $link->renderLink('u:http://example.com|B');
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="http://example.com" ><img alt="Bullet green" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif" title="green" ></a>', $result);
$result = $link->renderLink('u:http://example.com|B:green');
......@@ -844,7 +844,7 @@ class LinkTest extends TestCase {
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
$result = $link->renderLink('u:http://example.com|C');
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="http://example.com" ><img alt="Checked green" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="green" ></a>', $result);
$result = $link->renderLink('u:http://example.com|C:green');
......@@ -1230,7 +1230,7 @@ class LinkTest extends TestCase {
// Bullet, LEFT (Standard)
$result = $link->renderLink('u:http://example.com|t:Hello World|B');
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="http://example.com" ><img alt="Bullet green" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif" title="green" > Hello World</a>', $result);
// Bullet, RIGHT
......@@ -1435,7 +1435,7 @@ EOF;
// Report Delete action, default: 'Report', no Icon
$result = $link->renderLink('U:form=Person&r=123|x');
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="' . $base . 'typo3conf/ext/qfq/Classes/Api/delete.php?s=badcaffee1234" >' . $base . 'typo3conf/ext/qfq/Classes/Api/delete.php?s=badcaffee1234</a>', $result);
// Check das via '_paged' SIP_MODE_ANSWER and SIP_TARGET_URL has been set.
$result = Session::get('badcaffee1234');
......@@ -1561,7 +1561,7 @@ EOF;
// Single file
$result = $link->renderLink('d|F:file.pdf');
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="' . $base . 'typo3conf/ext/qfq/Classes/Api/download.php?s=badcaffee1234" 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
......@@ -1633,7 +1633,7 @@ EOF;
Store::setVar(SYSTEM_SQL_DIRECT_DOWNLOAD . 'downloadphp', 'SELECT "d|F:file.pdf"', STORE_SYSTEM);
$result = $link->renderLink('d:123|s:0');
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="' . $base . 'typo3conf/ext/qfq/Classes/Api/download.php/123" class="0" title="Download" ><span class="btn btn-default" data-toggle="modal" data-target="#qfqModal101" data-title="Download: 123" 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);
Store::setVar(SYSTEM_SQL_DIRECT_DOWNLOAD . 'dlphp', 'SELECT "d|F:file.pdf"', STORE_SYSTEM);
......
......@@ -176,22 +176,22 @@ class ReportTest extends AbstractDatabaseTest {
// link
$result = $this->report->process("10.sql = SELECT 'u:http://www.example.com' AS _link FROM Person ORDER BY id LIMIT 1");
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="http://www.example.com" >http://www.example.com</a>', $result);
// link, checked
$result = $this->report->process("10.sql = SELECT 'u:http://www.example.com|C' AS _link FROM Person ORDER BY id LIMIT 1");
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="http://www.example.com" ><img alt="Checked green" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="green" ></a>', $result);
// linck, checked, text
$result = $this->report->process("10.sql = SELECT 'u:http://www.example.com|C|t:Hello World' AS _link FROM Person ORDER BY id LIMIT 1");
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="http://www.example.com" ><img alt="Checked green" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="green" > Hello World</a>', $result);
// link, checked, text, tooltip
$result = $this->report->process("10.sql = SELECT 'u:http://www.example.com|C|t:Hello World|o:more information' AS _link FROM Person ORDER BY id LIMIT 1");
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="http://www.example.com" title="more information" ><img alt="Checked green" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="more information" > Hello World</a>', $result);
}
......@@ -419,7 +419,7 @@ EOF;
// page & bullet (green)
$result = $this->report->process("10.sql = SELECT 'p:form|B' AS _page FROM Person ORDER BY id LIMIT 1");
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" ><img alt="Bullet green" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif" title="green" ></a>', $result);
// page & bullet (green)
......@@ -430,7 +430,7 @@ EOF;
foreach ($arr as $color) {
// page & bullet $color
$result = $this->report->process("10.sql = SELECT 'p:form|B:$color' AS _page FROM Person ORDER BY id LIMIT 1");
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" ><img alt="Bullet ' . $color . '" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/bullet-' . $color . '.gif" title="' . $color . '" ></a>', $result);
}
}
......@@ -452,7 +452,7 @@ EOF;
// page & bullet (green)
$result = $this->report->process("10.sql = SELECT 'p:form|C' AS _page FROM Person ORDER BY id LIMIT 1");
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" ><img alt="Checked green" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif" title="green" ></a>', $result);
// page & bullet (green)
......@@ -544,7 +544,7 @@ EOF;
// page & AltText - image
$result = $this->report->process("10.sql = SELECT 'p:form|t:Person|B|a' AS _page FROM Person ORDER BY id LIMIT 1");
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" ><img src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif" title="green" > Person</a>', $result);
// page & AltText - image
......@@ -709,7 +709,7 @@ EOF;
// page & target (empty)
$result = $this->report->process("10.sql = SELECT 'p:form|t:Person|R|B' AS _page FROM Person ORDER BY id LIMIT 1");
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<a href="index.php?id=form&s=badcaffee1234" >Person <img alt="Bullet green" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/bullet-green.gif" title="green" ></a>', $result);
}
......@@ -941,7 +941,7 @@ EOF;
// $this->assertEquals('<a href="' . Path::urlApi(API_DELETE_PHP) . '?s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result);
// unit test behaves different on webwork16/crose/qfq and gitlab runner: so remove problematic BASE_DIR_FAKE
$result = str_replace(BASE_DIR_FAKE, '', $result);
$result = str_replace(BASE_URL_FAKE, '', $result);
$this->assertEquals('<a href="' . Path::appToApi(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.
......@@ -952,7 +952,7 @@ EOF;
$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="' . Path::urlApi(API_DELETE_PHP) . '?s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result);
// unit test behaves different on webwork16/crose/qfq and gitlab runner: so remove problematic BASE_DIR_FAKE
$result = str_replace(BASE_DIR_FAKE, '', $result);
$result = str_replace(BASE_URL_FAKE, '', $result);
$this->assertEquals('<a href="' . Path::appToApi(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.
......@@ -965,12 +965,12 @@ EOF;
$js = str_replace("type: 'warning'", "type: 'success'", $js);
$result = $this->report->process("10.sql = SELECT 'U:table=Person&r=123|q:Move to trash?:success:yes:no:10:0' AS _paged FROM Person ORDER BY id LIMIT 1");
// unit test behaves different on webwork16/crose/qfq and gitlab runner: so remove problematic BASE_DIR_FAKE
$result = str_replace(BASE_DIR_FAKE, '', $result);
$result = str_replace(BASE_URL_FAKE, '', $result);
$this->assertEquals('<a href="' . Path::appToApi(API_DELETE_PHP) . '?s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result);
$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");
// unit test behaves different on webwork16/crose/qfq and gitlab runner: so remove problematic BASE_DIR_FAKE
$result = str_replace(BASE_DIR_FAKE, '', $result);
$result = str_replace(BASE_URL_FAKE, '', $result);
$this->assertEquals('<a href="' . Path::appToApi(API_DELETE_PHP) . '?s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span> click me</a>', $result);
}
......@@ -1005,7 +1005,7 @@ EOF;
// _Paged: incl. alert
$result = $this->report->process("10.sql = SELECT 'table=Person&r=123' AS _Paged FROM Person ORDER BY id LIMIT 1");
// unit test behaves different on webwork16/crose/qfq and gitlab runner: so remove problematic BASE_DIR_FAKE
$result = str_replace(BASE_DIR_FAKE, '', $result);
$result = str_replace(BASE_URL_FAKE, '', $result);
$this->assertEquals('<a href="' . Path::appToApi(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.
......@@ -1018,25 +1018,25 @@ EOF;
$js = str_replace("type: 'warning'", "type: 'success'", $js);
$result = $this->report->process("10.sql = SELECT 'table=Person&r=123|||Move to trash?:success:yes:no:10:0' AS _Paged FROM Person ORDER BY id LIMIT 1");
// unit test behaves different on webwork16/crose/qfq and gitlab runner: so remove problematic BASE_DIR_FAKE
$result = str_replace(BASE_DIR_FAKE, '', $result);
$result = str_replace(BASE_URL_FAKE, '', $result);
$this->assertEquals('<a href="' . Path::appToApi(API_DELETE_PHP) . '?s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result);
$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");
// unit test behaves different on webwork16/crose/qfq and gitlab runner: so remove problematic BASE_DIR_FAKE
$result = str_replace(BASE_DIR_FAKE, '', $result);
$result = str_replace(BASE_URL_FAKE, '', $result);
$this->assertEquals('<a href="' . Path::appToApi(API_DELETE_PHP) . '?s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span> click me</a>', $result);
// Empty string is ok
$result = $this->report->process("10.sql = SELECT '' AS _Paged FROM Person ORDER BY id LIMIT 1");
// unit test behaves different on webwork16/crose/qfq and gitlab runner: so remove problematic BASE_DIR_FAKE
$result = str_replace(BASE_DIR_FAKE, '', $result);
$result = str_replace(BASE_URL_FAKE, '', $result);
$this->assertEquals('', $result);
// r=0 is ok
$result = $this->report->process("10.sql = SELECT 'table=Person&r=0' AS _Paged FROM Person ORDER BY id LIMIT 1");
// unit test behaves different on webwork16/crose/qfq and gitlab runner: so remove problematic BASE_DIR_FAKE
$result = str_replace(BASE_DIR_FAKE, '', $result);
$result = str_replace(BASE_URL_FAKE, '', $result);
$this->assertEquals('', $result);
}
......@@ -1371,7 +1371,7 @@ EOF;
foreach ($arr as $color) {
// bullet $color
$result = $this->report->process("10.sql = SELECT '$color' AS _bullet FROM Person ORDER BY id LIMIT 1");
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<img alt="Bullet ' . $color . '" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/bullet-' . $color . '.gif" title="' . $color . '" >', $result);
}
}
......@@ -1395,7 +1395,7 @@ EOF;
foreach ($arr as $color) {
// check $color
$result = $this->report->process("10.sql = SELECT '$color' AS _check FROM Person ORDER BY id LIMIT 1");
$base = (strpos($result, BASE_DIR_FAKE) === false) ? '' : BASE_DIR_FAKE;
$base = (strpos($result, BASE_URL_FAKE) === false) ? '' : BASE_URL_FAKE;
$this->assertEquals('<img alt="Checked ' . $color . '" src="' . $base . 'typo3conf/ext/qfq/Resources/Public/icons/checked-' . $color . '.gif" title="' . $color . '" >', $result);
}
}
......
Markdown is supported
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