mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
25 lines
1.1 KiB
PHP
25 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\UserForms\Tests\FormField;
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
use SilverStripe\UserForms\FormField\UserFormsOptionSetField;
|
|
use SilverStripe\UserForms\Model\EditableFormField\EditableRadioField;
|
|
|
|
class UserFormsOptionSetFieldTest extends SapphireTest
|
|
{
|
|
protected static $fixture_file = '../UserFormsTest.yml';
|
|
|
|
public function testCustomErrorMessageValidationAttributesHTML()
|
|
{
|
|
/** @var UserFormsOptionSetField $userFormsOptionSetField */
|
|
$radio = $this->objFromFixture(EditableRadioField::class, 'radio-field');
|
|
$radio->Required = true;
|
|
$radio->CustomErrorMessage = 'My custom error message with \'single\' and "double" quotes';
|
|
$userFormsOptionSetField = $radio->getFormField();
|
|
$html = $userFormsOptionSetField->renderWith(UserFormsOptionSetField::class)->getValue();
|
|
$attributesHTML = 'data-rule-required="true" data-msg-required="My custom error message with &#039;single&#039; and &quot;double&quot; quotes"';
|
|
$this->assertTrue(strpos($html, $attributesHTML) > 0);
|
|
}
|
|
}
|