public function test_customize_meta_boxes() { $testee = new Testee(); WP_Mock::wpFunction('remove_meta_box', array('times' => 1, 'args' => array(WP_Mock\Functions::type('string'), WP_Mock\Functions::type('string'), WP_Mock\Functions::type('string')))); $testee->customize_meta_boxes(); $this->assertConditionsMet(); }
/** * Constructor. Set up the properties. * * @param PostType $post_type Post type model. * @param Nonce $nonce Nonce model. */ public function __construct(PostType $post_type, Nonce $nonce) { $this->post_type = $post_type->get_post_type(); $this->nonce = $nonce; /** * Filter the meta key. * * @param string $meta_key Meta key. */ $this->meta_key = (string) apply_filters('external_content_meta_key', '_external_content'); $this->meta_key = esc_attr($this->meta_key); }
<?php # -*- coding: utf-8 -*- namespace tfrommen\ExternalContent; use tfrommen\Autoloader; if (!defined('WP_UNINSTALL_PLUGIN')) { return; } /** @var \wpdb $wpdb */ global $wpdb; require_once __DIR__ . '/inc/Autoloader/bootstrap.php'; $autoloader = new Autoloader\Autoloader(); $autoloader->add_rule(new Autoloader\NamespaceRule(__DIR__ . '/inc', __NAMESPACE__)); // Delete plugin posts $query = "\nSELECT ID\nFROM {$wpdb->posts}\nWHERE post_type = %s\nLIMIT 500"; $post_type = new Models\PostType(); $query = $wpdb->prepare($query, $post_type->get_post_type()); while ($post_ids = $wpdb->get_col($query)) { foreach ($post_ids as $post_id) { wp_delete_post($post_id, TRUE); } }
/** * Constructor. Set up the properties. * * @param Model $model Model. * @param PostTypeModel $post_type Post type model. * @param NonceModel $nonce Nonce model. */ public function __construct(Model $model, PostTypeModel $post_type, NonceModel $nonce) { $this->meta_key = $model->get_meta_key(); $this->post_type = $post_type->get_post_type(); $this->nonce = $nonce; }