function _coder_6x_more_tests in Coder 5
Same name and namespace in other branches
- 5.2 tests/coder_6x.inc \_coder_6x_more_tests()
File
- tests/
coder_6x.inc, line 9
Code
function _coder_6x_more_tests() {
if (taxonomy_node_get_terms($nid)) {
// should generate an error
}
if (taxonomy_node_get_terms($node->nid)) {
// should generate an error
}
if (taxonomy_node_get_terms($node)) {
// not an error
}
$output = strtr(format_plural($num, 'There is currently 1 %type post on your site.', 'There are currently @count %type posts on your site.'), array(
'%type' => theme('placeholder', $type),
));
// a valid error
$output = notstrtr(format_plural($num, 'There is currently 1 %type post on your site.', 'There are currently @count %type posts on your site.'), array(
'%type' => theme('placeholder', $type),
));
// not an error
watchdog('user', t('Removed %username user.', array(
'%username' => $user->name,
)));
// an error
watchdog('user', 'Removed %username user.', array(
'%username' => $user->name,
));
// not an error
$complex = unserialize(cache_get('complex_cid'));
// an error
cache_set('simple_cid', 'cache', $simple);
// an error
$ip = $_SERVER['REMOTE_ADDR'];
// an error
if ($file = file_check_upload('picture_upload')) {
// an error
$file = file_save_upload('picture_upload', $destination, FILE_EXISTS_REPLACE);
// an error
}
if ($file = file_save_upload('picture_upload', $validators)) {
// ok
}
$sql = 'UPDATE {file_revisions} SET vid=1';
// an error
if (db_query('SELECT * FROM {file_revisions}')) {
// an error
}
// add FAPI tests
$form = array(
'#base' => 'my_shared_form_id',
// error
'#pre_render' => '<div>',
);
$form['#base'] = 'http://example.com';
$form['#submit']['my_submit_function'] = array(
$param1,
$param2,
);
// error
$form['#submit']['my_validate_function'] = array();
// error
$form['#multistep'] = TRUE;
form_set_value($element, 'value', $form_status);
// This one is okay
form_set_value($element, 'value');
// error
confirm_form($form, t('Do you really want to delete this?'), "node/{$nid}", t("Don't do it unless you're really sure!"), t('Delete it'), t('Go back'), 'delete');
// should fail
confirm_form($form, t('Do you really want to delete this?'), "node/{$nid}", $options);
// is ok
confirm_form($form, t('Do you really want to delete this?'), "node/{$nid}", array());
// also ok
custom_url_rewrite($url);
// not ok
custom_url_rewrite_inbound($url);
// ok
}