When generating 50 or more content nodes (and thus running in batch mode) the nodes types selected in the form are ignored and all node types are used. This does not happen when generating 49 or fewer, and only the selected node types are used.
For under 50 nodes the function generateContent has the following:
/**
* Method responsible for creating content when
* the number of elements is less than 50.
*/
private function generateContent($values) {
$values['node_types'] = array_filter($values['node_types']);
...
However, in the equivalent batch function generateBatchContent there is no array_filter call.
/**
* Method responsible for creating content when
* the number of elements is greater than 50.
*/
private function generateBatchContent($values) {
It is easy to replicate: Use a site with two or more content types defined. Delete all content, then on the generate form select only 1 content type but generate 100 nodes. View the full contents list and you'll see some of each node type.
I can provide a patch for the missing array_filter. But maybe this needs test coverage too?
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 3081503-7.batch_filter_node_types.patch | 2.03 KB | jonathan1055 |
Comments
Comment #2
jonathan1055 commentedThe new test (which I have written) will require the fix in #3076613: Undefined index: users in $result array to be committed first. Currently it is not possible to run any tests which create 50+ nodes via the batch system.
Comment #3
jonathan1055 commentedHere's the fix to generateBatchContent() for those who want to do manual testing.
Comment #4
moshe weitzman commentedLooks good. Shall I wait for that test or commit as is?
Comment #5
jonathan1055 commentedHere's the addtional part of the batch test, without the code fix, so this should fail.
Comment #7
jonathan1055 commentedThe test failed as required:
This patch #7 has the fix from #3 plus the test from #5 which should be green.
Comment #9
moshe weitzman commented