mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
Add counts to file task, update readme
This commit is contained in:
parent
e0d4faec11
commit
f932f5e110
15
README.md
15
README.md
@ -29,6 +29,21 @@ If you want to test the CMS behaviour for a large and nested tree,
|
|||||||
the module includes a simple generator task: `dev/tasks/FTPageMakerTask`.
|
the module includes a simple generator task: `dev/tasks/FTPageMakerTask`.
|
||||||
It will create 3^5 pages by default, so takes a while to run through.
|
It will create 3^5 pages by default, so takes a while to run through.
|
||||||
|
|
||||||
|
## Configuring the amount of data
|
||||||
|
|
||||||
|
Both `FTPageMagerTask` and `FTFileMakerTask` allow the amount of generated content to be configured.
|
||||||
|
To do this, pass a comma-seprarated list of integers representing the amount of records to create at each
|
||||||
|
depth.
|
||||||
|
|
||||||
|
`$ vendor/bin/sake dev/tasks/FTPageMakerTask pageCounts=10,200,5,5`
|
||||||
|
|
||||||
|
`$ vendor/bin/sake dev/tasks/FTFileMakerTask fileCounts=5,300,55,5 folderCounts=1,5,5,5`
|
||||||
|
|
||||||
|
## Guaranteed unique images
|
||||||
|
|
||||||
|
The `FTFileMakerTask` will randomly watermark each reference to your images by default. If you want to disable this,
|
||||||
|
set the `uniqueImages` config variable to `false`.
|
||||||
|
|
||||||
## Blocks
|
## Blocks
|
||||||
|
|
||||||
When [dnadesign/silverstripe-elemental](https://github.com/dnadesign/silverstripe-elemental)
|
When [dnadesign/silverstripe-elemental](https://github.com/dnadesign/silverstripe-elemental)
|
||||||
|
@ -185,6 +185,18 @@ class FTFileMakerTask extends BuildTask
|
|||||||
/** @var Member */
|
/** @var Member */
|
||||||
protected $anonymousMember = null;
|
protected $anonymousMember = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow override of the fileCountByDepth
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fileCounts = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow override of the folderCountByDepth
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $folderCounts = [];
|
||||||
|
|
||||||
public function run($request)
|
public function run($request)
|
||||||
{
|
{
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
@ -209,6 +221,26 @@ class FTFileMakerTask extends BuildTask
|
|||||||
$this->reset();
|
$this->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$fileCounts = $request->getVar('fileCounts');
|
||||||
|
if ($fileCounts) {
|
||||||
|
$counts = explode(',', $fileCounts);
|
||||||
|
$this->fileCounts = array_map(function ($int) {
|
||||||
|
return (int) trim($int);
|
||||||
|
}, $counts);
|
||||||
|
} else {
|
||||||
|
$this->fileCounts = self::config()->get('fileCountByDepth');
|
||||||
|
}
|
||||||
|
|
||||||
|
$folderCounts = $request->getVar('folderCounts');
|
||||||
|
if ($folderCounts) {
|
||||||
|
$counts = explode(',', $folderCounts);
|
||||||
|
$this->folderCounts = array_map(function ($int) {
|
||||||
|
return (int) trim($int);
|
||||||
|
}, $counts);
|
||||||
|
} else {
|
||||||
|
$this->folderCounts = self::config()->get('folderCountByDepth');
|
||||||
|
}
|
||||||
|
|
||||||
echo "Downloading fixtures" . $this->lineBreak;
|
echo "Downloading fixtures" . $this->lineBreak;
|
||||||
$fixtureFilePaths = $this->downloadFixtureFiles();
|
$fixtureFilePaths = $this->downloadFixtureFiles();
|
||||||
|
|
||||||
@ -302,8 +334,8 @@ class FTFileMakerTask extends BuildTask
|
|||||||
protected function generateFiles($fixtureFilePaths, $depth = 0, $prefix = "0", $parentID = 0)
|
protected function generateFiles($fixtureFilePaths, $depth = 0, $prefix = "0", $parentID = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$folderCount = self::config()->get('folderCountByDepth')[$depth];
|
$folderCount = $this->folderCounts[$depth];
|
||||||
$fileCount = self::config()->get('fileCountByDepth')[$depth];
|
$fileCount = $this->fileCounts[$depth];
|
||||||
|
|
||||||
$doSetFolderPermissions = (bool) self::config()->get('doSetFolderPermissions');
|
$doSetFolderPermissions = (bool) self::config()->get('doSetFolderPermissions');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user