function ActivityAPITest::testGetActivity2 in Activity 6
Same name and namespace in other branches
- 5.4 tests/ActivityAPITests.test \ActivityAPITest::testGetActivity2()
- 5.3 tests/ActivityAPITests.test \ActivityAPITest::testGetActivity2()
File
- tests/
ActivityAPITests.test, line 119
Class
Code
function testGetActivity2() {
// Test the filter process
// Invent some more modules
$modules = array(
'huba',
'foobar',
'barbaz',
);
$types = array(
'test1',
'test2',
'test3',
);
$operations = array(
'insert',
'delete',
'update',
'view',
);
$roles = array(
'Author',
'Editor',
'Viewer',
);
$data = array(
'dummydata' => 'foobar',
);
// Make another new user to test with
$users[] = $this
->drupalCreateUserRolePerm();
$users[] = $this
->drupalCreateUserRolePerm();
$users[] = $this
->drupalCreateUserRolePerm();
$users[] = $this
->drupalCreateUserRolePerm();
$users[] = $this
->drupalCreateUserRolePerm();
// Create a LOT of new activity
// activity_insert($module, $type, $operation, $data, $target_users_roles);
$count = 0;
for ($a = 0; $a < 3; $a++) {
$module = $modules[$a];
for ($b = 0; $b < 3; $b++) {
$type = $types[$b];
for ($c = 0; $c < 4; $c++) {
$operation = $operations[$c];
for ($d = 0; $d < 5; $d++) {
$user = $users[$d];
for ($e = 0; $e < 3; $e++) {
$role = $roles[$e];
$target_users_roles = array(
ACTIVITY_ALL => 'All',
$user->uid => $role,
);
$count++;
activity_insert($module, $type, $operation, $data, $target_users_roles);
}
}
}
}
}
$activity = activity_get_activity(ACTIVITY_ALL);
$this
->assertEqual($count, count($activity), '%s ' . t("Expecting {$count} activities."));
$activity = activity_get_activity(array(
ACTIVITY_ALL,
));
$this
->assertEqual($count, count($activity), '%s ' . t("Expecting {$count} activities."));
// $activity = activity_get_activity('*', array('huba', 'foobar'));
// $this->assertEqual(100, count($activity), '%s '. t('Expecting 100 huba and foobar activities.'));
// $activity = activity_get_activity('*', array('huba', 'foobar'), 17);
// $this->assertEqual(17, count($activity), '%s '. t('Expecting 17 huba and foobar activities on one page.'));
// $activity = activity_get_activity(1, array('huba', 'foobar'));
// $this->assertEqual(0, count($activity), '%s '. t('Expecting 0 huba and foobar activities created by user #1.'));
}