Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qfq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
typo3
qfq
Commits
da6a59ff
Commit
da6a59ff
authored
9 years ago
by
Carsten Rose
Browse files
Options
Downloads
Patches
Plain Diff
Initial creation
parent
d79edba4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
index.php
+1
-1
1 addition, 1 deletion
index.php
qfq/Form.php
+34
-3
34 additions, 3 deletions
qfq/Form.php
t3/form.php
+11
-3
11 additions, 3 deletions
t3/form.php
tests/phpunit/FormTest.php
+3
-2
3 additions, 2 deletions
tests/phpunit/FormTest.php
tests/runtests.sh
+48
-0
48 additions, 0 deletions
tests/runtests.sh
with
97 additions
and
9 deletions
index.php
+
1
−
1
View file @
da6a59ff
...
...
@@ -32,7 +32,7 @@
<?php
include
(
"t3/form.php"
);
load
Form
();
qfq\render
Form
();
?>
...
...
This diff is collapsed.
Click to expand it.
qfq/Form.php
+
34
−
3
View file @
da6a59ff
...
...
@@ -6,12 +6,16 @@
* Time: 6:33 PM
*/
namespace
qfq
;
require_once
(
__DIR__
.
'/../qfq/Store.php'
);
require_once
(
__DIR__
.
'/../qfq/Constants.php'
);
class
Form
{
protected
$config
=
null
;
//
protected $store = null;
protected
$store
=
null
;
// protected $formElements = null;
// protected $userLog = null;
...
...
@@ -31,9 +35,36 @@ class Form {
* Do all FormElements
* doActions 'After'
*/
$this
->
store
=
Store
::
getInstance
();
}
/*
*
*/
public
function
process
()
{
$this
->
loadFormDefinition
();
return
"Hello World from class Form"
;
}
public
function
toHTML
()
{
return
"Hello World from Class Form"
;
/*
*
*/
private
function
loadFormDefinition
()
{
$formName
=
$this
->
getFormName
();
echo
"--
$formName
--"
;
}
private
function
getFormName
()
{
// by bodytext
// by session
// by GET['formular']
$formName
=
$this
->
store
->
getVar
(
CLIENT_FORM
,
STORE_CLIENT
);
return
$formName
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
t3/form.php
+
11
−
3
View file @
da6a59ff
...
...
@@ -5,21 +5,29 @@
* Date: 12/23/15
* Time: 6:16 PM
*/
require_once
(
__DIR__
.
'/../qfq/Form.php'
);
namespace
qfq
;
use
qfq\exceptions\UserException
;
use
qfq\exceptions\CodeException
;
require_once
(
__DIR__
.
'/../qfq/Form.php'
);
require_once
(
__DIR__
.
'/../exceptions/UserException.php'
);
require_once
(
__DIR__
.
'/../exceptions/CodeException.php'
);
//TODO: unit tests fuer alle abgefangenen Exceptions
function
loadForm
()
{
/*
*
* @param string $bodytext keyvalue pairs.
*
* @return $string LOAD: the form as HTML, SAVE: success or failure message, or JS redirect to destination page.
*/
function
renderForm
(
$bodytext
=
""
)
{
try
{
$form
=
new
\qfq\Form
();
echo
$form
->
toHTML
();
echo
$form
->
process
();
}
catch
(
UserException
$e
)
{
echo
$e
->
formatMessage
();
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/FormTest.php
+
3
−
2
View file @
da6a59ff
...
...
@@ -11,8 +11,9 @@ require_once(__DIR__ . '/../../qfq/Form.php');
class
FormTest
extends
PHPUnit_Framework_TestCase
{
public
function
test
ToHTML
()
{
public
function
test
Process
()
{
$form
=
new
qfq\Form
();
$this
->
assertEquals
(
"Hello World"
,
$form
->
toHTML
());
$this
->
assertEquals
(
"Hello World
from class Form
"
,
$form
->
process
());
}
}
This diff is collapsed.
Click to expand it.
tests/runtests.sh
0 → 100644
+
48
−
0
View file @
da6a59ff
#!/bin/bash
function
help_message
()
{
cat
<<
EOF
`basename
$0
` -p <phpunitphar> -t <testdirectory> -m <mailto> [-h]
EOF
}
while
getopts
p:t:m:h name
do
case
"
$name
"
in
h
)
help_message
exit
0
;;
p
)
PHPUNITPHAR
=
$OPTARG
;;
t
)
TESTPATH
=
$OPTARG
;;
m
)
MAILTO
=
$OPTARG
;;
esac
done
if
[
-z
"
$PHPUNITPHAR
"
-o
-z
"
$TESTPATH
"
-o
-z
"
$MAILTO
"
]
then
help_message
exit
1
fi
PHPUNITOUTPUT
=
`
php
$PHPUNITPHAR
"
$TESTPATH
/phpunit"
2>&1
`
if
[
$?
-ne
0
]
;
then
echo
"
$PHPUNITOUTPUT
"
| mailx
-s
'QFQ PHPUnit Tests Failed'
$MAILTO
fi
# if type phantomjs >/dev/null 2>&1
# then
# phantomjs "$TESTPATH/phantom.js"
# if [ -f /tmp/phantomjs.png ]
# then
# mailx -s 'PhantomJS freaked' -a /tmp/phantomjs.png $MAILTO && rm -f /tmp/phantomjs.png
# fi
# fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment