public function setUp() { WP::setUp(); $this->plugin = \Cft\Plugin::getInstance(); $this->plugin->set('validatorBuilder', new \Cft\ValidatorBuilder($this->plugin)); $this->plugin->set('fieldBuilder', new \Cft\FieldBuilder($this->plugin)); }
public function setUp() { \WP_Mock::setUp(); \WP_Mock::wpFunction('stripslashes_deep', ['return' => function ($array) { return $array; }]); }
function setUp() { $this->getMock('\\WP_CLI_Command'); $this->getMock('\\CFPB\\CLI_Common'); $this->cli = $this->getMockBuilder('\\WP_CLI')->setMethods(array('success'))->getMock(); require_once 'cli/migrate.php'; $this->validTaxonomyArgs = array('category', 'new_category'); $this->missingTaxonomyArg = array('category'); $this->authorWithArg = array('category'); $this->include = array('include' => 1); $this->exclude = array('exclude' => 1); $this->post_type = array('post_type' => 'custom_post_type'); $this->before = array('before' => '2013-05-01'); $this->after = array('after' => '2013-01-01'); $this->ignore_term = array('ignore_term' => 'custom_taxonomy,term,term-2'); $this->post0 = new stdClass(); $this->post1 = new stdClass(); $this->term0 = new stdClass(); $this->term1 = new stdClass(); $this->post0->ID = 1; $this->post1->ID = 2; $this->term0->name = "Term"; $this->term0->slug = "term"; $this->term1->name = "Another"; $this->term1->slug = "another"; $this->terms = array($this->term0, $this->term1); $this->posts = array('posts' => array($this->post0, $this->post1), 'message' => 'Posts to migrate'); \WP_Mock::setUp(); }
function setUp() { global $post; $post = new \StdClass(); $post->ID = 1; $post->post_type = 'post'; \WP_Mock::setUp(); }
public function setUp() { \WP_Mock::setUp(); /*\WP_Mock::wpFunction('wp_upload_dir', [ 'return' => ['baseurl' => 'http://www.example.com'] ] );*/ }
public static function setUp($type = HookMock::TRUE_HOOKS) { require_once __DIR__ . '/hookmock-functions.php'; self::$type = $type; self::$hooks = []; if (self::$type === HookMock::WP_MOCK) { \WP_Mock::setUp(); } }
/** * Setup the test environment. * * @return void */ public function setUp() { \WP_Mock::setUp(); if (!$this->app) { $this->app = $this->createApplication(); $this->client = $this->createClient(); $this->app->setRequestForConsoleEnvironment(); $this->app->boot(); } }
public function setUp() { \WP_Mock::setUp(); \WP_Mock::wpFunction('stripslashes_deep', ['return' => function ($array) { $newArray = []; foreach ($array as $k => $v) { $newArray[$k] = stripslashes($v); } return $newArray; }]); }
private function make_request() { $url = 'http://acme.org/new-authz'; $response = MockData::get_head_response(); \WP_Mock::setUp(); // Mock the remote request \WP_Mock::wpFunction('wp_remote_request', array('args' => array($url, array('body' => '')), 'times' => 1, 'return' => $response)); $nonce = new \LEWP\Request\Nonce($url); $nonce->send(); \WP_Mock::tearDown(); return $nonce; }
private function get_directory_object() { $url = 'http://acme.org/directory'; $args = array('body' => ''); $response = MockData::get_directory_response(); \WP_Mock::setUp(); // Mock the remote request \WP_Mock::wpFunction('wp_remote_request', array('args' => array($url, $args), 'times' => 1, 'return' => $response)); $directory = new \LEWP\Request\Directory($url); $directory->send(); \WP_Mock::tearDown(); return $directory; }
public function test_send_generates_response_and_sets_properties() { $url = 'http://acme.org/directory'; $args = array('body' => ''); $response = MockData::get_directory_response(); \WP_Mock::setUp(); // Mock the remote request \WP_Mock::wpFunction('wp_remote_request', array('args' => array($url, $args), 'times' => 1, 'return' => $response)); $directory = new \LEWP\Request\Directory($url); $this->assertEquals($response, $directory->send()); $this->assertEquals($response, $directory->get_response()); $this->assertEquals($response['body'], $directory->get_body()); $this->assertEquals($response['headers']['replay-nonce'], $directory->get_response_nonce()); \WP_Mock::tearDown(); }
/** * Do custom initialization. */ public function setUp() { parent::setUp(); it_exchange_temporarily_load_addon('guest-checkout'); it_exchange_temporarily_load_addon('digital-downloads-product-type'); it_exchange_add_feature_support_to_product_type('recurring-payments', 'digital-downloads-product-type'); $null = null; $this->exchange_admin = new IT_Exchange_Admin($null); it_exchange_save_option('settings_general', $this->exchange_admin->set_general_settings_defaults(array())); it_exchange_get_option('settings_general', true); $this->product_factory = new ITELIC_UnitTest_Factory_For_Products(); $this->key_factory = new ITELIC_UnitTest_Factory_For_Keys($this->factory); $this->activation_factory = new ITELIC_UnitTest_Factory_For_Activations($this->factory); $this->release_factory = new ITELIC_UnitTest_Factory_For_Releases($this->factory); $this->update_factory = new ITELIC_UnitTest_Factory_For_Updates($this->factory); WP_Mock::setUp(); }
public function setUp() { \WP_Mock::setUp(); require_once dirname(__FILE__) . '/../admin/disable-emojis.php'; }
protected function setUp() { $menu = new Menu_Builder('Lyric Menu', 23); $this->submenu = new Submenu_Builder('Lyric Submenu', $menu); \WP_Mock::setUp(); }
function setUp() { global $wp_locale; $wp_locale = $this->getMockBuilder('\\WP_Locale')->setMethods(array('get_month'))->getMock(); \WP_Mock::setUp(); }
public function setUp() { parent::setUp(); \WP_Mock::setUp(); }
public function setUp() { WP::setUp(); $this->subject = $this->getMockBuilder('\\Cft\\Field\\AbstractBase')->setConstructorArgs([$this->postId, $this->name, $this->config, $this->value])->getMockForAbstractClass(); }
public function setUp() { \WP_Mock::setUsePatchwork(true); \WP_Mock::setUp(); }
public function setUp() { \WP_Mock::setUp(); // Ensure that the settings are in a default state Purgely_Settings::set_settings(array()); }
public function setUp() { \WP_Mock::setUp(); // Mock the remote request \WP_Mock::wpPassthruFunction('absint'); }
/** * Setup WP_Mock for each test */ function setUp() { \WP_Mock::setUp(); $this->instance = new tenup\demo\Real_World_Class(); }
public function setUp() { \WP_Mock::setUp(); \WP_Mock::wpFunction('wp_cache_flush'); }
public function setUp() { \WP_Mock::setUp(); $this->params = new WC_POS_Params(); }
protected function setUp() { \WP_Mock::setUp(); $this->builder = $this->getMockBuilder('\\WP\\Lyric\\Panel\\Menu\\Builder')->setConstructorArgs(['Lyric Builder'])->setMethods(['add_menu'])->getMock(); $this->builder->expects($this->any())->method('add_menu')->will($this->returnValue('void')); }
function setUp() { \WP_Mock::setUp(); parent::setUp(); }
/** * Init WP_Mock and API handler */ public function setUp() { \WP_Mock::setUp(); // Needed for define('ABSPATH.. self::$apiHandler = new WP_SUAPI_API_Handler("https://api-v2.swissunihockey.ch/api/", "", "", false); }
public function setUp() { require_once __DIR__ . '/fixtures/posts.php'; require_once __DIR__ . '/fixtures/terms.php'; \WP_Mock::setUp(); }
public function setUp() { \WP_Mock::setUp(); \WP_Mock::wpPassthruFunction('absint'); }
public function setUp() { \WP_Mock::setUp(); }
public function setUp() { \WP_Mock::setUp(); require_once dirname(__FILE__) . '/../class-nonce.php'; }