public function test__unregister_post_status()
 {
     register_post_status('foo');
     _unregister_post_status('foo');
     $stati = get_post_stati();
     $this->assertFalse(isset($stati['foo']));
 }
 public static function wpSetUpBeforeClass($factory)
 {
     self::$editor_user_id = $factory->user->create(array('role' => 'editor'));
     self::$author_user_id = $factory->user->create(array('role' => 'author'));
     self::$editor_private_post = $factory->post->create(array('post_author' => self::$editor_user_id, 'post_status' => 'private'));
     self::$author_private_post = $factory->post->create(array('post_author' => self::$author_user_id, 'post_status' => 'private'));
     // Custom status with private=true.
     register_post_status('privatefoo', array('private' => true));
     self::$editor_privatefoo_post = $factory->post->create(array('post_author' => self::$editor_user_id, 'post_status' => 'privatefoo'));
     self::$author_privatefoo_post = $factory->post->create(array('post_author' => self::$author_user_id, 'post_status' => 'privatefoo'));
     _unregister_post_status('privatefoo');
 }
示例#3
0
 public static function setUpBeforeClass()
 {
     $f = new WP_UnitTest_Factory();
     self::$editor_user = $f->user->create(array('role' => 'editor'));
     self::$author_user = $f->user->create(array('role' => 'author'));
     self::$editor_private_post = $f->post->create(array('post_author' => self::$editor_user, 'post_status' => 'private'));
     self::$author_private_post = $f->post->create(array('post_author' => self::$author_user, 'post_status' => 'private'));
     // Custom status with private=true.
     register_post_status('privatefoo', array('private' => true));
     self::$editor_privatefoo_post = $f->post->create(array('post_author' => self::$editor_user, 'post_status' => 'privatefoo'));
     self::$author_privatefoo_post = $f->post->create(array('post_author' => self::$author_user, 'post_status' => 'privatefoo'));
     _unregister_post_status('privatefoo');
     self::commit_transaction();
 }
示例#4
0
文件: testcase.php 项目: dannyoz/tls
 /**
  * Unregister non-built-in post statuses.
  */
 protected function reset_post_statuses()
 {
     foreach (get_post_stati(array('_builtin' => false)) as $post_status) {
         _unregister_post_status($post_status);
     }
 }