mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
3c1d81d014
API change: refactored Form() into getFormFields(), getFormActions(), getRequiredFields() ENHANCEMENT: added updateForm* extension hooks to allow customization of userforms BUGFIX: gave custom scripts their own ID to enable it to be blocked.
69 lines
1.7 KiB
PHP
69 lines
1.7 KiB
PHP
<?php
|
|
|
|
class SubmittedFormTest extends FunctionalTest {
|
|
|
|
static $fixture_file = 'userforms/tests/SubmittedFormTest.yml';
|
|
|
|
function testReportSubmissions() {
|
|
|
|
}
|
|
|
|
function testCSVExport() {
|
|
|
|
}
|
|
|
|
function testdeletesubmission() {
|
|
|
|
}
|
|
|
|
function testdeletesubmissions() {
|
|
|
|
}
|
|
|
|
function testOnBeforeDeleteOfForm() {
|
|
$field = $this->objFromFixture('SubmittedFormField', 'submitted-form-field-1');
|
|
$form = $field->Parent();
|
|
|
|
$this->assertEquals($form->FieldValues()->Count(), 2);
|
|
$form->delete();
|
|
|
|
$fields = DataObject::get('SubmittedFormField', "ParentID = '$form->ID'");
|
|
|
|
$this->assertNull($fields);
|
|
}
|
|
|
|
function testGetFormattedValue() {
|
|
$field = $this->objFromFixture('SubmittedFormField', 'submitted-form-field-1');
|
|
|
|
$this->assertEquals('1', $field->getFormattedValue());
|
|
|
|
$textarea = $this->objFromFixture('SubmittedFormField', 'submitted-textarea-1');
|
|
|
|
$text = "I am here testing<br />\nTesting until I cannot<br />\nI love my testing";
|
|
|
|
$this->assertEquals($text, $textarea->getFormattedValue());
|
|
}
|
|
|
|
function testFileGetLink() {
|
|
$field = $this->objFromFixture('SubmittedFileField', 'submitted-file-1');
|
|
|
|
// @todo add checks for if no file can be downloaded
|
|
$this->assertContains('my-file.jpg', $field->getLink());
|
|
|
|
}
|
|
function testFileGetFormattedValue() {
|
|
$field = $this->objFromFixture('SubmittedFileField', 'submitted-file-1');
|
|
|
|
// @todo add checks for if no file can be downloaded
|
|
$this->assertContains('Download File', $field->getFormattedValue());
|
|
}
|
|
}
|
|
|
|
|
|
class SubmittedFormTest_Controller extends Controller {
|
|
|
|
function ReportField() {
|
|
return new Form($this, 'ReportField', new FieldSet(new SubmittedFormReportField('Report'), new FieldSet()));
|
|
}
|
|
}
|