Skip to content

Commit

Permalink
Replace deprecated phpunit assertions with new API
Browse files Browse the repository at this point in the history
  • Loading branch information
delawski committed Jul 16, 2024
1 parent d900239 commit fd568ec
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/tests/test-class-alerts.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ function test_load_alerts_settings_bad_alert_type() {

// TODO: This returns an empty 'success => true' response. It should probably return a failure response instead - 400 Bad Request?
$response = json_decode( $this->_last_response );
$this->assertInternalType( 'object', $response );
$this->assertObjectHasAttribute( 'success', $response );
$this->assertIsObject( $response );
$this->assertObjectHasProperty( 'success', $response );
$this->assertTrue( $response->success );
$this->assertObjectHasAttribute( 'data', $response );
$this->assertObjectHasAttribute( 'html', $response->data );
$this->assertObjectHasProperty( 'data', $response );
$this->assertObjectHasProperty( 'html', $response->data );
$this->assertEmpty( $response->data->html );
}

Expand All @@ -295,11 +295,11 @@ function test_load_alerts_settings_missing_caps() {
}

$response = json_decode( $this->_last_response );
$this->assertInternalType( 'object', $response );
$this->assertObjectHasAttribute( 'success', $response );
$this->assertIsObject( $response );
$this->assertObjectHasProperty( 'success', $response );
$this->assertFalse( $response->success );
$this->assertObjectHasAttribute( 'data', $response );
$this->assertObjectHasAttribute( 'message', $response->data );
$this->assertObjectHasProperty( 'data', $response );
$this->assertObjectHasProperty( 'message', $response->data );
$this->assertEquals( 'You do not have permission to do this.', $response->data->message );
}

Expand Down

0 comments on commit fd568ec

Please sign in to comment.