forked from WordPress/wordpress-develop
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
walker-nav-menu-edit.php
60 lines (46 loc) · 1.43 KB
/
walker-nav-menu-edit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* @group menu
* @group walker
*/
class Tests_Menu_Walker_Nav_Menu_Edit extends WP_UnitTestCase {
protected $_wp_nav_menu_max_depth;
function setUp(): void {
global $_wp_nav_menu_max_depth;
parent::setUp();
/** Walker_Nav_Menu_Edit class */
require_once ABSPATH . 'wp-admin/includes/class-walker-nav-menu-edit.php';
$this->walker = new Walker_Nav_Menu_Edit();
$this->_wp_nav_menu_max_depth = $_wp_nav_menu_max_depth;
}
function tearDown(): void {
global $_wp_nav_menu_max_depth;
$_wp_nav_menu_max_depth = $this->_wp_nav_menu_max_depth;
parent::tearDown();
}
/**
* @ticket 36729
*/
function test_original_title_prefix_should_not_be_shown_if_empty() {
$expected = '';
$post_id = $this->factory->post->create();
$item = array(
'classes' => array(),
'description' => '',
'ID' => $post_id,
'menu_item_parent' => 0,
'menu_order' => 0,
'object_id' => $post_id,
'object' => 'post',
'post_excerpt' => get_the_excerpt( $post_id ),
'title' => get_the_title( $post_id ),
'type' => 'foobar',
'type_label' => 'Foo Bar',
'target' => '_blank',
'url' => '',
'xfn' => '',
);
$this->walker->start_el( $expected, (object) $item );
$this->assertDoesNotMatchRegularExpression( '#<p class="link-to-original">\s*Original: <a href=""></a>#', $expected );
}
}