From: Timo Tijhof Date: Fri, 12 Jan 2018 19:25:58 +0000 (+0000) Subject: config: Increase coverage of EtcdConfig::parseDirectory() X-Git-Tag: 1.31.0-rc.0~921^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%2C%22id_auteur=%24connecte%22%29%20.%20%22?a=commitdiff_plain;h=738299fa3f78725a65e882ba2270802de368fa85;p=lhc%2Fweb%2Fwiklou.git config: Increase coverage of EtcdConfig::parseDirectory() One of the error cases wasn't covered yet. Change-Id: I762b37c7448c0f689248a99bad0b206d7cf63d73 --- diff --git a/tests/phpunit/includes/config/EtcdConfigTest.php b/tests/phpunit/includes/config/EtcdConfigTest.php index 7a4d9d9f6f..379eebd8a4 100644 --- a/tests/phpunit/includes/config/EtcdConfigTest.php +++ b/tests/phpunit/includes/config/EtcdConfigTest.php @@ -461,6 +461,26 @@ class EtcdConfigTest extends PHPUnit_Framework_TestCase { false // retry ], ], + '200 OK - Directory with non-array "nodes" key' => [ + 'http' => [ + 'code' => 200, + 'reason' => 'OK', + 'headers' => [], + 'body' => json_encode( [ 'node' => [ 'nodes' => [ + [ + 'key' => '/example/a', + 'dir' => true, + 'nodes' => 'not an array' + ], + ] ] ] ), + 'error' => '', + ], + 'expect' => [ + null, + "Unexpected JSON response in dir 'a'; 'nodes' is not an array.", + false // retry + ], + ], '200 OK - Correctly encoded garbage response' => [ 'http' => [ 'code' => 200,