MNT Fix some unit tests (#415)

This commit is contained in:
Guy Sartorelli 2024-08-28 10:54:54 +12:00 committed by GitHub
parent c3ddeb3ad2
commit 4bbfa9d298
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 9 deletions

View File

@ -5,8 +5,6 @@ namespace Symbiote\GridFieldExtensions\Tests;
use Symbiote\GridFieldExtensions\Tests\Stub\TestController; use Symbiote\GridFieldExtensions\Tests\Stub\TestController;
use Symbiote\GridFieldExtensions\Tests\Stub\StubUnorderable; use Symbiote\GridFieldExtensions\Tests\Stub\StubUnorderable;
use Symbiote\GridFieldExtensions\GridFieldEditableColumns; use Symbiote\GridFieldExtensions\GridFieldEditableColumns;
use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\Form; use SilverStripe\Forms\Form;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
@ -47,10 +45,9 @@ class GridFieldEditableColumnsTest extends SapphireTest
$record->setCanEdit(true); $record->setCanEdit(true);
$column = $component->getColumnContent($grid, $record, 'Title'); $column = $component->getColumnContent($grid, $record, 'Title');
$this->assertInstanceOf(DBHTMLText::class, $column);
$this->assertMatchesRegularExpression( $this->assertMatchesRegularExpression(
'/<input type="text" name="TestGridField\[GridFieldEditableColumns\]\[100\]\[Title\]" value="foo"[^>]*>/', '/<input type="text" name="TestGridField\[GridFieldEditableColumns\]\[100\]\[Title\]" value="foo"[^>]*>/',
$column->getValue() $column
); );
} }
@ -63,10 +60,9 @@ class GridFieldEditableColumnsTest extends SapphireTest
$record->setCanEdit(false); $record->setCanEdit(false);
$column = $component->getColumnContent($grid, $record, 'Title'); $column = $component->getColumnContent($grid, $record, 'Title');
$this->assertInstanceOf(DBHTMLText::class, $column);
$this->assertMatchesRegularExpression( $this->assertMatchesRegularExpression(
'/<span[^>]*>\s*testval\s*<\/span>/', '/<span[^>]*>\s*testval\s*<\/span>/',
$column->getValue() $column
); );
} }
@ -85,10 +81,9 @@ class GridFieldEditableColumnsTest extends SapphireTest
$column = $component->getColumnContent($grid, $record, 'Title'); $column = $component->getColumnContent($grid, $record, 'Title');
$this->assertInstanceOf(DBHTMLText::class, $column);
$this->assertMatchesRegularExpression( $this->assertMatchesRegularExpression(
'/<span[^>]*>\s*testval\s*<\/span>/', '/<span[^>]*>\s*testval\s*<\/span>/',
$column->getValue() $column
); );
} }
} }

View File

@ -33,7 +33,7 @@ class OrderableRowsThroughVersionedTest extends SapphireTest
protected function setUp(): void protected function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->orignalReadingMode = Versioned::get_reading_mode(); $this->originalReadingMode = Versioned::get_reading_mode();
} }
protected function tearDown(): void protected function tearDown(): void