public function ViewsAtomTestCase::vaRandomNodeTypes in Views Atom 6
Gathers a random number of node types of the given publish status
Return value
array of machine names
File
- tests/
views_atom.test, line 107 - Simple tests for views_atom
Class
- ViewsAtomTestCase
- Tests basic set up for publishing and consuming
Code
public function vaRandomNodeTypes() {
$node_types = node_get_types('names');
$node_types = array_keys($node_types);
$count = count($node_types) - 1;
$random_keys = array_rand($node_types, rand(1, $count));
$random_node_types = array();
if (is_array($random_keys)) {
foreach ($random_keys as $key) {
$random_node_types[] = $node_types[$key];
}
}
else {
$random_node_types[] = $node_types[$random_keys];
}
return $random_node_types;
}