Commit da6a59ff authored by Carsten  Rose's avatar Carsten Rose
Browse files

Initial creation

parent d79edba4
......@@ -32,7 +32,7 @@
<?php
include("t3/form.php");
loadForm();
qfq\renderForm();
?>
......
......@@ -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
......@@ -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();
......
......@@ -11,8 +11,9 @@ require_once(__DIR__ . '/../../qfq/Form.php');
class FormTest extends PHPUnit_Framework_TestCase {
public function testToHTML() {
public function testProcess() {
$form = new qfq\Form();
$this->assertEquals("Hello World", $form->toHTML());
$this->assertEquals("Hello World from class Form", $form->process());
}
}
#!/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
Supports Markdown
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