Skip to content

Commit 701e11f

Browse files
authored
Create class.test-walker.php
1 parent eea7ae5 commit 701e11f

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

tests/class.test-walker.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
}

0 commit comments

Comments
 (0)