Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT Fix some unit tests #415

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions tests/GridFieldEditableColumnsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
use Symbiote\GridFieldExtensions\Tests\Stub\TestController;
use Symbiote\GridFieldExtensions\Tests\Stub\StubUnorderable;
use Symbiote\GridFieldExtensions\GridFieldEditableColumns;
use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\Forms\TextField;
Comment on lines -8 to -9
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither of these are used

use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\Form;
use SilverStripe\Forms\FieldList;
Expand Down Expand Up @@ -47,10 +45,9 @@ public function testProvidesEditableFieldsInColumns()
$record->setCanEdit(true);
$column = $component->getColumnContent($grid, $record, 'Title');

$this->assertInstanceOf(DBHTMLText::class, $column);
$this->assertMatchesRegularExpression(
'/<input type="text" name="TestGridField\[GridFieldEditableColumns\]\[100\]\[Title\]" value="foo"[^>]*>/',
$column->getValue()
$column
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value for the column comes from forTemplate() which is now typed as string.

);
}

Expand All @@ -63,10 +60,9 @@ public function testProvidesReadonlyColumnsForNoneditableRecords()
$record->setCanEdit(false);
$column = $component->getColumnContent($grid, $record, 'Title');

$this->assertInstanceOf(DBHTMLText::class, $column);
$this->assertMatchesRegularExpression(
'/<span[^>]*>\s*testval\s*<\/span>/',
$column->getValue()
$column
);
}

Expand All @@ -85,10 +81,9 @@ public function testProvidesReadonlyColumnsForReadonlyGrids()

$column = $component->getColumnContent($grid, $record, 'Title');

$this->assertInstanceOf(DBHTMLText::class, $column);
$this->assertMatchesRegularExpression(
'/<span[^>]*>\s*testval\s*<\/span>/',
$column->getValue()
$column
);
}
}
2 changes: 1 addition & 1 deletion tests/OrderableRowsThroughVersionedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class OrderableRowsThroughVersionedTest extends SapphireTest
protected function setUp(): void
{
parent::setUp();
$this->orignalReadingMode = Versioned::get_reading_mode();
$this->originalReadingMode = Versioned::get_reading_mode();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See line 31 above - this was a typo which resulted in a PHP deprecation warning in CI. Super minor, doesn't really matter until they actually remove the ability to have dynamic properties and it's only a unit test so I don't think it's worth backporting.

}

protected function tearDown(): void
Expand Down
Loading