Skip to content

Commit

Permalink
Update setup and teardown fixtures in test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
thelovekesh committed Jan 18, 2024
1 parent 4f4173a commit 12f91b8
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class Test_WP_Service_Worker_Caching_Routes extends TestCase {
*
* @inheritdoc
*/
public function setUp() {
parent::setUp();
public function set_up() {
parent::set_up();

$this->instance = new WP_Service_Worker_Caching_Routes();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class Test_WP_Service_Worker_Precaching_Routes extends TestCase {
*
* @inheritdoc
*/
public function setUp() {
parent::setUp();
public function set_up() {
parent::set_up();

$this->instance = new WP_Service_Worker_Precaching_Routes();
}
Expand Down
15 changes: 11 additions & 4 deletions tests/test-class-wp-customize-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,20 @@ class Test_WP_Customize_Manager extends TestCase {
*/
public $wp_customize;

/**
* User ID.
*
* @var int
*/
public $user_id;

/**
* Setup.
*
* @inheritdoc
*/
public function setUp() {
parent::setUp();
public function set_up() {
parent::set_up();
$this->user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
wp_set_current_user( $this->user_id );

Expand All @@ -39,10 +46,10 @@ public function setUp() {
/**
* Tear down.
*/
public function tearDown() {
public function tear_down() {
$this->wp_customize = null;
unset( $GLOBALS['wp_customize'] );
parent::tearDown();
parent::tear_down();
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/test-class-wp-service-worker-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class Test_WP_Service_Worker_Scripts extends TestCase {
*
* @inheritdoc
*/
public function setUp() {
public function set_up() {
global $wp_actions, $wp_service_workers;
parent::setUp();
parent::set_up();
unset( $wp_actions['wp_default_service_workers'] );
$wp_service_workers = null;

Expand All @@ -36,8 +36,8 @@ public function setUp() {
/**
* Tear down.
*/
public function tearDown() {
parent::tearDown();
public function tear_down() {
parent::tear_down();
unset( $GLOBALS['wp_service_workers'] );
}

Expand Down
8 changes: 4 additions & 4 deletions tests/test-class-wp-service-workers.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class Test_WP_Service_Workers extends TestCase {
*
* @inheritdoc
*/
public function setUp() {
public function set_up() {
global $wp_actions, $wp_service_workers;
parent::setUp();
parent::set_up();
unset( $wp_actions['wp_default_service_workers'] );
$wp_service_workers = null;

Expand All @@ -36,8 +36,8 @@ public function setUp() {
/**
* Tear down.
*/
public function tearDown() {
parent::tearDown();
public function tear_down() {
parent::tear_down();
unset( $GLOBALS['wp_service_workers'] );
}

Expand Down
8 changes: 4 additions & 4 deletions tests/test-class-wp-web-app-manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class Test_WP_Web_App_Manifest extends TestCase {
*
* @inheritdoc
*/
public function setUp() {
parent::setUp();
public function set_up() {
parent::set_up();
$this->instance = new WP_Web_App_Manifest();
}

Expand All @@ -71,7 +71,7 @@ public function setUp() {
*
* @inheritdoc
*/
public function tearDown() {
public function tear_down() {
global $_wp_theme_features;

// Calling remove_theme_mod( 'custom-background' ) causes an undefined index error unless 'wp-head-callback' is set.
Expand All @@ -80,7 +80,7 @@ public function tearDown() {
delete_option( 'site_icon' );
remove_filter( 'pwa_background_color', array( $this, 'mock_background_color' ) );
remove_filter( 'rest_api_init', array( $this->instance, 'register_manifest_rest_route' ) );
parent::tearDown();
parent::tear_down();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/test-service-workers.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class Test_Service_Workers_Includes extends TestCase {
/**
* Tear down.
*/
public function tearDown() {
parent::tearDown();
public function tear_down() {
parent::tear_down();
$this->disable_permalinks();
}

Expand Down

0 comments on commit 12f91b8

Please sign in to comment.