mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-02 21:56:56 +00:00
Tests: Use assertSame() in some newly introduced 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. Follow-up to [50380], [50959], [50960], [50973], [50993], [51003], [51051], [51054]. See #52482. git-svn-id: https://develop.svn.wordpress.org/trunk@51079 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -211,7 +211,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
|
||||
$this->assertEquals( array(), $data );
|
||||
$this->assertSame( array(), $data );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,6 +276,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
array(
|
||||
array(
|
||||
'id' => 'block-1',
|
||||
'id_base' => 'block',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'encoded' => base64_encode(
|
||||
@@ -296,11 +297,11 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
'content' => $block_content,
|
||||
),
|
||||
),
|
||||
'id_base' => 'block',
|
||||
'rendered' => '<p>Block test</p>',
|
||||
),
|
||||
array(
|
||||
'id' => 'rss-1',
|
||||
'id_base' => 'rss',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'encoded' => base64_encode(
|
||||
@@ -320,14 +321,13 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
)
|
||||
),
|
||||
),
|
||||
'id_base' => 'rss',
|
||||
'rendered' => '<a class="rsswidget" href="https://wordpress.org/news/feed"><img class="rss-widget-icon" style="border:0" width="14" height="14" src="http://example.org/wp-includes/images/rss.png" alt="RSS" /></a> <a class="rsswidget" href="https://wordpress.org/news">RSS test</a><ul><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/introducing-learn-wordpress/\'>Introducing Learn WordPress</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/simone/\'>WordPress 5.6 “Simone”</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/state-of-the-word-2020/\'>State of the Word 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/the-month-in-wordpress-november-2020/\'>The Month in WordPress: November 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/wordpress-5-6-release-candidate-2/\'>WordPress 5.6 Release Candidate 2</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-release-candidate/\'>WordPress 5.6 Release Candidate</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-beta-4/\'>WordPress 5.6 Beta 4</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-beta-3/\'>WordPress 5.6 Beta 3</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/the-month-in-wordpress-october-2020/\'>The Month in WordPress: October 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/10/wordpress-5-5-3-maintenance-release/\'>WordPress 5.5.3 Maintenance Release</a></li></ul>',
|
||||
),
|
||||
array(
|
||||
'id' => 'testwidget',
|
||||
'id_base' => 'testwidget',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => null,
|
||||
'id_base' => 'testwidget',
|
||||
'rendered' => '<h1>Default id</h1><span>Default text</span>',
|
||||
),
|
||||
),
|
||||
@@ -385,6 +385,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
array(
|
||||
array(
|
||||
'id' => 'text-1',
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'encoded' => base64_encode(
|
||||
@@ -405,7 +406,6 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
'text' => 'Custom text test',
|
||||
),
|
||||
),
|
||||
'id_base' => 'text',
|
||||
'rendered' => '<div class="textwidget">Custom text test</div>',
|
||||
'rendered_form' => '<input id="widget-text-1-title" name="widget-text[1][title]" class="title sync-input" type="hidden" value="">' . "\n" .
|
||||
' <textarea id="widget-text-1-text" name="widget-text[1][text]" class="text sync-input" hidden>Custom text test</textarea>' . "\n" .
|
||||
@@ -414,11 +414,11 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
),
|
||||
array(
|
||||
'id' => 'testwidget',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => null,
|
||||
'id_base' => 'testwidget',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'rendered' => '<h1>Default id</h1><span>Default text</span>',
|
||||
'rendered_form' => 'WP test widget form',
|
||||
'instance' => null,
|
||||
),
|
||||
),
|
||||
$data
|
||||
@@ -450,6 +450,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$this->assertEqualSets(
|
||||
array(
|
||||
'id' => 'text-1',
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'encoded' => base64_encode(
|
||||
@@ -470,7 +471,6 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
'text' => 'Custom text test',
|
||||
),
|
||||
),
|
||||
'id_base' => 'text',
|
||||
'rendered' => '<div class="textwidget">Custom text test</div>',
|
||||
),
|
||||
$data
|
||||
@@ -541,6 +541,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/widgets' );
|
||||
$request->set_body_params(
|
||||
array(
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'encoded' => base64_encode(
|
||||
@@ -558,13 +559,12 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
)
|
||||
),
|
||||
),
|
||||
'id_base' => 'text',
|
||||
)
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
$this->assertEquals( 'text-2', $data['id'] );
|
||||
$this->assertEquals( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertSame( 'text-2', $data['id'] );
|
||||
$this->assertSame( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertEqualSets(
|
||||
array(
|
||||
'text' => 'Updated text test',
|
||||
@@ -589,6 +589,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/widgets' );
|
||||
$request->set_body_params(
|
||||
array(
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'encoded' => base64_encode(
|
||||
@@ -600,7 +601,6 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
),
|
||||
'hash' => 'badhash',
|
||||
),
|
||||
'id_base' => 'text',
|
||||
)
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
@@ -621,9 +621,9 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/widgets' );
|
||||
$request->set_body_params(
|
||||
array(
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(),
|
||||
'id_base' => 'text',
|
||||
)
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
@@ -644,19 +644,19 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/widgets' );
|
||||
$request->set_body_params(
|
||||
array(
|
||||
'id_base' => 'block',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'raw' => array(
|
||||
'content' => '<!-- wp:paragraph --><p>Block test</p><!-- /wp:paragraph -->',
|
||||
),
|
||||
),
|
||||
'id_base' => 'block',
|
||||
)
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
$this->assertEquals( 'block-2', $data['id'] );
|
||||
$this->assertEquals( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertSame( 'block-2', $data['id'] );
|
||||
$this->assertSame( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertEqualSets(
|
||||
array(
|
||||
'content' => '<!-- wp:paragraph --><p>Block test</p><!-- /wp:paragraph -->',
|
||||
@@ -683,13 +683,13 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/widgets' );
|
||||
$request->set_body_params(
|
||||
array(
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'raw' => array(
|
||||
'title' => 'Updated text test',
|
||||
),
|
||||
),
|
||||
'id_base' => 'text',
|
||||
)
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
@@ -712,15 +712,15 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/widgets' );
|
||||
$request->set_body_params(
|
||||
array(
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'form_data' => 'widget-text[2][text]=Updated+text+test',
|
||||
'id_base' => 'text',
|
||||
)
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
$this->assertEquals( 'text-2', $data['id'] );
|
||||
$this->assertEquals( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertSame( 'text-2', $data['id'] );
|
||||
$this->assertSame( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertEqualSets(
|
||||
array(
|
||||
'text' => 'Updated text test',
|
||||
@@ -745,17 +745,17 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/widgets' );
|
||||
$request->set_body_params(
|
||||
array(
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'raw' => array( 'text' => 'Text 1' ),
|
||||
),
|
||||
'id_base' => 'text',
|
||||
)
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
$this->assertEquals( 'text-2', $data['id'] );
|
||||
$this->assertEquals( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertSame( 'text-2', $data['id'] );
|
||||
$this->assertSame( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertEqualSets(
|
||||
array(
|
||||
'text' => 'Text 1',
|
||||
@@ -768,17 +768,17 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/widgets' );
|
||||
$request->set_body_params(
|
||||
array(
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'raw' => array( 'text' => 'Text 2' ),
|
||||
),
|
||||
'id_base' => 'text',
|
||||
)
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
$this->assertEquals( 'text-3', $data['id'] );
|
||||
$this->assertEquals( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertSame( 'text-3', $data['id'] );
|
||||
$this->assertSame( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertEqualSets(
|
||||
array(
|
||||
'text' => 'Text 2',
|
||||
@@ -814,19 +814,19 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/widgets' );
|
||||
$request->set_body_params(
|
||||
array(
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'raw' => array(
|
||||
'text' => 'Updated text test',
|
||||
),
|
||||
),
|
||||
'id_base' => 'text',
|
||||
)
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
$this->assertEquals( 'text-2', $data['id'] );
|
||||
$this->assertEquals( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertSame( 'text-2', $data['id'] );
|
||||
$this->assertSame( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertEqualSets(
|
||||
array(
|
||||
'text' => 'Updated text test',
|
||||
@@ -860,20 +860,20 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$request->set_body_params(
|
||||
array(
|
||||
'id' => 'text-1',
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'raw' => array(
|
||||
'text' => 'Updated text test',
|
||||
),
|
||||
),
|
||||
'id_base' => 'text',
|
||||
)
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
|
||||
$this->assertEquals( 'text-1', $data['id'] );
|
||||
$this->assertEquals( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertSame( 'text-1', $data['id'] );
|
||||
$this->assertSame( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertEqualSets(
|
||||
array(
|
||||
'text' => 'Updated text test',
|
||||
@@ -919,7 +919,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$error = $response->as_error();
|
||||
$this->assertNotWPError( $error, $error ? $error->get_error_message() : '' );
|
||||
$this->assertEquals( 'sidebar-2', $response->get_data()['sidebar'] );
|
||||
$this->assertSame( 'sidebar-2', $response->get_data()['sidebar'] );
|
||||
|
||||
$sidebar1 = rest_do_request( '/wp/v2/sidebars/sidebar-1' );
|
||||
$this->assertNotContains( 'text-1', $sidebar1->get_data()['widgets'] );
|
||||
@@ -961,8 +961,8 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
|
||||
$this->assertEquals( 'text-1', $data['id'] );
|
||||
$this->assertEquals( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertSame( 'text-1', $data['id'] );
|
||||
$this->assertSame( 'sidebar-1', $data['sidebar'] );
|
||||
$this->assertEqualSets(
|
||||
array(
|
||||
'text' => 'Updated text test',
|
||||
@@ -978,12 +978,12 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
*/
|
||||
public function test_store_html_as_admin() {
|
||||
if ( is_multisite() ) {
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
'<div class="textwidget">alert(1)</div>',
|
||||
$this->update_text_widget_with_raw_html( '<script>alert(1)</script>' )
|
||||
);
|
||||
} else {
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
'<div class="textwidget"><script>alert(1)</script></div>',
|
||||
$this->update_text_widget_with_raw_html( '<script>alert(1)</script>' )
|
||||
);
|
||||
@@ -996,12 +996,12 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
public function test_store_html_as_superadmin() {
|
||||
wp_set_current_user( self::$superadmin_id );
|
||||
if ( is_multisite() ) {
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
'<div class="textwidget"><script>alert(1)</script></div>',
|
||||
$this->update_text_widget_with_raw_html( '<script>alert(1)</script>' )
|
||||
);
|
||||
} else {
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
'<div class="textwidget"><script>alert(1)</script></div>',
|
||||
$this->update_text_widget_with_raw_html( '<script>alert(1)</script>' )
|
||||
);
|
||||
@@ -1028,12 +1028,12 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$request->set_body_params(
|
||||
array(
|
||||
'id' => 'text-1',
|
||||
'id_base' => 'text',
|
||||
'instance' => array(
|
||||
'raw' => array(
|
||||
'text' => $html,
|
||||
),
|
||||
),
|
||||
'id_base' => 'text',
|
||||
)
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
@@ -1065,14 +1065,14 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
$data = $this->remove_links( $data );
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
array(
|
||||
'id' => 'testwidget',
|
||||
'id_base' => 'testwidget',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => null,
|
||||
'rendered' => '<h1>My test id</h1><span>My test title</span>',
|
||||
'rendered_form' => 'WP test widget form',
|
||||
'id_base' => 'testwidget',
|
||||
'instance' => null,
|
||||
),
|
||||
$data
|
||||
);
|
||||
@@ -1102,14 +1102,14 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
$data = $this->remove_links( $data );
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
array(
|
||||
'id' => 'testwidget',
|
||||
'id_base' => 'testwidget',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => null,
|
||||
'rendered' => '<h1>My test id</h1><span>My test title</span>',
|
||||
'rendered_form' => 'WP test widget form',
|
||||
'id_base' => 'testwidget',
|
||||
'instance' => null,
|
||||
),
|
||||
$data
|
||||
);
|
||||
@@ -1158,13 +1158,13 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$request->set_body_params(
|
||||
array(
|
||||
'id' => 'text-1',
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'raw' => array(
|
||||
'text' => 'Updated \\" \\\' text test',
|
||||
),
|
||||
),
|
||||
'id_base' => 'text',
|
||||
)
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
@@ -1179,7 +1179,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$data['instance']['raw']
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
'<div class="textwidget">Updated \\" \\\' text test</div>',
|
||||
$data['rendered']
|
||||
);
|
||||
@@ -1210,6 +1210,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$this->assertEqualSets(
|
||||
array(
|
||||
'id' => 'text-1',
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'wp_inactive_widgets',
|
||||
'instance' => array(
|
||||
'encoded' => base64_encode(
|
||||
@@ -1230,7 +1231,6 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
'text' => 'Custom text test',
|
||||
),
|
||||
),
|
||||
'id_base' => 'text',
|
||||
'rendered' => '',
|
||||
'rendered_form' => '<input id="widget-text-1-title" name="widget-text[1][title]" class="title sync-input" type="hidden" value="">' . "\n" .
|
||||
' <textarea id="widget-text-1-text" name="widget-text[1][text]" class="text sync-input" hidden>Custom text test</textarea>' . "\n" .
|
||||
@@ -1270,6 +1270,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
'previous' => array(
|
||||
|
||||
'id' => 'text-1',
|
||||
'id_base' => 'text',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'instance' => array(
|
||||
'encoded' => base64_encode(
|
||||
@@ -1290,7 +1291,6 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
'text' => 'Custom text test',
|
||||
),
|
||||
),
|
||||
'id_base' => 'text',
|
||||
'rendered' => '<div class="textwidget">Custom text test</div>',
|
||||
'rendered_form' => '<input id="widget-text-1-title" name="widget-text[1][title]" class="title sync-input" type="hidden" value="">' . "\n" .
|
||||
' <textarea id="widget-text-1-text" name="widget-text[1][text]" class="text sync-input" hidden>Custom text test</textarea>' . "\n" .
|
||||
@@ -1303,7 +1303,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
);
|
||||
|
||||
$response = rest_do_request( '/wp/v2/widgets/text-1' );
|
||||
$this->assertEquals( 404, $response->get_status() );
|
||||
$this->assertSame( 404, $response->get_status() );
|
||||
|
||||
$this->assertArrayNotHasKey( 'text-1', get_option( 'sidebars_widgets' )['sidebar-1'] );
|
||||
$this->assertArrayNotHasKey( 1, get_option( 'widget_text' ) );
|
||||
@@ -1379,7 +1379,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$data = $response->get_data();
|
||||
$properties = $data['schema']['properties'];
|
||||
|
||||
$this->assertEquals( 7, count( $properties ) );
|
||||
$this->assertSame( 7, count( $properties ) );
|
||||
$this->assertArrayHasKey( 'id', $properties );
|
||||
$this->assertArrayHasKey( 'id_base', $properties );
|
||||
$this->assertArrayHasKey( 'sidebar', $properties );
|
||||
|
||||
Reference in New Issue
Block a user