mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MNT Fix test for required password fields in kitchen sink (#11111)
This commit is contained in:
parent
cc0edf242e
commit
b979ce5896
@ -2,6 +2,7 @@
|
||||
|
||||
namespace SilverStripe\Forms\Tests;
|
||||
|
||||
use SilverStripe\Admin\LeftAndMain;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Forms\ConfirmedPasswordField;
|
||||
@ -11,6 +12,7 @@ use SilverStripe\Forms\ReadonlyField;
|
||||
use SilverStripe\Forms\RequiredFields;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\PasswordValidator;
|
||||
use SilverStripe\View\SSViewer;
|
||||
|
||||
class ConfirmedPasswordFieldTest extends SapphireTest
|
||||
{
|
||||
@ -437,6 +439,11 @@ class ConfirmedPasswordFieldTest extends SapphireTest
|
||||
*/
|
||||
public function testChildFieldsAreRequired(bool $canBeEmpty, bool $required, bool $childrenRequired, bool $expectRequired)
|
||||
{
|
||||
// CWP front-end templates break this logic - but there's no easy fix for that.
|
||||
// For the most part we are interested in ensuring this works in the CMS with default templates.
|
||||
$originalThemes = SSViewer::get_themes();
|
||||
SSViewer::set_themes(LeftAndMain::config()->uninherited('admin_themes'));
|
||||
try {
|
||||
$form = new Form();
|
||||
$field = new ConfirmedPasswordField('Test');
|
||||
$field->setForm($form);
|
||||
@ -461,5 +468,8 @@ class ConfirmedPasswordFieldTest extends SapphireTest
|
||||
} else {
|
||||
$this->assertDoesNotMatchRegularExpression($regex, $rendered);
|
||||
}
|
||||
} finally {
|
||||
SSViewer::set_themes($originalThemes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user