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
19d36d65
Commit
19d36d65
authored
Jan 26, 2016
by
Carsten Rose
Browse files
unittests: namespace 'qfq' unified
parent
beb494e7
Changes
8
Hide whitespace changes
Inline
Side-by-side
tests/phpunit/AbstractDatabaseTest.php
View file @
19d36d65
...
...
@@ -3,8 +3,7 @@
* @author Rafael Ostertag <rafael.ostertag@math.uzh.ch>
*/
use
qfq\helper
;
use
qfq\store
;
use
qfq\Store
;
require_once
(
__DIR__
.
'/../../qfq/Database.php'
);
require_once
(
__DIR__
.
'/../../qfq/store/Store.php'
);
...
...
@@ -57,7 +56,7 @@ abstract class AbstractDatabaseTest extends PHPUnit_Framework_TestCase {
protected
function
setUp
()
{
// Init the store also reads db credential configuration
$this
->
store
=
\
qfq\store\
Store
::
getInstance
();
$this
->
store
=
Store
::
getInstance
();
// SWITCH to TestDB
$this
->
store
->
setVar
(
SYSTEM_DB
,
$this
->
store
->
getVar
(
SYSTEM_TESTDB
,
STORE_SYSTEM
),
STORE_SYSTEM
);
...
...
tests/phpunit/EvaluateTest.php
View file @
19d36d65
...
...
@@ -8,7 +8,7 @@
//namespace qfq;
//
use qfq\
store\
Store;
use
qfq\Store
;
//use qfq
require_once
(
__DIR__
.
'/AbstractDatabaseTest.php'
);
...
...
@@ -144,7 +144,7 @@ class EvaluateTest extends AbstractDatabaseTest {
protected
function
setUp
()
{
$this
->
store
=
\
qfq\store\
Store
::
getInstance
(
'form=TestFormName'
);
$this
->
store
=
Store
::
getInstance
(
'form=TestFormName'
);
parent
::
setUp
();
$this
->
executeSQLFile
(
__DIR__
.
'/fixtures/Generic.sql'
,
true
);
...
...
tests/phpunit/FormTest.php
View file @
19d36d65
...
...
@@ -12,7 +12,7 @@ require_once(__DIR__ . '/../../qfq/Constants.php');
require_once
(
__DIR__
.
'/../../qfq/Form.php'
);
require_once
(
__DIR__
.
'/../../qfq/store/Store.php'
);
class
FormTest
extends
PHPUnit_Framework_TestCase
{
class
FormTest
extends
\
PHPUnit_Framework_TestCase
{
private
$store
;
...
...
tests/phpunit/HelperFormElementTest.php
0 → 100644
View file @
19d36d65
<?php
/**
* Created by PhpStorm.
* User: crose
* Date: 1/26/16
* Time: 2:56 PM
*/
namespace
qfq
;
use
qfq\HelperFormElement
;
require_once
(
__DIR__
.
'/../../qfq/helper/HelperFormElement.php'
);
require_once
(
__DIR__
.
'/../../qfq/Constants.php'
);
class
HelperFormElementTest
extends
\
PHPUnit_Framework_TestCase
{
public
function
testEexplodeParameter
()
{
$a
=
array
();
HelperFormElement
::
explodeParameter
(
$a
);
$this
->
assertEquals
(
array
(),
$a
,
"Both arrays should be equal and empty"
);
$a
=
[
0
=>
[
'id'
=>
100
,
'parameter'
=>
"work=12
\n
list=1:new,2:edit,3:delete"
]];
$b
=
[
0
=>
[
'id'
=>
100
,
'parameter'
=>
"work=12
\n
list=1:new,2:edit,3:delete"
,
'work'
=>
12
,
'list'
=>
'1:new,2:edit,3:delete'
]];
HelperFormElement
::
explodeParameter
(
$a
);
$this
->
assertEquals
(
$b
,
$a
,
"Both arrays should be equal"
);
}
/**
* @expectedException \qfq\exceptions\UserException
*
*/
public
function
testExplodeParameterException
()
{
$a
=
[
0
=>
[
'id'
=>
111
,
'name'
=>
'hello'
,
'collision'
=>
'dummy'
,
'parameter'
=>
"work=12
\n
collision=1:new,2:edit,3:delete"
]];
HelperFormElement
::
explodeParameter
(
$a
);
}
}
tests/phpunit/KeyValueStringParserTest.php
View file @
19d36d65
...
...
@@ -5,12 +5,10 @@
namespace
qfq
;
use
qfq
;
use
qfq
\KeyValueStringParser
;
require_once
(
__DIR__
.
'/../../qfq/Constants.php'
);
//use qfq\helper;
use
qfq\helper\KeyValueStringParser
;
require_once
(
__DIR__
.
'/../../qfq/helper/KeyValueStringParser.php'
);
...
...
tests/phpunit/OnArrayTest.php
View file @
19d36d65
...
...
@@ -6,7 +6,7 @@
* Time: 9:28 AM
*/
namespace
qfq
\helper
;
namespace
qfq
;
require_once
(
__DIR__
.
'/../../qfq/helper/OnArray.php'
);
...
...
@@ -30,11 +30,11 @@ class OnArrayTest extends \PHPUnit_Framework_TestCase {
];
$expected
=
$unsorted
;
\
qfq\helper\
OnArray
::
sortKey
(
$expected
);
OnArray
::
sortKey
(
$expected
);
$this
->
assertEquals
(
$sorted
,
$expected
);
$expected
=
array
();
\
qfq\helper\
OnArray
::
sortKey
(
$expected
);
OnArray
::
sortKey
(
$expected
);
$this
->
assertEquals
(
array
(),
$expected
);
}
...
...
@@ -43,6 +43,6 @@ class OnArrayTest extends \PHPUnit_Framework_TestCase {
$raw
=
[
'hello'
,
'"next"'
,
'"without trailing'
,
'without leading"'
,
' with whitespace '
,
'" with tick and whitespace "'
,
''
];
$expected
=
[
'hello'
,
'next'
,
'without trailing'
,
'without leading'
,
' with whitespace '
,
' with tick and whitespace '
,
''
];
$this
->
assertEquals
(
\
qfq\helper\
OnArray
::
trimArray
(
$raw
,
'"'
),
$expected
);
$this
->
assertEquals
(
OnArray
::
trimArray
(
$raw
,
'"'
),
$expected
);
}
}
tests/phpunit/SipTest.php
View file @
19d36d65
<?php
namespace
qfq
;
//use qfq\Sip;
require_once
(
__DIR__
.
'/../../qfq/Constants.php'
);
require_once
(
__DIR__
.
'/../../qfq/Form.php'
);
require_once
(
__DIR__
.
'/../../qfq/store/Sip.php'
);
...
...
@@ -10,11 +14,11 @@ require_once(__DIR__ . '/../../qfq/store/Sip.php');
* Date: 1/10/16
* Time: 10:55 PM
*/
class
SipTest
extends
PHPUnit_Framework_TestCase
{
class
SipTest
extends
\
PHPUnit_Framework_TestCase
{
public
function
testUrlparamToSip
()
{
$sip
=
new
\
qfq\store\
Sip
(
'fakesessionname'
,
true
);
$sip
=
new
Sip
(
'fakesessionname'
,
true
);
$sip
->
sipUniqId
(
'badcaffee1234'
);
$result
=
$sip
->
urlParamToSip
(
"http://example.com/index.php?id=input&r=1&form=person"
,
RETURN_URL
);
...
...
@@ -57,7 +61,7 @@ class SipTest extends PHPUnit_Framework_TestCase {
}
public
function
testGetVarsFromSip
()
{
$sip
=
new
\
qfq\store\
Sip
(
'fakesessionname'
,
true
);
$sip
=
new
Sip
(
'fakesessionname'
,
true
);
$sip
->
sipUniqId
(
'badcaffee1234'
);
$sip2
=
$sip
->
urlParamToSip
(
"http://example.com/index.php?a=1&b=2&c=3"
,
RETURN_SIP
);
...
...
@@ -87,7 +91,7 @@ class SipTest extends PHPUnit_Framework_TestCase {
public
function
testGetSipFromUrlParam
()
{
$sip
=
new
\
qfq\store\
Sip
(
'fakesessionname'
,
true
);
$sip
=
new
Sip
(
'fakesessionname'
,
true
);
$sip
->
sipUniqId
(
'badcaffee1234'
);
$result
=
$sip
->
urlParamToSip
(
"http://example.com/index.php?id=input&r=1&form=person"
,
RETURN_URL
);
...
...
@@ -105,7 +109,7 @@ class SipTest extends PHPUnit_Framework_TestCase {
}
public
function
testSipUniqId
()
{
$sip
=
new
\
qfq\store\
Sip
(
'fakesessionname'
,
true
);
$sip
=
new
Sip
(
'fakesessionname'
,
true
);
$sip
->
sipUniqId
(
'badcaffee1234'
);
$s
=
$sip
->
sipUniqId
(
'badcaffee1234'
);
...
...
tests/phpunit/StoreTest.php
View file @
19d36d65
...
...
@@ -6,9 +6,10 @@
* Time: 9:16 PM
*/
namespace
qfq
\store
;
namespace
qfq
;
use
qfq
;
use
qfq\Store
;
//use qfq\exceptions\CodeException;
...
...
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