Skip to content

Commit

Permalink
Use $wpdb instead in lock test.
Browse files Browse the repository at this point in the history
  • Loading branch information
costdev committed Oct 17, 2023
1 parent c19d7d8 commit 77e8e3a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions tests/phpunit/tests/admin/wpUpgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,20 @@ public function test_maintenance_mode_should_create_maintenance_file_with_boolea
* @covers WP_Upgrader::release_lock
*/
public function test_release_lock_should_remove_lock_option() {
update_option( 'lock.lock', 'content' );
global $wpdb;

$this->assertSame(
1,
$wpdb->insert(
$wpdb->options,
array(
'option_name' => 'lock.lock',
'option_value' => 'content',
),
'%s'
),
'The initial lock was not created.'
);

WP_Upgrader::release_lock( 'lock' );

Expand All @@ -1480,14 +1493,14 @@ public function test_download_package_should_exit_early_when_the_upgrader_pre_do

add_filter(
'upgrader_pre_download',
static function ( $reply ) {
return ! $reply;
static function () {
return 'a non-false value';
}
);

$result = self::$instance->download_package( 'package' );

$this->assertTrue( $result );
$this->assertSame( 'a non-false value', $result );
}

/**
Expand Down

0 comments on commit 77e8e3a

Please sign in to comment.