/** * @uses \WPML_UnitTestCase::setUp to setup a WPML installation and remove query filters added by WP core unit tests * that interfere with WPML's unit tests */ function setUp() { parent::setUp(); require_once WC_PATH . '/woocommerce.php'; $wc_unit = new WC_Unit_Test_Case(); $wc_unit->setUp(); }
/** * Initialize a WC_Settings_Page for testing */ public function setUp() { parent::setUp(); $mock_page = $this->getMock('WC_Settings_General'); $mock_page->expects($this->any())->method('get_id')->will($this->returnValue('page-id')); $mock_page->expects($this->any())->method('get_label')->will($this->returnValue('Page Label')); $this->page = $mock_page; }
public function setUp() { parent::setUp(); if (!is_a($this->loader, 'WC_Connect_Loader')) { $this->loader = new WC_Connect_Loader(); $this->loader->load_dependencies(); } if (!is_a($this->validator, 'WC_Connect_Service_Schemas_Validator')) { $this->validator = new WC_Connect_Service_Schemas_Validator(); } }
/** * Setup the test case case * * @since 2.2 * @see WC_Unit_Test_Case::setUp() */ public function setUp() { parent::setUp(); // load API classes WC()->api->includes(); // set user $this->user_id = $this->factory->user->create(array('role' => 'shop_manager')); wp_set_current_user($this->user_id); // this isn't used, but it causes a warning unless set $_SERVER['REQUEST_METHOD'] = null; // mock the API server to prevent headers from being sent $this->mock_server = $this->getMock('WC_API_Server', array('header'), array('/')); WC()->api->register_resources($this->mock_server); }
/** * Setup test. * * @since 2.2 */ public function setUp() { parent::setUp(); $this->wc = WC(); }
/** * Unset the server. */ public function tearDown() { parent::tearDown(); global $wp_rest_server; $wp_rest_server = null; }
public function setUp() { parent::setUp(); $this->user_id = $this->factory->user->create(array('role' => 'shop_manager')); wp_set_current_user($this->user_id); }