Skip to content

Commit

Permalink
Add a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
spacedmonkey committed Aug 7, 2020
1 parent 7cb29e8 commit 0a78564
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/phpunit/php/class-test-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,25 @@ public function test_get_credentials() {
$this->assertEquals( $expected_utm, $actual_utm );
}

/**
*
* Test get_site_data.
*
* @covers ::get_site_data()
*/
public function test_get_site_data() {
add_filter( 'pre_option_blogname', '__return_empty_string' );
$site_data = $this->settings->get_site_data();

$this->assertEquals( [ 'url', 'name' ], array_keys( $site_data ) );

$url = wp_parse_url( get_home_url( null, '/' ) );
$name = sanitize_title_with_dashes( $url['host'] );

$this->assertEquals( $site_data['name'], $name );
remove_filter( 'pre_option_blogname', '__return_empty_string' );
}

/**
* Fake success.
*
Expand Down

0 comments on commit 0a78564

Please sign in to comment.