Skip to content

Commit

Permalink
Remove tests for now
Browse files Browse the repository at this point in the history
  • Loading branch information
kraftbj committed Jul 3, 2020
1 parent 0a44504 commit 1b5a0d0
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 95 deletions.
26 changes: 0 additions & 26 deletions class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -6902,32 +6902,6 @@ public static function dns_prefetch( $urls = null ) {
}
}

/**
* Passes an array of URLs to wp_resource_hints.
*
* @since 8.8.0
* @deprecated 8.8.0 -- Just a temporary thing to help me track that I update everything.
*
* @param string|array $urls URLs to hint.
* @param string $type One of the supported resource types: dns-prefetch (default), preconnect, prefetch, or prerender.
*/
public static function add_resource_hint( $urls, $type = 'dns-prefetch' ) {
add_filter(
'wp_resource_hints',
function( $hints, $resource_type ) use ( $urls, $type ) {
if ( $resource_type === $type ) {
// Type casting to array required since the function accepts a single string.
foreach ( (array) $urls as $url ) {
$hints[] = $url;
}
}
return $hints;
},
10,
2
);
}

public function wp_dashboard_setup() {
if ( self::is_active() ) {
add_action( 'jetpack_dashboard_widget', array( __CLASS__, 'dashboard_widget_footer' ), 999 );
Expand Down
27 changes: 0 additions & 27 deletions packages/assets/tests/php/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,6 @@
* @package automattic/jetpack-assets
*/

// Support for:
// 1. `WP_DEVELOP_DIR` environment variable.
// 2. Plugin installed inside of WordPress.org developer checkout.
// 3. Tests checked out to /tmp.
if ( false !== getenv( 'WP_DEVELOP_DIR' ) ) {
// Defined on command line.
$test_root = getenv( 'WP_DEVELOP_DIR' );
} elseif ( file_exists( '../../../../tests/phpunit/includes/bootstrap.php' ) ) {
// Installed inside wordpress-develop.
$test_root = '../../../../tests/phpunit';
} elseif ( file_exists( '/vagrant/www/wordpress-develop/public_html/tests/phpunit/includes/bootstrap.php' ) ) {
// VVV.
$test_root = '/vagrant/www/wordpress-develop/public_html/tests/phpunit';
} elseif ( file_exists( '/srv/www/wordpress-trunk/public_html/tests/phpunit/includes/bootstrap.php' ) ) {
// VVV 3.0.
$test_root = '/srv/www/wordpress-trunk/public_html/tests/phpunit';
} elseif ( file_exists( '/tmp/wordpress-develop/tests/phpunit/includes/bootstrap.php' ) ) {
// Manual checkout & Jetpack's docker environment.
$test_root = '/tmp/wordpress-develop/tests/phpunit';
} elseif ( file_exists( '/tmp/wordpress-tests-lib/includes/bootstrap.php' ) ) {
// Legacy tests.
$test_root = '/tmp/wordpress-tests-lib';
}

require $test_root . '/includes/functions.php';
require $test_root . '/includes/bootstrap.php';

/**
* Load the composer packages.
*/
Expand Down
41 changes: 0 additions & 41 deletions packages/assets/tests/php/test-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,45 +179,4 @@ public function test_enqueue_async_script_calls_wp_enqueue_script() {
array( array( 'handle', Assets::get_file_url_for_environment( '/minpath.js', '/path.js' ), array(), '123', true ) )
);
}

/**
* Tests the add_resource_hint function.
*
* @author kraftbj
* @covers Assets::add_resource_hint
* @since 8.8.0
*/
public function test_add_resource_hint_single_string() {
/*
* First test is to confirm that the function works when passing a single string with no type.
*/
$url = '//single-string.example.com';
Assets::add_resource_hint( $url );
$values = apply_filters( 'wp_resource_hints', array(), 'dns-prefetch' );

$this->assertContains( $url, $values );
}

/**
* Tests the add_resource_hint function.
*
* @author kraftbj
* @covers Jetpack::add_resource_hint
* @since 8.8.0
*/
public function test_add_resource_hint_array() {
/**
* Next, test an array.
*/
$urls = array(
'//array-1.example.com',
'//array-2.example.com',
);

Assets::add_resource_hint( $urls );
$values = apply_filters( 'wp_resource_hints', array(), 'dns-prefetch' );

$this->assertContains( $urls[0], $values );
$this->assertContains( $urls[1], $values );
}
}
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<phpunit bootstrap="tests/php/bootstrap.php" backupGlobals="false" colors="true" convertDeprecationsToExceptions="true">
<phpunit bootstrap="tests/php/bootstrap.php" backupGlobals="false" colors="true">
<php>
<const name="PHPUNIT_JETPACK_TESTSUITE" value="true"/>
</php>
Expand Down

0 comments on commit 1b5a0d0

Please sign in to comment.