File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * @group post
5+ * @group navmenus
6+ * @group taxonomy
7+ * @group walker
8+ * https://develop.svn.wordpress.org/trunk/tests/phpunit/tests/walker.php
9+ */
10+ class WP_Test_Bootstrap_NavWalker extends WP_UnitTestCase {
11+
12+ function setUp () {
13+
14+ $ this ->walker = new WP_Bootstrap_Navwalker ();
15+
16+ parent ::setUp ();
17+
18+ }
19+
20+ function test_single_item () {
21+
22+ $ items = array ( (object ) array ( 'id ' => 1 , 'parent ' => 0 ) );
23+ $ output = $ this ->walker ->walk ( $ items , 0 );
24+
25+ $ this ->assertEquals ( 1 , $ this ->walker ->get_number_of_root_elements ( $ items ) );
26+ $ this ->assertEquals ( '<li>1</li> ' , $ output );
27+
28+ }
29+
30+ function test_single_item_flat () {
31+
32+ $ items = array ( (object ) array ( 'id ' => 1 , 'parent ' => 0 ) );
33+ $ output = $ this ->walker ->walk ( $ items , -1 );
34+
35+ $ this ->assertEquals ( 1 , $ this ->walker ->get_number_of_root_elements ( $ items ) );
36+ $ this ->assertEquals ( '<li>1</li> ' , $ output );
37+
38+ }
39+
40+ function test_single_item_depth_1 () {
41+
42+ $ items = array ( (object ) array ( 'id ' => 1 , 'parent ' => 0 ) );
43+ $ output = $ this ->walker ->walk ( $ items , 1 );
44+
45+ $ this ->assertEquals ( 1 , $ this ->walker ->get_number_of_root_elements ( $ items ) );
46+ $ this ->assertEquals ( '<li>1</li> ' , $ output );
47+
48+ }
49+
50+ }
You can’t perform that action at this time.
0 commit comments