NEW Fixture context step to change page_length value in ModelAdmin

This commit is contained in:
Sabina Talipova 2022-08-05 12:41:24 +12:00
parent c012736293
commit 6fdf78391a
1 changed files with 25 additions and 0 deletions

View File

@ -973,4 +973,29 @@ YAML;
{
$this->clearConfigFiles();
}
/**
* Example: Given the maximum 5 items per page
*
* @Given /^the maximum "([^"]+)" items per page$/
* @param string $items Max items per page
*/
public function stepCreateMaximumItemsPerPageStep($items): void
{
$config = <<<YAML
---
name: default-items-per-page
---
SilverStripe\Admin\ModelAdmin:
page_length: $items
YAML;
$file = 'default-items-per-page.yml';
$path = $this->getDestinationConfigFolder($file);
file_put_contents($path, $config);
$this->activatedConfigFiles[] = $path;
$this->getMainContext()->visit('dev/build?flush');
}
}