Completed
Push — fix/site-editor-menu ( 5f4451 )
by
unknown
282:19 queued 272:41
created

admin-menu.php ➔ gutenberg_is_fse_theme()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Fixture data for admin menu tests.
4
 *
5
 * @package automattic/jetpack
6
 */
7
8
/**
9
 * Menu fixture data.
10
 *
11
 * @return \string[][]
12
 */
13
function get_menu_fixture() {
14
	return array(
15
		2   => array(
16
			'Dashboard',
17
			'read',
18
			'index.php',
19
			'',
20
			'menu-top menu-top-first menu-icon-dashboard',
21
			'menu-dashboard',
22
			'dashicons-dashboard',
23
		),
24
		3   => array(
25
			'Jetpack',
26
			'jetpack_admin_page',
27
			'jetpack',
28
			'Jetpack',
29
			'menu-top toplevel_page_jetpack',
30
			'toplevel_page_jetpack',
31
			'div',
32
		),
33
		4   => array(
34
			'',
35
			'read',
36
			'separator1',
37
			'',
38
			'wp-menu-separator',
39
		),
40
		10  => array(
41
			'Media',
42
			'upload_files',
43
			'upload.php',
44
			'',
45
			'menu-top menu-icon-media',
46
			'menu-media',
47
			'dashicons-admin-media',
48
		),
49
		15  => array(
50
			'Links',
51
			'manage_links',
52
			'edit-tags.php?taxonomy=link_category',
53
			'',
54
			'menu-top menu-icon-links',
55
			'menu-links',
56
			'dashicons-admin-links',
57
		),
58
		25  => array(
59
			'Comments <span class="awaiting-mod count-3"><span class="pending-count" aria-hidden="true">3</span><span class="comments-in-moderation-text screen-reader-text">3 Comments in moderation</span></span>',
60
			'edit_posts',
61
			'edit-comments.php',
62
			'',
63
			'menu-top menu-icon-comments',
64
			'menu-comments',
65
			'dashicons-admin-comments',
66
		),
67
		5   => array(
68
			'Posts',
69
			'edit_posts',
70
			'edit.php',
71
			'',
72
			'menu-top menu-icon-post open-if-no-js',
73
			'menu-posts',
74
			'dashicons-admin-post',
75
		),
76
		20  => array(
77
			'Pages',
78
			'edit_pages',
79
			'edit.php?post_type=page',
80
			'',
81
			'menu-top menu-icon-page',
82
			'menu-pages',
83
			'dashicons-admin-page',
84
		),
85
		59  => array(
86
			'',
87
			'read',
88
			'separator2',
89
			'',
90
			'wp-menu-separator',
91
		),
92
		60  => array(
93
			'Appearance',
94
			'switch_themes',
95
			'themes.php',
96
			'',
97
			'menu-top menu-icon-appearance',
98
			'menu-appearance',
99
			'dashicons-admin-appearance',
100
		),
101
		65  => array(
102
			'Plugins <span class="update-plugins count-4"><span class="plugin-count">4</span></span>',
103
			'activate_plugins',
104
			'plugins.php',
105
			'',
106
			'menu-top menu-icon-plugins',
107
			'menu-plugins',
108
			'dashicons-admin-plugins',
109
		),
110
		70  => array(
111
			'Users <span class="update-plugins count-0"><span class="plugin-count">0</span></span>',
112
			'list_users',
113
			'users.php',
114
			'',
115
			'menu-top menu-icon-users',
116
			'menu-users',
117
			'dashicons-admin-users',
118
		),
119
		75  => array(
120
			'Tools',
121
			'edit_posts',
122
			'tools.php',
123
			'',
124
			'menu-top menu-icon-tools',
125
			'menu-tools',
126
			'dashicons-admin-tools',
127
		),
128
		80  => array(
129
			'Settings',
130
			'manage_options',
131
			'options-general.php',
132
			'',
133
			'menu-top menu-icon-settings',
134
			'menu-settings',
135
			'dashicons-admin-settings',
136
		),
137
		100 => array(
138
			'Site Editor <span class="awaiting-mod">beta</span>',
139
			'edit_theme_options',
140
			'gutenberg-edit-site',
141
			'Site Editor (beta)',
142
			'menu-top toplevel_page_gutenberg-edit-site',
143
			'toplevel_page_gutenberg-edit-site',
144
			'dashicons-layout',
145
		),
146
		101 => array(
147
			'Gutenberg',
148
			'edit_posts',
149
			'gutenberg',
150
			'Gutenberg',
151
			'menu-top toplevel_page_gutenberg',
152
			'toplevel_page_gutenberg',
153
			'dashicons-edit',
154
		),
155
	);
156
}
157
158
/**
159
 * Submenu fixture data.
160
 *
161
 * @return \string[][][]
162
 */
163
function get_submenu_fixture() {
164
	return array(
165
		'index.php'                            => array(
166
			0  => array(
167
				'Home',
168
				'read',
169
				'index.php',
170
			),
171
			10 => array(
172
				'Updates <span class="update-plugins count-4"><span class="update-count">4</span></span>',
173
				'update_core',
174
				'update-core.php',
175
			),
176
		),
177
		'upload.php'                           => array(
178
			5  => array(
179
				'Library',
180
				'upload_files',
181
				'upload.php',
182
			),
183
			10 => array(
184
				'Add New',
185
				'upload_files',
186
				'media-new.php',
187
			),
188
		),
189
		'edit-comments.php'                    => array(
190
			0 => array(
191
				'All Comments',
192
				'edit_posts',
193
				'edit-comments.php',
194
			),
195
		),
196
		'edit.php'                             => array(
197
			5  => array(
198
				'All Posts',
199
				'edit_posts',
200
				'edit.php',
201
			),
202
			10 => array(
203
				'Add New',
204
				'edit_posts',
205
				'post-new.php',
206
			),
207
			15 => array(
208
				'Categories',
209
				'manage_categories',
210
				'edit-tags.php?taxonomy=category',
211
			),
212
			16 => array(
213
				'Tags',
214
				'manage_post_tags',
215
				'edit-tags.php?taxonomy=post_tag',
216
			),
217
		),
218
		'edit.php?post_type=page'              => array(
219
			5  => array(
220
				'All Pages',
221
				'edit_pages',
222
				'edit.php?post_type=page',
223
			),
224
			10 => array(
225
				'Add New',
226
				'edit_pages',
227
				'post-new.php?post_type=page',
228
			),
229
		),
230
		'themes.php'                           => array(
231
			5  => array(
232
				'Themes',
233
				'switch_themes',
234
				'themes.php',
235
			),
236
			6  => array(
237
				'Customize',
238
				'customize',
239
				'customize.php?return=%2Ftrunk%2Fwp-admin%2Fadmin.php%3Fpage%3Djetpack',
240
				'',
241
				'hide-if-no-customize',
242
			),
243
			10 => array(
244
				'Menus',
245
				'edit_theme_options',
246
				'nav-menus.php',
247
			),
248
			11 => array(
249
				'Widgets',
250
				'edit_theme_options',
251
				'gutenberg-widgets',
252
				'Widgets',
253
			),
254
			13 => array(
255
				'Theme Editor',
256
				'edit_themes',
257
				'theme-editor.php',
258
				'Theme Editor',
259
			),
260
		),
261
		'plugins.php'                          => array(
262
			5  => array(
263
				'Installed Plugins',
264
				'activate_plugins',
265
				'plugins.php',
266
			),
267
			10 => array(
268
				'Add New',
269
				'install_plugins',
270
				'plugin-install.php',
271
			),
272
			15 => array(
273
				'Plugin Editor',
274
				'edit_plugins',
275
				'plugin-editor.php',
276
			),
277
		),
278
		'users.php'                            => array(
279
			5  => array(
280
				'All Users',
281
				'list_users',
282
				'users.php',
283
			),
284
			10 => array(
285
				'Add New',
286
				'create_users',
287
				'user-new.php',
288
			),
289
			15 => array(
290
				'Profile',
291
				'read',
292
				'profile.php',
293
			),
294
		),
295
		'tools.php'                            => array(
296
			5  => array(
297
				'Available Tools',
298
				'edit_posts',
299
				'tools.php',
300
			),
301
			10 => array(
302
				'Import',
303
				'import',
304
				'import.php',
305
			),
306
			15 => array(
307
				'Export',
308
				'export',
309
				'export.php',
310
			),
311
			20 => array(
312
				'Site Health',
313
				'view_site_health_checks',
314
				'site-health.php',
315
			),
316
			25 => array(
317
				'Export Personal Data',
318
				'export_others_personal_data',
319
				'export-personal-data.php',
320
			),
321
			30 => array(
322
				'Erase Personal Data',
323
				'erase_others_personal_data',
324
				'erase-personal-data.php',
325
			),
326
		),
327
		'options-general.php'                  => array(
328
			10 => array(
329
				'General',
330
				'manage_options',
331
				'options-general.php',
332
			),
333
			15 => array(
334
				'Writing',
335
				'manage_options',
336
				'options-writing.php',
337
			),
338
			20 => array(
339
				'Reading',
340
				'manage_options',
341
				'options-reading.php',
342
			),
343
			25 => array(
344
				'Discussion',
345
				'manage_options',
346
				'options-discussion.php',
347
			),
348
			30 => array(
349
				'Media',
350
				'manage_options',
351
				'options-media.php',
352
			),
353
			40 => array(
354
				'Permalinks',
355
				'manage_options',
356
				'options-permalink.php',
357
			),
358
			45 => array(
359
				'Privacy',
360
				'manage_privacy_options',
361
				'options-privacy.php',
362
			),
363
			46 => array(
364
				'Approve User',
365
				'promote_users',
366
				'wp-approve-user',
367
				'Approve User',
368
			),
369
			47 => array(
370
				'',
371
				'manage_options',
372
				'sharing',
373
				'',
374
			),
375
		),
376
		'edit-tags.php?taxonomy=link_category' => array(
377
			15 => array(
378
				'Link Categories',
379
				'manage_categories',
380
				'edit-tags.php?taxonomy=link_category',
381
			),
382
		),
383
384
		''                                     => array(
385
			0 => array(
386
				'',
387
				'manage_options',
388
				'jetpack-debugger',
389
				'Debugging Center',
390
			),
391
			1 => array(
392
				'Settings',
393
				'jetpack_manage_modules',
394
				'jetpack_modules',
395
				'Jetpack Settings',
396
			),
397
			2 => array(
398
				'',
399
				'jetpack_admin_page',
400
				'jetpack_about',
401
				'About Jetpack',
402
			),
403
		),
404
		'edit.php?post_type=feedback'          => array(
405
			0 => array(
406
				'Feedback',
407
				'edit_pages',
408
				'edit.php?post_type=feedback',
409
				'',
410
			),
411
			1 => array(
412
				'Export CSV',
413
				'export',
414
				'feedback-export',
415
				'Export feedback as CSV',
416
			),
417
		),
418
		'jetpack'                              => array(
419
			1 => array(
420
				'Dashboard',
421
				'jetpack_admin_page',
422
				'jetpack#/dashboard',
423
				'Dashboard',
424
			),
425
			2 => array(
426
				'Settings',
427
				'jetpack_admin_page',
428
				'jetpack#/settings',
429
				'Settings',
430
			),
431
		),
432
	);
433
}
434
435
/**
436
 * Mock for testing
437
 */
438
function gutenberg_is_fse_theme() {
439
	return true;
440
}
441