mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Tests: First pass at using assertSame() instead of assertEquals() in most of the unit tests.
This ensures that not only the return values match the expected results, but also that their type is the same. Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable. Props johnbillion, jrf, SergeyBiryukov. See #38266. git-svn-id: https://develop.svn.wordpress.org/trunk@48937 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -110,7 +110,7 @@ class Tests_Admin_Includes_Schema extends WP_UnitTestCase {
|
||||
|
||||
$wpdb->options = $orig_options;
|
||||
|
||||
$this->assertEquals( $expected, $results );
|
||||
$this->assertSame( $expected, $results );
|
||||
}
|
||||
|
||||
public function data_populate_options() {
|
||||
@@ -119,8 +119,8 @@ class Tests_Admin_Includes_Schema extends WP_UnitTestCase {
|
||||
array(),
|
||||
array(
|
||||
// Random options to check.
|
||||
'posts_per_rss' => 10,
|
||||
'rss_use_excerpt' => 0,
|
||||
'posts_per_rss' => '10',
|
||||
'rss_use_excerpt' => '0',
|
||||
'mailserver_url' => 'mail.example.com',
|
||||
'mailserver_login' => 'login@example.com',
|
||||
'mailserver_pass' => 'password',
|
||||
@@ -128,13 +128,13 @@ class Tests_Admin_Includes_Schema extends WP_UnitTestCase {
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'posts_per_rss' => 7,
|
||||
'rss_use_excerpt' => 1,
|
||||
'posts_per_rss' => '7',
|
||||
'rss_use_excerpt' => '1',
|
||||
),
|
||||
array(
|
||||
// Random options to check.
|
||||
'posts_per_rss' => 7,
|
||||
'rss_use_excerpt' => 1,
|
||||
'posts_per_rss' => '7',
|
||||
'rss_use_excerpt' => '1',
|
||||
'mailserver_url' => 'mail.example.com',
|
||||
'mailserver_login' => 'login@example.com',
|
||||
'mailserver_pass' => 'password',
|
||||
@@ -147,8 +147,8 @@ class Tests_Admin_Includes_Schema extends WP_UnitTestCase {
|
||||
array(
|
||||
// Random options to check.
|
||||
'custom_option' => '1',
|
||||
'posts_per_rss' => 10,
|
||||
'rss_use_excerpt' => 0,
|
||||
'posts_per_rss' => '10',
|
||||
'rss_use_excerpt' => '0',
|
||||
'mailserver_url' => 'mail.example.com',
|
||||
'mailserver_login' => 'login@example.com',
|
||||
'mailserver_pass' => 'password',
|
||||
@@ -200,7 +200,7 @@ class Tests_Admin_Includes_Schema extends WP_UnitTestCase {
|
||||
|
||||
$wpdb->blogmeta = $orig_blogmeta;
|
||||
|
||||
$this->assertEquals( $expected, $results );
|
||||
$this->assertSame( $expected, $results );
|
||||
}
|
||||
|
||||
public function data_populate_site_meta() {
|
||||
@@ -248,7 +248,7 @@ class Tests_Admin_Includes_Schema extends WP_UnitTestCase {
|
||||
|
||||
$wpdb->sitemeta = $orig_sitemeta;
|
||||
|
||||
$this->assertEquals( $expected, $results );
|
||||
$this->assertSame( $expected, $results );
|
||||
}
|
||||
|
||||
public function data_populate_network_meta() {
|
||||
@@ -258,8 +258,8 @@ class Tests_Admin_Includes_Schema extends WP_UnitTestCase {
|
||||
array(
|
||||
// Random meta to check.
|
||||
'registration' => 'none',
|
||||
'blog_upload_space' => 100,
|
||||
'fileupload_maxk' => 1500,
|
||||
'blog_upload_space' => '100',
|
||||
'fileupload_maxk' => '1500',
|
||||
),
|
||||
),
|
||||
array(
|
||||
@@ -271,8 +271,8 @@ class Tests_Admin_Includes_Schema extends WP_UnitTestCase {
|
||||
// Random meta to check.
|
||||
'site_name' => 'My Great Network',
|
||||
'registration' => 'none',
|
||||
'blog_upload_space' => 100,
|
||||
'fileupload_maxk' => 1500,
|
||||
'blog_upload_space' => '100',
|
||||
'fileupload_maxk' => '1500',
|
||||
'WPLANG' => 'fr_FR',
|
||||
),
|
||||
),
|
||||
@@ -284,8 +284,8 @@ class Tests_Admin_Includes_Schema extends WP_UnitTestCase {
|
||||
// Random meta to check.
|
||||
'custom_meta' => '1',
|
||||
'registration' => 'none',
|
||||
'blog_upload_space' => 100,
|
||||
'fileupload_maxk' => 1500,
|
||||
'blog_upload_space' => '100',
|
||||
'fileupload_maxk' => '1500',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user