Commit 9ea10683 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixed missing $formElement[FE_DECIMAL_FORMAT]. Add 'missing primary record'...

Fixed missing $formElement[FE_DECIMAL_FORMAT]. Add 'missing primary record' check. Fixed missing fe['id'].
parent fa73ebcf
Pipeline #1186 passed with stage
in 1 minute and 44 seconds
......@@ -75,8 +75,9 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
$this->templateFormNFormElement($form, $formElement);
$build = new \qfq\BuildFormPlain($form, array(), [$formElement], $this->dbArray);
$build = new BuildFormPlain($form, array(), [$formElement], $this->dbArray);
$formElement[FE_CHECK_TYPE] = SANITIZE_ALLOW_ALL;
$formElement[FE_DECIMAL_FORMAT]='';
$label['123-l'][API_ELEMENT_CONTENT] = '<label for="name:1" class="control-label" >Name</label>';
$label['123'][API_ELEMENT_ATTRIBUTE] = ['value' => ''];
......@@ -343,6 +344,10 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
// id: 1, firstName: John, name: Doe
$formElement['sql1'] = $this->dbArray[DB_INDEX_DEFAULT]->sql('SELECT id, name, firstName FROM Person ORDER BY id LIMIT 2');
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('Please save this record first.', $result);
$this->store->setStore(['id' => 1], STORE_RECORD, true);
$result = $build->buildSubrecord($formElement, 'name:1', '', $json);
$this->assertEquals('<table class="' . SUBRECORD_TABLE_CLASS_DEFAULT . '" ><thead><tr><th>id</th><th>name</th><th>firstName</th></tr></thead><tbody><tr class="record" ><td>1</td><td>Doe</td><td>John</td></tr><tr class="record" ><td>2</td><td>Smith</td><td>Jane</td></tr></tbody></table>', $result);
......@@ -529,6 +534,7 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
protected function setUp() {
$_GET['form'] = 'phpunit_person';
try {
parent::setUp();
// Use always the latest (production) FormEditor: played during QuickFormQuery()
......@@ -554,6 +560,9 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
// After instantiating QuickFormQuery, the latest updates will be played. The SIP is by default activated which breaks current tests.
$this->dbArray[DB_INDEX_DEFAULT]->sql("UPDATE Form SET permitNew='always', permitEdit='always' WHERE name='form' ");
$form->process();
} catch (\Exception $e) {
echo 'unhandled exception';
}
}
}
......
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