19
19
use Magento \FunctionalTestingFramework \Util \Protocol \CurlInterface ;
20
20
use Magento \FunctionalTestingFramework \Util \ConfigSanitizerUtil ;
21
21
use Yandex \Allure \Adapter \Support \AttachmentSupport ;
22
+ use Magento \FunctionalTestingFramework \Exceptions \TestFrameworkException ;
22
23
23
24
/**
24
25
* MagentoWebDriver module provides common Magento web actions through Selenium WebDriver.
@@ -319,6 +320,7 @@ public function searchAndMultiSelectOption($select, array $options, $requireActi
319
320
* @param string $selectSearchTextField
320
321
* @param string $selectSearchResult
321
322
* @param string[] $options
323
+ * @throws \Exception
322
324
* @return void
323
325
*/
324
326
public function selectMultipleOptions ($ selectSearchTextField , $ selectSearchResult , array $ options )
@@ -474,14 +476,17 @@ public function scrollToTopOfPage()
474
476
* Takes given $command and executes it against exposed MTF CLI entry point. Returns response from server.
475
477
* @param string $command
476
478
* @param string $arguments
479
+ * @throws TestFrameworkException
477
480
* @return string
478
481
*/
479
482
public function magentoCLI ($ command , $ arguments = null )
480
483
{
481
- // trim everything after first '/' in URL after (ex http://magento.instance/<index.php>)
482
- preg_match ("/.+\/\/[^\/]+\/?/ " , $ this ->config ['url ' ], $ trimmed );
483
- $ trimmedUrl = $ trimmed [0 ];
484
- $ apiURL = $ trimmedUrl . ltrim (getenv ('MAGENTO_CLI_COMMAND_PATH ' ), '/ ' );
484
+ // Remove index.php if it's present in url
485
+ $ baseUrl = rtrim (
486
+ str_replace ('index.php ' , '' , rtrim ($ this ->config ['url ' ], '/ ' )),
487
+ '/ '
488
+ );
489
+ $ apiURL = $ baseUrl . '/ ' . ltrim (getenv ('MAGENTO_CLI_COMMAND_PATH ' ), '/ ' );
485
490
486
491
$ executor = new CurlTransport ();
487
492
$ executor ->write (
@@ -501,6 +506,7 @@ public function magentoCLI($command, $arguments = null)
501
506
/**
502
507
* Runs DELETE request to delete a Magento entity against the url given.
503
508
* @param string $url
509
+ * @throws TestFrameworkException
504
510
* @return string
505
511
*/
506
512
public function deleteEntityByUrl ($ url )
0 commit comments