Skip to content

Commit 811841f

Browse files
authored
Update test-sample.php
1 parent aaf20da commit 811841f

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

tests/test-sample.php

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,38 @@
66
*/
77

88
/**
9-
* Sample test case.
9+
* @group post
10+
* @group navmenus
11+
* @group taxonomy
12+
* @group walker
13+
* https://develop.svn.wordpress.org/trunk/tests/phpunit/tests/walker.php
1014
*/
11-
class SampleTest extends WP_UnitTestCase {
12-
13-
/**
14-
* A single example test.
15-
*/
16-
function test_sample() {
17-
// Replace this with some actual testing code.
18-
$this->assertTrue( true );
15+
class WP_Test_Bootstrap_NavWalker extends WP_UnitTestCase {
16+
17+
function setUp() {
18+
$this->walker = new WP_Bootstrap_Navwalker();
19+
parent::setUp();
20+
}
21+
22+
function test_single_item() {
23+
$items = array( (object) array( 'id' => 1, 'parent' => 0 ) );
24+
$output = $this->walker->walk( $items, 0 );
25+
$this->assertEquals( 1, $this->walker->get_number_of_root_elements( $items ) );
26+
$this->assertEquals( '<li>1</li>', $output );
27+
}
28+
29+
function test_single_item_flat() {
30+
$items = array( (object) array( 'id' => 1, 'parent' => 0 ) );
31+
$output = $this->walker->walk( $items, -1 );
32+
$this->assertEquals( 1, $this->walker->get_number_of_root_elements( $items ) );
33+
$this->assertEquals( '<li>1</li>', $output );
34+
}
35+
36+
function test_single_item_depth_1() {
37+
$items = array( (object) array( 'id' => 1, 'parent' => 0 ) );
38+
$output = $this->walker->walk( $items, 1 );
39+
$this->assertEquals( 1, $this->walker->get_number_of_root_elements( $items ) );
40+
$this->assertEquals( '<li>1</li>', $output );
1941
}
42+
2043
}

0 commit comments

Comments
 (0)