You appear to be a bot. Output may be restricted
Description
Usage
Tests_Admin_wpPostsListTable::wpSetUpBeforeClass( $factory );
Parameters
- $factory
- ( mixed ) required –
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/admin/wpPostsListTable.php
Lines:
1 to 54 of 54
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { // Note that our top/children/grandchildren arrays are 1-indexed. // Create top-level pages. $num_posts = 5; foreach ( range( 1, $num_posts ) as $i ) { $p = $factory->post->create_and_get( array( 'post_type' => 'page', 'post_title' => sprintf( 'Top Level Page %d', $i ), ) ); self::$top[ $i ] = $p; self::$post_ids[] = $p->ID; } // Create child pages. $num_children = 3; foreach ( self::$top as $top => $top_page ) { foreach ( range( 1, $num_children ) as $i ) { $p = $factory->post->create_and_get( array( 'post_type' => 'page', 'post_parent' => $top_page->ID, 'post_title' => sprintf( 'Child %d', $i ), ) ); self::$children[ $top ][ $i ] = $p; self::$post_ids[] = $p->ID; } } // Create grand-child pages for the third and fourth top-level pages. $num_grandchildren = 3; foreach ( range( 3, 4 ) as $top ) { foreach ( self::$children[ $top ] as $child => $child_page ) { foreach ( range( 1, $num_grandchildren ) as $i ) { $p = $factory->post->create_and_get( array( 'post_type' => 'page', 'post_parent' => $child_page->ID, 'post_title' => sprintf( 'Grandchild %d', $i ), ) ); self::$grandchildren[ $top ][ $child ][ $i ] = $p; self::$post_ids[] = $p->ID; } } } }