FIX Set minimum test scores and password length for Members while running fixtured DataObject tests

This commit is contained in:
Robbie Averill 2019-08-15 15:23:11 +12:00
parent 4b44272367
commit f354e2018d

View File

@ -4,8 +4,6 @@ namespace SilverStripe\ORM\Tests;
use InvalidArgumentException; use InvalidArgumentException;
use LogicException; use LogicException;
use Page;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\i18n\i18n; use SilverStripe\i18n\i18n;
@ -20,11 +18,8 @@ use SilverStripe\ORM\FieldType\DBPolymorphicForeignKey;
use SilverStripe\ORM\FieldType\DBVarchar; use SilverStripe\ORM\FieldType\DBVarchar;
use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\ManyManyList;
use SilverStripe\ORM\Tests\DataObjectTest\Company; use SilverStripe\ORM\Tests\DataObjectTest\Company;
use SilverStripe\ORM\Tests\DataObjectTest\Fan;
use SilverStripe\ORM\Tests\DataObjectTest\OtherSubclassWithSameField;
use SilverStripe\ORM\Tests\DataObjectTest\Player; use SilverStripe\ORM\Tests\DataObjectTest\Player;
use SilverStripe\ORM\Tests\DataObjectTest\SubTeam; use SilverStripe\Security\Member;
use SilverStripe\ORM\Tests\DataObjectTest\Team;
use SilverStripe\View\ViewableData; use SilverStripe\View\ViewableData;
use stdClass; use stdClass;
@ -66,6 +61,19 @@ class DataObjectTest extends SapphireTest
DataObjectTest\MockDynamicAssignmentDataObject::class DataObjectTest\MockDynamicAssignmentDataObject::class
); );
protected function setUp()
{
parent::setUp();
$validator = Member::password_validator();
if ($validator) {
// Set low default password strength requirements so tests are not interfered with by user code
$validator
->setMinTestScore(0)
->setMinLength(6);
}
}
public static function getExtraDataObjects() public static function getExtraDataObjects()
{ {
return array_merge( return array_merge(