mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
Merge pull request #327 from creative-commoners/pulls/3/sapphire-test-nine
API phpunit 9 support
This commit is contained in:
commit
baa6a8d147
@ -19,11 +19,12 @@
|
|||||||
"issues": "http://github.com/symbiote/silverstripe-gridfieldextensions/issues"
|
"issues": "http://github.com/symbiote/silverstripe-gridfieldextensions/issues"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
"php": "^7.3 || ^8.0",
|
||||||
"silverstripe/vendor-plugin": "^1.0",
|
"silverstripe/vendor-plugin": "^1.0",
|
||||||
"silverstripe/framework": "~4.0"
|
"silverstripe/framework": "^4.10"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"sminnee/phpunit": "^5.7",
|
"phpunit/phpunit": "^9.5",
|
||||||
"squizlabs/php_codesniffer": "^3.0",
|
"squizlabs/php_codesniffer": "^3.0",
|
||||||
"silverstripe/versioned": "^1"
|
"silverstripe/versioned": "^1"
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,7 @@ class GridFieldConfigurablePaginatorTest extends SapphireTest
|
|||||||
*/
|
*/
|
||||||
protected $gridField;
|
protected $gridField;
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -172,12 +172,10 @@ class GridFieldConfigurablePaginatorTest extends SapphireTest
|
|||||||
), $paginator->getPageSizesAsList());
|
), $paginator->getPageSizesAsList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException Exception
|
|
||||||
* @expectedExceptionMessage No GridField available yet for this request!
|
|
||||||
*/
|
|
||||||
public function testGetGridFieldThrowsExceptionWhenNotSet()
|
public function testGetGridFieldThrowsExceptionWhenNotSet()
|
||||||
{
|
{
|
||||||
|
$this->expectException(\Exception::class);
|
||||||
|
$this->expectExceptionMessage('No GridField available yet for this request!');
|
||||||
$paginator = new GridFieldConfigurablePaginator;
|
$paginator = new GridFieldConfigurablePaginator;
|
||||||
$paginator->getGridField();
|
$paginator->getGridField();
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ class GridFieldEditableColumnsTest extends SapphireTest
|
|||||||
$column = $component->getColumnContent($grid, $record, 'Title');
|
$column = $component->getColumnContent($grid, $record, 'Title');
|
||||||
|
|
||||||
$this->assertInstanceOf(DBHTMLText::class, $column);
|
$this->assertInstanceOf(DBHTMLText::class, $column);
|
||||||
$this->assertRegExp(
|
$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->getValue()
|
||||||
);
|
);
|
||||||
@ -64,7 +64,7 @@ class GridFieldEditableColumnsTest extends SapphireTest
|
|||||||
$column = $component->getColumnContent($grid, $record, 'Title');
|
$column = $component->getColumnContent($grid, $record, 'Title');
|
||||||
|
|
||||||
$this->assertInstanceOf(DBHTMLText::class, $column);
|
$this->assertInstanceOf(DBHTMLText::class, $column);
|
||||||
$this->assertRegExp(
|
$this->assertMatchesRegularExpression(
|
||||||
'/<span[^>]*>\s*testval\s*<\/span>/',
|
'/<span[^>]*>\s*testval\s*<\/span>/',
|
||||||
$column->getValue()
|
$column->getValue()
|
||||||
);
|
);
|
||||||
@ -86,7 +86,7 @@ class GridFieldEditableColumnsTest extends SapphireTest
|
|||||||
$column = $component->getColumnContent($grid, $record, 'Title');
|
$column = $component->getColumnContent($grid, $record, 'Title');
|
||||||
|
|
||||||
$this->assertInstanceOf(DBHTMLText::class, $column);
|
$this->assertInstanceOf(DBHTMLText::class, $column);
|
||||||
$this->assertRegExp(
|
$this->assertMatchesRegularExpression(
|
||||||
'/<span[^>]*>\s*testval\s*<\/span>/',
|
'/<span[^>]*>\s*testval\s*<\/span>/',
|
||||||
$column->getValue()
|
$column->getValue()
|
||||||
);
|
);
|
||||||
|
@ -118,12 +118,12 @@ class GridFieldOrderableRowsTest extends SapphireTest
|
|||||||
|
|
||||||
$result = $orderable->getColumnContent($grid, $record, 'irrelevant');
|
$result = $orderable->getColumnContent($grid, $record, 'irrelevant');
|
||||||
|
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'Belongings[GridFieldEditableColumns][' . $record->ID . '][Sort]',
|
'Belongings[GridFieldEditableColumns][' . $record->ID . '][Sort]',
|
||||||
$result,
|
$result,
|
||||||
'The field name is indexed under the record\'s ID'
|
'The field name is indexed under the record\'s ID'
|
||||||
);
|
);
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'value="' . $intermediary->Sort . '"',
|
'value="' . $intermediary->Sort . '"',
|
||||||
$result,
|
$result,
|
||||||
'The value comes from the MMTL intermediary Sort value'
|
'The value comes from the MMTL intermediary Sort value'
|
||||||
@ -152,12 +152,12 @@ class GridFieldOrderableRowsTest extends SapphireTest
|
|||||||
|
|
||||||
$result = $orderable->getColumnContent($grid, $record, 'irrelevant');
|
$result = $orderable->getColumnContent($grid, $record, 'irrelevant');
|
||||||
|
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'Children[GridFieldEditableColumns][' . $record->ID . '][Sort]',
|
'Children[GridFieldEditableColumns][' . $record->ID . '][Sort]',
|
||||||
$result,
|
$result,
|
||||||
'The field name is indexed under the record\'s ID'
|
'The field name is indexed under the record\'s ID'
|
||||||
);
|
);
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'value="' . $intermediary->Sort . '"',
|
'value="' . $intermediary->Sort . '"',
|
||||||
$result,
|
$result,
|
||||||
'The value comes from the MMTL intermediary Sort value'
|
'The value comes from the MMTL intermediary Sort value'
|
||||||
|
@ -30,13 +30,13 @@ class OrderableRowsThroughVersionedTest extends SapphireTest
|
|||||||
|
|
||||||
protected $originalReadingMode;
|
protected $originalReadingMode;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->orignalReadingMode = Versioned::get_reading_mode();
|
$this->orignalReadingMode = Versioned::get_reading_mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
Versioned::set_reading_mode($this->originalReadingMode);
|
Versioned::set_reading_mode($this->originalReadingMode);
|
||||||
unset($this->originalReadingMode);
|
unset($this->originalReadingMode);
|
||||||
|
Loading…
Reference in New Issue
Block a user