mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Docs: Update inline comments in some test files per the documentation standards.
See #52628. git-svn-id: https://develop.svn.wordpress.org/trunk@50491 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
class Tests_Formatting_SanitizeFileName extends WP_UnitTestCase {
|
||||
function test_munges_extensions() {
|
||||
# r17990
|
||||
// r17990
|
||||
$file_name = sanitize_file_name( 'test.phtml.txt' );
|
||||
$this->assertSame( 'test.phtml_.txt', $file_name );
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
|
||||
|
||||
$resized = $gd_image_editor->multi_resize( $sizes_array );
|
||||
|
||||
# First, check to see if returned array is as expected
|
||||
// First, check to see if returned array is as expected.
|
||||
$expected_array = array(
|
||||
array(
|
||||
'file' => 'waffles-50x33.jpg',
|
||||
@@ -217,7 +217,7 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
|
||||
* By aspect, should be 30x20 output.
|
||||
*/
|
||||
array(
|
||||
'width' => 9999, # Arbitrary High Value
|
||||
'width' => 9999, // Arbitrary high value.
|
||||
'height' => 20,
|
||||
'crop' => false,
|
||||
),
|
||||
@@ -228,7 +228,7 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
|
||||
*/
|
||||
array(
|
||||
'width' => 45,
|
||||
'height' => 9999, # Arbitrary High Value
|
||||
'height' => 9999, // Arbitrary high value.
|
||||
'crop' => true,
|
||||
),
|
||||
|
||||
@@ -271,7 +271,7 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
|
||||
* By aspect, should be 105x70 output.
|
||||
*/
|
||||
array(
|
||||
'width' => -9999, # Arbitrary Negative Value
|
||||
'width' => -9999, // Arbitrary negative value.
|
||||
'height' => 70,
|
||||
),
|
||||
|
||||
@@ -281,7 +281,7 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
|
||||
*/
|
||||
array(
|
||||
'width' => 200,
|
||||
'height' => -9999, # Arbitrary Negative Value
|
||||
'height' => -9999, // Arbitrary negative value.
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
|
||||
|
||||
$resized = $imagick_image_editor->multi_resize( $sizes_array );
|
||||
|
||||
# First, check to see if returned array is as expected
|
||||
// First, check to see if returned array is as expected.
|
||||
$expected_array = array(
|
||||
array(
|
||||
'file' => 'waffles-50x33.jpg',
|
||||
@@ -211,7 +211,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
|
||||
* By aspect, should be 30x20 output.
|
||||
*/
|
||||
array(
|
||||
'width' => 9999, # Arbitrary High Value
|
||||
'width' => 9999, // Arbitrary high value.
|
||||
'height' => 20,
|
||||
'crop' => false,
|
||||
),
|
||||
@@ -222,7 +222,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
|
||||
*/
|
||||
array(
|
||||
'width' => 45,
|
||||
'height' => 9999, # Arbitrary High Value
|
||||
'height' => 9999, // Arbitrary high value.
|
||||
'crop' => true,
|
||||
),
|
||||
|
||||
@@ -265,7 +265,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
|
||||
* By aspect, should be 105x70 output.
|
||||
*/
|
||||
array(
|
||||
'width' => -9999, # Arbitrary Negative Value
|
||||
'width' => -9999, // Arbitrary negative value.
|
||||
'height' => 70,
|
||||
),
|
||||
|
||||
@@ -275,7 +275,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
|
||||
*/
|
||||
array(
|
||||
'width' => 200,
|
||||
'height' => -9999, # Arbitrary Negative Value
|
||||
'height' => -9999, // Arbitrary negative value.
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -1205,7 +1205,7 @@ class WP_Test_REST_Themes_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
public function test_update_item() {}
|
||||
|
||||
/**
|
||||
* Test single theme
|
||||
* Test single theme.
|
||||
*
|
||||
* @ticket 50152
|
||||
*/
|
||||
|
||||
@@ -101,22 +101,22 @@ class Test_Sitemaps_Functions extends WP_UnitTestCase {
|
||||
array( 'posts', 'post', 0, home_url( '/?sitemap=posts&sitemap-subtype=post&paged=1' ) ),
|
||||
array( 'posts', 'page', 1, home_url( '/?sitemap=posts&sitemap-subtype=page&paged=1' ) ),
|
||||
array( 'posts', 'page', 5, home_url( '/?sitemap=posts&sitemap-subtype=page&paged=5' ) ),
|
||||
// post_type doesn't exist.
|
||||
// Post type doesn't exist.
|
||||
array( 'posts', 'foo', 5, false ),
|
||||
array( 'taxonomies', 'category', 1, home_url( '/?sitemap=taxonomies&sitemap-subtype=category&paged=1' ) ),
|
||||
array( 'taxonomies', 'post_tag', 1, home_url( '/?sitemap=taxonomies&sitemap-subtype=post_tag&paged=1' ) ),
|
||||
// Negative paged, gets converted to its absolute value.
|
||||
array( 'taxonomies', 'post_tag', -1, home_url( '/?sitemap=taxonomies&sitemap-subtype=post_tag&paged=1' ) ),
|
||||
// negative paged, gets converted to it's absolute value.
|
||||
array( 'users', '', 4, home_url( '/?sitemap=users&paged=4' ) ),
|
||||
// users provider doesn't allow subtypes.
|
||||
// Users provider doesn't allow subtypes.
|
||||
array( 'users', 'foo', 4, false ),
|
||||
// provider doesn't exist.
|
||||
// Provider doesn't exist.
|
||||
array( 'foo', '', 4, false ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for test_get_sitemap_url_pretty_permalinks
|
||||
* Data provider for test_get_sitemap_url_pretty_permalinks.
|
||||
*
|
||||
* @return array[] {
|
||||
* Data to test with.
|
||||
@@ -133,16 +133,16 @@ class Test_Sitemaps_Functions extends WP_UnitTestCase {
|
||||
array( 'posts', 'post', 0, home_url( '/wp-sitemap-posts-post-1.xml' ) ),
|
||||
array( 'posts', 'page', 1, home_url( '/wp-sitemap-posts-page-1.xml' ) ),
|
||||
array( 'posts', 'page', 5, home_url( '/wp-sitemap-posts-page-5.xml' ) ),
|
||||
// post_type doesn't exist.
|
||||
// Post type doesn't exist.
|
||||
array( 'posts', 'foo', 5, false ),
|
||||
array( 'taxonomies', 'category', 1, home_url( '/wp-sitemap-taxonomies-category-1.xml' ) ),
|
||||
array( 'taxonomies', 'post_tag', 1, home_url( '/wp-sitemap-taxonomies-post_tag-1.xml' ) ),
|
||||
// negative paged, gets converted to it's absolute value.
|
||||
// Negative paged, gets converted to its absolute value.
|
||||
array( 'taxonomies', 'post_tag', -1, home_url( '/wp-sitemap-taxonomies-post_tag-1.xml' ) ),
|
||||
array( 'users', '', 4, home_url( '/wp-sitemap-users-4.xml' ) ),
|
||||
// users provider doesn't allow subtypes.
|
||||
// Users provider doesn't allow subtypes.
|
||||
array( 'users', 'foo', 4, false ),
|
||||
// provider doesn't exist.
|
||||
// Provider doesn't exist.
|
||||
array( 'foo', '', 4, false ),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -645,13 +645,13 @@ class Tests_User_Capabilities extends WP_UnitTestCase {
|
||||
public function test_do_not_allow_is_denied_for_all_roles() {
|
||||
foreach ( self::$users as $role => $user ) {
|
||||
|
||||
# Test adding the cap directly to the user
|
||||
// Test adding the cap directly to the user.
|
||||
$user->add_cap( 'do_not_allow' );
|
||||
$has_cap = $user->has_cap( 'do_not_allow' );
|
||||
$user->remove_cap( 'do_not_allow' );
|
||||
$this->assertFalse( $has_cap, "User with the {$role} role should not have the do_not_allow capability" );
|
||||
|
||||
# Test adding the cap via a filter
|
||||
// Test adding the cap via a filter.
|
||||
add_filter( 'user_has_cap', array( $this, 'grant_do_not_allow' ), 10, 4 );
|
||||
$has_cap = $user->has_cap( 'do_not_allow' );
|
||||
remove_filter( 'user_has_cap', array( $this, 'grant_do_not_allow' ), 10, 4 );
|
||||
@@ -662,7 +662,7 @@ class Tests_User_Capabilities extends WP_UnitTestCase {
|
||||
continue;
|
||||
}
|
||||
|
||||
# Test adding the cap to the user's role
|
||||
// Test adding the cap to the user's role.
|
||||
$role_obj = get_role( $role );
|
||||
$role_obj->add_cap( 'do_not_allow' );
|
||||
$has_cap = $user->has_cap( 'do_not_allow' );
|
||||
@@ -676,13 +676,13 @@ class Tests_User_Capabilities extends WP_UnitTestCase {
|
||||
* @ticket 41059
|
||||
*/
|
||||
public function test_do_not_allow_is_denied_for_super_admins() {
|
||||
# Test adding the cap directly to the user
|
||||
// Test adding the cap directly to the user.
|
||||
self::$super_admin->add_cap( 'do_not_allow' );
|
||||
$has_cap = self::$super_admin->has_cap( 'do_not_allow' );
|
||||
self::$super_admin->remove_cap( 'do_not_allow' );
|
||||
$this->assertFalse( $has_cap, 'Super admins should not have the do_not_allow capability' );
|
||||
|
||||
# Test adding the cap via a filter
|
||||
// Test adding the cap via a filter.
|
||||
add_filter( 'user_has_cap', array( $this, 'grant_do_not_allow' ), 10, 4 );
|
||||
$has_cap = self::$super_admin->has_cap( 'do_not_allow' );
|
||||
remove_filter( 'user_has_cap', array( $this, 'grant_do_not_allow' ), 10, 4 );
|
||||
|
||||
Reference in New Issue
Block a user