Révision 8be7bf84
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/views/tests/user/views_handler_field_user_name.test | ||
---|---|---|
51 | 51 |
$this->assertIdentical($render, $anon_name, 'For user0 it should use the configured anonymous text if overwrite_anonymous is checked.'); |
52 | 52 |
|
53 | 53 |
} |
54 |
|
|
55 |
/** |
|
56 |
* Tests that deselecting 'link_to_user' and 'format_username' works. |
|
57 |
*/ |
|
58 |
public function testOptions() { |
|
59 |
$view = $this->view_raw_user_name(); |
|
60 |
$view->init_display(); |
|
61 |
$this->executeView($view); |
|
62 |
|
|
63 |
$view->row_index = 0; |
|
64 |
|
|
65 |
$username = $view->result[0]->users_name = 'test'; |
|
66 |
$view->result[0]->uid = 1; |
|
67 |
$render = $view->field['name']->advanced_render($view->result[0]); |
|
68 |
$this->assertTrue(strpos($render, $username) !== FALSE, 'If link to user is checked the username should be part of the output.'); |
|
69 |
} |
|
70 |
|
|
54 | 71 |
function view_user_name() { |
55 | 72 |
$view = new view(); |
56 | 73 |
$view->name = 'test_views_handler_field_user_name'; |
... | ... | |
93 | 110 |
return $view; |
94 | 111 |
} |
95 | 112 |
|
113 |
function view_raw_user_name() { |
|
114 |
$view = new view; |
|
115 |
$view->name = 'test_views_handler_field_user_name'; |
|
116 |
$view->description = ''; |
|
117 |
$view->tag = 'default'; |
|
118 |
$view->base_table = 'users'; |
|
119 |
$view->human_name = 'test_views_handler_field_user_name'; |
|
120 |
$view->core = 7; |
|
121 |
$view->api_version = '3.0'; |
|
122 |
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
|
123 |
|
|
124 |
/* Display: Master */ |
|
125 |
$handler = $view->new_display('default', 'Master', 'default'); |
|
126 |
$handler->display->display_options['access']['type'] = 'none'; |
|
127 |
$handler->display->display_options['cache']['type'] = 'none'; |
|
128 |
$handler->display->display_options['query']['type'] = 'views_query'; |
|
129 |
$handler->display->display_options['query']['options']['query_comment'] = FALSE; |
|
130 |
$handler->display->display_options['exposed_form']['type'] = 'basic'; |
|
131 |
$handler->display->display_options['pager']['type'] = 'full'; |
|
132 |
$handler->display->display_options['style_plugin'] = 'default'; |
|
133 |
$handler->display->display_options['row_plugin'] = 'fields'; |
|
134 |
/* Field: User: Name */ |
|
135 |
$handler->display->display_options['fields']['name']['id'] = 'name'; |
|
136 |
$handler->display->display_options['fields']['name']['table'] = 'users'; |
|
137 |
$handler->display->display_options['fields']['name']['field'] = 'name'; |
|
138 |
$handler->display->display_options['fields']['name']['label'] = ''; |
|
139 |
$handler->display->display_options['fields']['name']['alter']['alter_text'] = 0; |
|
140 |
$handler->display->display_options['fields']['name']['alter']['make_link'] = 0; |
|
141 |
$handler->display->display_options['fields']['name']['alter']['absolute'] = 0; |
|
142 |
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = 0; |
|
143 |
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = 0; |
|
144 |
$handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0; |
|
145 |
$handler->display->display_options['fields']['name']['alter']['trim'] = 0; |
|
146 |
$handler->display->display_options['fields']['name']['alter']['html'] = 0; |
|
147 |
$handler->display->display_options['fields']['name']['hide_empty'] = 0; |
|
148 |
$handler->display->display_options['fields']['name']['empty_zero'] = 0; |
|
149 |
$handler->display->display_options['fields']['name']['link_to_user'] = 0; |
|
150 |
$handler->display->display_options['fields']['name']['format_username'] = 0; |
|
151 |
$handler->display->display_options['fields']['name']['overwrite_anonymous'] = 0; |
|
152 |
|
|
153 |
return $view; |
|
154 |
} |
|
96 | 155 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules