コード例 #1
0
ファイル: rss2.php プロジェクト: pbearne/contrib2core
 /**
  * Setup a new user and attribute some posts.
  */
 public static function wpSetUpBeforeClass($factory)
 {
     // Create a user
     self::$user_id = $factory->user->create(array('role' => 'author', 'user_login' => 'test_author', 'display_name' => 'Test A. Uthor'));
     // Create a taxonomy
     self::$category = self::factory()->category->create_and_get(array('name' => 'Test Category', 'slug' => 'test-cat'));
     // Create a few posts
     self::$posts = $factory->post->create_many(42, array('post_author' => self::$user_id, 'post_content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec velit massa, ultrices eu est suscipit, mattis posuere est. Donec vitae purus lacus. Cras vitae odio odio.', 'post_excerpt' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'));
     // Assign a category to those posts
     foreach (self::$posts as $post) {
         wp_set_object_terms($post, self::$category->slug, 'category');
     }
 }
コード例 #2
0
 /**
  * Setup a new user and attribute some posts.
  */
 public static function wpSetUpBeforeClass($factory)
 {
     // Create a user
     self::$user_id = $factory->user->create(array('role' => 'author', 'user_login' => 'test_author', 'display_name' => 'Test A. Uthor'));
     // Create a taxonomy
     self::$category = $factory->category->create_and_get(array('name' => 'Foo Category', 'slug' => 'foo'));
     // Set a predictable time for testing date archives.
     self::$post_date = '2003-05-27 10:07:53';
     $count = get_option('posts_per_rss') + 1;
     // Create a few posts
     self::$posts = $factory->post->create_many($count, array('post_author' => self::$user_id, 'post_date' => self::$post_date, 'post_content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec velit massa, ultrices eu est suscipit, mattis posuere est. Donec vitae purus lacus. Cras vitae odio odio.', 'post_excerpt' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'));
     // Assign a category to those posts
     foreach (self::$posts as $post) {
         wp_set_object_terms($post, self::$category->slug, 'category');
     }
 }