X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fconfig%2FEtcdConfigTest.php;h=379eebd8a40b9ead6d4b923122ee8e59b580db9f;hb=f6de67738dcc8b25c1343e2b1cb244641f8ede91;hp=ebe1972547559dbd9656719e957d0924c9e9b942;hpb=d2a92a4fc74b7247fc31e0fccee2757bfb71aa63;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/config/EtcdConfigTest.php b/tests/phpunit/includes/config/EtcdConfigTest.php index ebe1972547..379eebd8a4 100644 --- a/tests/phpunit/includes/config/EtcdConfigTest.php +++ b/tests/phpunit/includes/config/EtcdConfigTest.php @@ -2,7 +2,9 @@ use Wikimedia\TestingAccessWrapper; -class EtcConfigTest extends PHPUnit_Framework_TestCase { +class EtcdConfigTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; private function createConfigMock( array $options = [] ) { return $this->getMockBuilder( EtcdConfig::class ) @@ -459,6 +461,26 @@ class EtcConfigTest 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,