@@ -40,23 +40,40 @@ public function testSiteSelectionViaCwd()
4040
4141 public function testOptionsUri ()
4242 {
43- // Put a yml file in the drush folder.
43+ // Test whether a URI in a config file resolves correctly, and test
44+ // various URI values for their expected Site URI and path.
4445 $ drush_config_file = Path::join ($ this ->webrootSlashDrush (), 'drush.yml ' );
45- $ test_uri = 'http://test.uri ' ;
46- $ options_with_uri = [
47- 'options ' => [
48- 'uri ' => $ test_uri ,
49- ],
50- ];
51- $ options = [
46+ $ command_options = [
5247 'format ' => 'json ' ,
5348 'uri ' => 'OMIT ' , // A special value which causes --uri to not be specified.
5449 ];
55- file_put_contents ($ drush_config_file , Yaml::dump ($ options_with_uri , PHP_INT_MAX , 2 ));
56- $ this ->drush ('core-status ' , [], $ options );
57- unlink ($ drush_config_file );
58- $ output = $ this ->getOutputFromJSON ();
59- $ this ->assertEquals ($ test_uri , $ output ->uri );
50+ foreach ([
51+ 'test.uri ' => ['http://test.uri ' , 'sites/dev ' ],
52+ 'test.uri/ ' => ['http://test.uri/ ' , 'sites/dev ' ],
53+ 'test.uri/subpath ' => ['http://test.uri/subpath ' , 'sites/stage ' ],
54+ 'test.uri/subpath/ ' => ['http://test.uri/subpath/ ' , 'sites/stage ' ],
55+ 'http://test.uri ' => ['http://test.uri ' , 'sites/dev ' ],
56+ 'http://test.uri/ ' => ['http://test.uri/ ' , 'sites/dev ' ],
57+ 'http://test.uri/subpath ' => ['http://test.uri/subpath ' , 'sites/stage ' ],
58+ 'http://test.uri/subpath/ ' => ['http://test.uri/subpath/ ' , 'sites/stage ' ],
59+ 'https://test.uri ' => ['https://test.uri ' , 'sites/dev ' ],
60+ 'https://test.uri/ ' => ['https://test.uri/ ' , 'sites/dev ' ],
61+ 'https://test.uri/subpath ' => ['https://test.uri/subpath ' , 'sites/stage ' ],
62+ 'https://test.uri/subpath/ ' => ['https://test.uri/subpath/ ' , 'sites/stage ' ],
63+ ] as $ test_uri => $ expected ) {
64+ // Put a yml file in the drush folder.
65+ $ config_options = [
66+ 'options ' => [
67+ 'uri ' => $ test_uri ,
68+ ],
69+ ];
70+ file_put_contents ($ drush_config_file , Yaml::dump ($ config_options , PHP_INT_MAX , 2 ));
71+ $ this ->drush ('core-status ' , [], $ command_options );
72+ unlink ($ drush_config_file );
73+ $ output = $ this ->getOutputFromJSON ();
74+ // Include the test URI, for some context in errors.
75+ $ this ->assertEquals ([$ test_uri => $ expected ], [$ test_uri => [$ output ->uri , $ output ->site ]]);
76+ }
6077 }
6178
6279 public function testRecursiveConfigLoading ()
0 commit comments