Skip to content

Commit ec21171

Browse files
committed
Fix double slash issue
1 parent 152098b commit ec21171

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Context/GivenStepDefinitions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ public function given_a_request_to_a_url_respond_with_file( $url_or_pattern, PyS
107107
$config_file_contents
108108
);
109109

110-
$pattern = '/' . preg_quote( $url_or_pattern, '/' ) . '/';
111-
112-
$this->mocked_requests[ $pattern ] = (string) $content;
110+
$this->mocked_requests[ $url_or_pattern ] = (string) $content;
113111

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

@@ -125,6 +123,7 @@ public function request( \$url, \$headers = array(), \$data = array(), \$options
125123
\$mocked_requests = $mocked_requests;
126124
127125
foreach ( \$mocked_requests as \$pattern => \$response ) {
126+
\$pattern = '/' . preg_quote( \$pattern, '/' ) . '/';
128127
if ( 1 === preg_match( \$pattern, \$url ) ) {
129128
\$pos = strpos( \$response, "\\n\\n");
130129
if ( false !== \$pos ) {
@@ -160,6 +159,7 @@ static function( \$pre, \$parsed_args, \$url ) {
160159
\$mocked_requests = $mocked_requests;
161160
162161
foreach ( \$mocked_requests as \$pattern => \$response ) {
162+
\$pattern = '/' . preg_quote( \$pattern, '/' ) . '/';
163163
if ( 1 === preg_match( \$pattern, \$url ) ) {
164164
\$pos = strpos( \$response, "\n\n");
165165
if ( false !== \$pos ) {

0 commit comments

Comments
 (0)