Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8262d76

Browse files
committed
tests: add tests when removing an element from the blocklist, add tests for more WP versions
1 parent 70310e8 commit 8262d76

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
strategy:
1919
matrix:
2020
operating-system: [ ubuntu-latest ]
21-
php-versions: [ '7.2', '7.3', '7.4' ]
22-
wp: [ '5.4', '5.5', '5.6', 'latest' ]
21+
php-versions: [ '7.2', '7.3', '7.4', '8.0', '8.1' ]
22+
wp: [ '5.4', '5.5', '5.6', '5.7', '5.8', '5.9', '6.0', '6.1', '6.2', '6.3', '6.4', '6.5', '6.6', 'latest' ]
2323
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} with WP ${{ matrix.wp }}
2424
steps:
2525
- name: Checkout

‎composer.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,12 @@
2929
"cs": "./vendor/bin/phpcs",
3030
"cbf": "./vendor/bin/phpcbf",
3131
"psalm": "./vendor/bin/psalm"
32+
},
33+
"config": {
34+
"allow-plugins": {
35+
"composer/installers": true,
36+
"dealerdirect/phpcodesniffer-composer-installer": true,
37+
"phpro/grumphp-shim": true
38+
}
3239
}
3340
}

‎tests/test-plugin.php‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ public function test_filter() {
3232

3333
}
3434

35+
public function test_remove_entry_filter() {
36+
add_filter('wp_http_blocklist', function( $blocklist ) {
37+
unset($blocklist[array_search('api.wordpress.org', $blocklist)]);
38+
return $blocklist;
39+
});
40+
41+
$result = wp_remote_get('https://api.wordpress.org');
42+
43+
$this->assertTrue( ! is_wp_error( $result ) );
44+
45+
}
46+
47+
3548
public function test_file_readable() {
3649
add_filter('wp_http_blocklist_file', function() {
3750
@unlink( __DIR__.'/blocklist_readable.txt' );

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /