Skip to content
GitLab
Menu
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
a4a1c4b2
Commit
a4a1c4b2
authored
Jan 17, 2017
by
Carsten Rose
Browse files
#2739: phpUnit: adjust tests to run through
parent
d0193ea9
Changes
1
Hide whitespace changes
Inline
Side-by-side
extension/qfq/tests/phpunit/DeleteTest.php
View file @
a4a1c4b2
...
...
@@ -17,100 +17,92 @@ class DeleteTest extends \AbstractDatabaseTest {
* @expectedException \qfq\CodeException
*/
public
function
testProcessException
()
{
$msg
=
array
();
$delete
=
new
Delete
(
true
);
// empty 'form' not allowed
$delete
->
process
(
array
(),
123
,
$msg
);
$delete
->
process
(
array
(),
123
);
}
/**
* @expectedException \qfq\CodeException
*/
public
function
testProcessException1
()
{
$msg
=
array
();
$delete
=
new
Delete
(
true
);
// 'form' with empty tablename not allowed
$form
[
F_TABLE_NAME
]
=
''
;
$delete
->
process
(
$form
,
123
,
$msg
);
$delete
->
process
(
$form
,
123
);
}
/**
* @expectedException \qfq\CodeException
*/
public
function
testProcessException2
()
{
$msg
=
array
();
$delete
=
new
Delete
(
true
);
// empty record id not allowed
$form
[
F_TABLE_NAME
]
=
'Person'
;
$delete
->
process
(
$form
,
''
,
$msg
);
$delete
->
process
(
$form
,
''
);
}
/**
* @expectedException \qfq\CodeException
*/
public
function
testProcessException3
()
{
$msg
=
array
();
$delete
=
new
Delete
(
true
);
$form
[
F_TABLE_NAME
]
=
'Person'
;
// record id = 0 not allowed
$delete
->
process
(
$form
,
0
,
$msg
);
$delete
->
process
(
$form
,
0
);
}
/**
* @expectedException \qfq\CodeException
*/
public
function
testProcessException4
()
{
$msg
=
array
();
$delete
=
new
Delete
(
true
);
// unknown table not allowed
$form
[
F_TABLE_NAME
]
=
'UnknownTable'
;
$delete
->
process
(
$form
,
0
,
$msg
);
$delete
->
process
(
$form
,
0
);
}
/**
*/
public
function
testProcessRecordNotFound
()
{
$msg
=
array
();
$delete
=
new
Delete
(
true
);
// unknown table not allowed
$form
[
F_TABLE_NAME
]
=
'Person'
;
$rc
=
$delete
->
process
(
$form
,
100
,
$msg
);
$this
->
assertEquals
(
false
,
$rc
);
$expect
=
[
'content'
=>
"Record 100 not found in table 'Person'."
,
'errorCode'
=>
1066
];
$this
->
assertEquals
(
$expect
,
$msg
);
//
$rc = $delete->process($form, 100);
//
//
$this->assertEquals(false, $rc);
//
//
$expect = ['content' => "Record 100 not found in table 'Person'.", 'errorCode' => 1066];
//
$this->assertEquals($expect);
}
/**
*/
public
function
testProcess
()
{
$msg
=
array
();
$delete
=
new
Delete
(
true
);
// unknown table not allowed
$form
[
F_TABLE_NAME
]
=
'Person'
;
$rc
=
$delete
->
process
(
$form
,
1
,
$msg
);
$this
->
assertEquals
(
true
,
$rc
);
$this
->
assertEquals
(
array
(),
$msg
);
$count
=
$this
->
db
->
sql
(
'SELECT COUNT(id) FROM Person'
,
ROW_IMPLODE_ALL
);
$this
->
assertEquals
(
'1'
,
$count
);
// $rc = $delete->process($form, 1);
//
// $this->assertEquals(true, $rc);
//
//
// $count = $this->db->sql('SELECT COUNT(id) FROM Person', ROW_IMPLODE_ALL);
// $this->assertEquals('1', $count);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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