From 070b8a6154739eb6a202788ee62351b8ab2537c3 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Mon, 29 Feb 2016 20:34:48 +0000 Subject: [PATCH] Put an assertion in `test_nonexistent_array()` test. The point of the test is to demonstrate that PHP doesn't throw a notice when calling `unset()` on an undefined array key. To placate PHPUnit's useless test detection, we add a redundant assertion. Introduced in [25240]. See #36016. git-svn-id: https://develop.svn.wordpress.org/trunk@36779 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/basic.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/phpunit/tests/basic.php b/tests/phpunit/tests/basic.php index d824d3395d..87ca86649a 100644 --- a/tests/phpunit/tests/basic.php +++ b/tests/phpunit/tests/basic.php @@ -91,13 +91,18 @@ EOF; $this->assertEquals($expected, mask_input_value($in)); } + /** + * @ticket 17884 + */ function test_setting_nonexistent_arrays() { $page = 1; $field = 'settings'; $empty_array[$page][$field] = 'foo'; + // Assertion not strictly needed; we mainly want to show that a notice is not thrown. unset( $empty_array[$page]['bar']['baz'] ); + $this->assertFalse( isset( $empty_array[ $page ]['bar']['baz'] ) ); } function test_magic_getter() {