mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Add tests to ensure that editable form fields allow nullable titles
This commit is contained in:
parent
e0c4dfd6c6
commit
d13bf1e0bc
@ -18,4 +18,12 @@ class EditableCheckboxGroupFieldTest extends SapphireTest
|
|||||||
$checkboxGroup = $this->objFromFixture(EditableCheckboxGroupField::class, 'checkbox-group');
|
$checkboxGroup = $this->objFromFixture(EditableCheckboxGroupField::class, 'checkbox-group');
|
||||||
$this->assertSame(UserFormsCheckboxSetField::class, $checkboxGroup->getFormField()->getTemplate());
|
$this->assertSame(UserFormsCheckboxSetField::class, $checkboxGroup->getFormField()->getTemplate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableCheckboxGroupField $field */
|
||||||
|
$field = EditableCheckboxGroupField::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
17
tests/Model/EditableFormField/EditableCheckboxTest.php
Normal file
17
tests/Model/EditableFormField/EditableCheckboxTest.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\UserForms\Tests\Model\EditableFormField;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\SapphireTest;
|
||||||
|
use SilverStripe\UserForms\Model\EditableFormField\EditableCheckbox;
|
||||||
|
|
||||||
|
class EditableCheckboxTest extends SapphireTest
|
||||||
|
{
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableCheckbox $field */
|
||||||
|
$field = EditableCheckbox::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
|
}
|
@ -13,4 +13,12 @@ class EditableCountryDropdownFieldTest extends SapphireTest
|
|||||||
|
|
||||||
$this->assertContains('/images/editabledropdown.png', $field->getIcon());
|
$this->assertContains('/images/editabledropdown.png', $field->getIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableCountryDropdownField $field */
|
||||||
|
$field = EditableCountryDropdownField::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
17
tests/Model/EditableFormField/EditableDateFieldTest.php
Normal file
17
tests/Model/EditableFormField/EditableDateFieldTest.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\UserForms\Tests\Model\EditableFormField;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\SapphireTest;
|
||||||
|
use SilverStripe\UserForms\Model\EditableFormField\EditableDateField;
|
||||||
|
|
||||||
|
class EditableDateFieldTest extends SapphireTest
|
||||||
|
{
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableDateField $field */
|
||||||
|
$field = EditableDateField::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
|
}
|
@ -36,4 +36,12 @@ class EditableDropdownTest extends SapphireTest
|
|||||||
$alternateDropdown->write();
|
$alternateDropdown->write();
|
||||||
$this->assertEquals($formField->getEmptyString(), '');
|
$this->assertEquals($formField->getEmptyString(), '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableDropdown $field */
|
||||||
|
$field = EditableDropdown::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
17
tests/Model/EditableFormField/EditableEmailFieldTest.php
Normal file
17
tests/Model/EditableFormField/EditableEmailFieldTest.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\UserForms\Tests\Model\EditableFormField;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\SapphireTest;
|
||||||
|
use SilverStripe\UserForms\Model\EditableFormField\EditableEmailField;
|
||||||
|
|
||||||
|
class EditableEmailFieldTest extends SapphireTest
|
||||||
|
{
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableEmailField $field */
|
||||||
|
$field = EditableEmailField::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
|
}
|
17
tests/Model/EditableFormField/EditableFieldGroupTest.php
Normal file
17
tests/Model/EditableFormField/EditableFieldGroupTest.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\UserForms\Tests\Model\EditableFormField;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\SapphireTest;
|
||||||
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
|
||||||
|
|
||||||
|
class EditableFieldGroupTest extends SapphireTest
|
||||||
|
{
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableFieldGroup $field */
|
||||||
|
$field = EditableFieldGroup::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
|
}
|
@ -64,4 +64,12 @@ class EditableFileFieldTest extends SapphireTest
|
|||||||
$formField = $fileField->getFormField();
|
$formField = $fileField->getFormField();
|
||||||
$this->assertEquals($formField->getValidator()->getAllowedMaxFileSize(), 262144);
|
$this->assertEquals($formField->getValidator()->getAllowedMaxFileSize(), 262144);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableFileField $field */
|
||||||
|
$field = EditableFileField::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
17
tests/Model/EditableFormField/EditableFormHeadingTest.php
Normal file
17
tests/Model/EditableFormField/EditableFormHeadingTest.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\UserForms\Tests\Model\EditableFormField;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\SapphireTest;
|
||||||
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFormHeading;
|
||||||
|
|
||||||
|
class EditableFormHeadingTest extends SapphireTest
|
||||||
|
{
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableFormHeading $field */
|
||||||
|
$field = EditableFormHeading::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
|
}
|
17
tests/Model/EditableFormField/EditableFormStepTest.php
Normal file
17
tests/Model/EditableFormField/EditableFormStepTest.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\UserForms\Tests\Model\EditableFormField;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\SapphireTest;
|
||||||
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
|
||||||
|
|
||||||
|
class EditableFormStepTest extends SapphireTest
|
||||||
|
{
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableFormStep $field */
|
||||||
|
$field = EditableFormStep::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
|
}
|
@ -87,4 +87,12 @@ class EditableLiteralFieldTest extends SapphireTest
|
|||||||
'Actual literal field exists in composite field children'
|
'Actual literal field exists in composite field children'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableLiteralField $field */
|
||||||
|
$field = EditableLiteralField::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\UserForms\Tests\Model\EditableFormField;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\SapphireTest;
|
||||||
|
use SilverStripe\Security\Group;
|
||||||
|
use SilverStripe\UserForms\Model\EditableFormField\EditableMemberListField;
|
||||||
|
|
||||||
|
class EditableMemberListFieldTest extends SapphireTest
|
||||||
|
{
|
||||||
|
protected static $fixture_file = 'EditableMemberListFieldTest.yml';
|
||||||
|
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableMemberListField $field */
|
||||||
|
$field = EditableMemberListField::create();
|
||||||
|
$field->GroupID = $this->idFromFixture(Group::class, 'a_group');
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
SilverStripe\Security\Group:
|
||||||
|
a_group:
|
||||||
|
Title: A security group
|
17
tests/Model/EditableFormField/EditableNumericFieldTest.php
Normal file
17
tests/Model/EditableFormField/EditableNumericFieldTest.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\UserForms\Tests\Model\EditableFormField;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\SapphireTest;
|
||||||
|
use SilverStripe\UserForms\Model\EditableFormField\EditableNumericField;
|
||||||
|
|
||||||
|
class EditableNumericFieldTest extends SapphireTest
|
||||||
|
{
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableNumericField $field */
|
||||||
|
$field = EditableNumericField::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
|
}
|
@ -3,8 +3,6 @@
|
|||||||
namespace SilverStripe\UserForms\Tests\Model\EditableFormField;
|
namespace SilverStripe\UserForms\Tests\Model\EditableFormField;
|
||||||
|
|
||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
use SilverStripe\UserForms\FormField\UserFormsCheckboxSetField;
|
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableCheckboxGroupField;
|
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableRadioField;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableRadioField;
|
||||||
|
|
||||||
class EditableRadioFieldTest extends SapphireTest
|
class EditableRadioFieldTest extends SapphireTest
|
||||||
@ -22,4 +20,12 @@ class EditableRadioFieldTest extends SapphireTest
|
|||||||
$radio->getFormField()->getTemplate()
|
$radio->getFormField()->getTemplate()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableRadioField $field */
|
||||||
|
$field = EditableRadioField::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,12 @@ class EditableTextFieldTest extends SapphireTest
|
|||||||
$this->assertInstanceOf(DropdownField::class, $autocompleteField);
|
$this->assertInstanceOf(DropdownField::class, $autocompleteField);
|
||||||
$this->assertEquals(['foo' => 'foo'], $autocompleteField->getSource());
|
$this->assertEquals(['foo' => 'foo'], $autocompleteField->getSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAllowEmptyTitle()
|
||||||
|
{
|
||||||
|
/** @var EditableTextField $field */
|
||||||
|
$field = EditableTextField::create();
|
||||||
|
$field->Name = 'EditableFormField_123456';
|
||||||
|
$this->assertEmpty($field->getFormField()->Title());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user