Skip to content

Commit

Permalink
Improve tests 1.
Browse files Browse the repository at this point in the history
  • Loading branch information
spacedmonkey committed May 19, 2020
1 parent 4b8ba7d commit 4681eeb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion php/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public function settings_page_render() {
* Enqueue style for settings page.
*/
public function enqueue() {
// Enqueue media selector CSS.
// Enqueue setting page CSS.
wp_enqueue_style(
'unsplash-settings-page-style',
$this->plugin->asset_url( 'assets/css/settings-page-compiled.css' ),
Expand Down
15 changes: 15 additions & 0 deletions tests/phpunit/php/class-test-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,21 @@ public function test_check_api_status() {
$this->assertTrue( $result );
}

/**
* Test check_api_status().
*
* @covers \Unsplash\API::check_api_status()
*/
public function test_check_api_status_filter() {
$plugin = new Plugin();
$plugin->init();
$api = new API( $plugin );
add_filter( 'pre_unsplash_check_api_status', '__return_false' );
$result = $api->check_api_status( [], false );
$this->assertFalse( $result );
remove_filter( 'pre_unsplash_check_api_status', '__return_false' );
}

/**
* Test check_api_status().
*
Expand Down
10 changes: 10 additions & 0 deletions tests/phpunit/php/class-test-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,16 @@ public function test_get_credentials() {
$this->assertEquals( $expected_utm, $actual_utm );
}

/**
* Test for enqueue() method.
*
* @see ::enqueue()
*/
public function test_enqueue() {
$this->settings->enqueue();
$this->assertTrue( wp_style_is( 'unsplash-settings-page-style', 'enqueued' ) );
}

/**
* Fake success.
*
Expand Down

0 comments on commit 4681eeb

Please sign in to comment.