Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
1447b3a1
Commit
1447b3a1
authored
Feb 18, 2018
by
Carsten Rose
Browse files
Fix PHPUnit tests
parent
0c4672ff
Changes
5
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/report/Report.php
View file @
1447b3a1
...
...
@@ -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"
]);
...
...
extension/qfq/tests/phpunit/BuildFormPlainTest.php
View file @
1447b3a1
...
...
@@ -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
=
[
...
...
extension/qfq/tests/phpunit/LinkTest.php
View file @
1447b3a1
...
...
@@ -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
);
}
/**
...
...
extension/qfq/tests/phpunit/ReportTest.php
View file @
1447b3a1
...
...
@@ -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"
);
...
...
extension/qfq/tests/phpunit/SaveTest.php
View file @
1447b3a1
...
...
@@ -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'
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment