mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 03:04:34 +00:00
General: Update code for readability and inclusion
There are two pieces in here: 1) The update to change blacklist to blocklist is moved to disallowed_list. "Block" has a meaning in our code, and there could be ambiguity between this code and code related to blocks. 2) This improves backwards compatibility for code that was accessing the now deprecated code. Previously: [48477], [48405], [48400], [48121], [48122], [48124], [48142], [48566] Props: desrosj, SergeyBiryukov, johnjamesjacoby Fixes: #50413 git-svn-id: https://develop.svn.wordpress.org/trunk@48575 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
class Tests_WP_Blocklist_Check extends WP_UnitTestCase {
|
||||
|
||||
public function test_should_return_true_when_content_matches_blocklist_keys() {
|
||||
public function test_should_return_true_when_content_matches_disallowed_keys() {
|
||||
$author = 'Sting';
|
||||
$author_email = 'sting@example.com';
|
||||
$author_url = 'http://example.com';
|
||||
@@ -13,9 +13,9 @@ class Tests_WP_Blocklist_Check extends WP_UnitTestCase {
|
||||
$author_ip = '192.168.0.1';
|
||||
$user_agent = '';
|
||||
|
||||
update_option( 'blocklist_keys', "well\nfoo" );
|
||||
update_option( 'disallowed_keys', "well\nfoo" );
|
||||
|
||||
$result = wp_blocklist_check( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
|
||||
$result = wp_check_comment_disallowed_list( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
|
||||
|
||||
$this->assertTrue( $result );
|
||||
}
|
||||
@@ -23,7 +23,7 @@ class Tests_WP_Blocklist_Check extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 37208
|
||||
*/
|
||||
public function test_should_return_true_when_content_with_html_matches_blocklist_keys() {
|
||||
public function test_should_return_true_when_content_with_html_matches_disallowed_keys() {
|
||||
$author = 'Sting';
|
||||
$author_email = 'sting@example.com';
|
||||
$author_url = 'http://example.com';
|
||||
@@ -31,14 +31,14 @@ class Tests_WP_Blocklist_Check extends WP_UnitTestCase {
|
||||
$author_ip = '192.168.0.1';
|
||||
$user_agent = '';
|
||||
|
||||
update_option( 'blocklist_keys', "halfway\nfoo" );
|
||||
update_option( 'disallowed_keys', "halfway\nfoo" );
|
||||
|
||||
$result = wp_blocklist_check( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
|
||||
$result = wp_check_comment_disallowed_list( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
|
||||
|
||||
$this->assertTrue( $result );
|
||||
}
|
||||
|
||||
public function test_should_return_true_when_author_matches_blocklist_keys() {
|
||||
public function test_should_return_true_when_author_matches_disallowed_keys() {
|
||||
$author = 'Sideshow Mel';
|
||||
$author_email = 'mel@example.com';
|
||||
$author_url = 'http://example.com';
|
||||
@@ -46,14 +46,14 @@ class Tests_WP_Blocklist_Check extends WP_UnitTestCase {
|
||||
$author_ip = '192.168.0.1';
|
||||
$user_agent = '';
|
||||
|
||||
update_option( 'blocklist_keys', "sideshow\nfoo" );
|
||||
update_option( 'disallowed_keys', "sideshow\nfoo" );
|
||||
|
||||
$result = wp_blocklist_check( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
|
||||
$result = wp_check_comment_disallowed_list( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
|
||||
|
||||
$this->assertTrue( $result );
|
||||
}
|
||||
|
||||
public function test_should_return_true_when_url_matches_blocklist_keys() {
|
||||
public function test_should_return_true_when_url_matches_disallowed_keys() {
|
||||
$author = 'Rainier Wolfcastle';
|
||||
$author_email = 'rainier@wolfcastle.com';
|
||||
$author_url = 'http://example.com';
|
||||
@@ -61,9 +61,9 @@ class Tests_WP_Blocklist_Check extends WP_UnitTestCase {
|
||||
$author_ip = '192.168.0.1';
|
||||
$user_agent = '';
|
||||
|
||||
update_option( 'blocklist_keys', "example\nfoo" );
|
||||
update_option( 'disallowed_keys', "example\nfoo" );
|
||||
|
||||
$result = wp_blocklist_check( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
|
||||
$result = wp_check_comment_disallowed_list( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
|
||||
|
||||
$this->assertTrue( $result );
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class Tests_WP_Blocklist_Check extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 37208
|
||||
*/
|
||||
public function test_should_return_true_when_link_matches_blocklist_keys() {
|
||||
public function test_should_return_true_when_link_matches_disallowed_keys() {
|
||||
$author = 'Rainier Wolfcastle';
|
||||
$author_email = 'rainier@wolfcastle.com';
|
||||
$author_url = 'http://example.com';
|
||||
@@ -79,9 +79,9 @@ class Tests_WP_Blocklist_Check extends WP_UnitTestCase {
|
||||
$author_ip = '192.168.0.1';
|
||||
$user_agent = '';
|
||||
|
||||
update_option( 'blocklist_keys', '/spam/' );
|
||||
update_option( 'disallowed_keys', '/spam/' );
|
||||
|
||||
$result = wp_blocklist_check( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
|
||||
$result = wp_check_comment_disallowed_list( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
|
||||
|
||||
$this->assertTrue( $result );
|
||||
}
|
||||
@@ -94,9 +94,9 @@ class Tests_WP_Blocklist_Check extends WP_UnitTestCase {
|
||||
$author_ip = '192.168.0.1';
|
||||
$user_agent = '';
|
||||
|
||||
update_option( 'blocklist_keys', "sideshow\nfoobar" );
|
||||
update_option( 'disallowed_keys', "sideshow\nfoobar" );
|
||||
|
||||
$result = wp_blocklist_check( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
|
||||
$result = wp_check_comment_disallowed_list( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
|
||||
|
||||
$this->assertFalse( $result );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user