Skip to content

Commit

Permalink
Fix double slash issue
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Jan 27, 2025
1 parent 152098b commit ec21171
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Context/GivenStepDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ public function given_a_request_to_a_url_respond_with_file( $url_or_pattern, PyS
$config_file_contents
);

$pattern = '/' . preg_quote( $url_or_pattern, '/' ) . '/';

$this->mocked_requests[ $pattern ] = (string) $content;
$this->mocked_requests[ $url_or_pattern ] = (string) $content;

$mocked_requests = var_export( $this->mocked_requests, true /* return */ );

Expand All @@ -125,6 +123,7 @@ public function request( \$url, \$headers = array(), \$data = array(), \$options
\$mocked_requests = $mocked_requests;
foreach ( \$mocked_requests as \$pattern => \$response ) {
\$pattern = '/' . preg_quote( \$pattern, '/' ) . '/';
if ( 1 === preg_match( \$pattern, \$url ) ) {
\$pos = strpos( \$response, "\\n\\n");
if ( false !== \$pos ) {
Expand Down Expand Up @@ -160,6 +159,7 @@ static function( \$pre, \$parsed_args, \$url ) {
\$mocked_requests = $mocked_requests;
foreach ( \$mocked_requests as \$pattern => \$response ) {
\$pattern = '/' . preg_quote( \$pattern, '/' ) . '/';
if ( 1 === preg_match( \$pattern, \$url ) ) {
\$pos = strpos( \$response, "\n\n");
if ( false !== \$pos ) {
Expand Down

0 comments on commit ec21171

Please sign in to comment.