post thumbnails – PHP variable = get_the_post_thumbnail_url outputting without slashes

In a custom shortcode function, I’m grabbing the featured image URL:

$text_slider_testimonial_img = get_the_post_thumbnail_url($single->ID);

If I echo $text_slider_testimonial_img immediately I see the correct image URL: //localhost:3000/wp-content/uploads/2021/03/splitbanner1.jpg

When I pass this variable to a function, and that function uses:

$text_slider_content .= "<div class='text_slider_testimonial' style='background-size: cover; background-image: url('". $text_slider_testimonial_img ."')>";
return $text_slider_content;    

the style component of the above is output as:

style="background-size: cover; background-image: url(" localhost:3000="" wp-content="" uploads="" 2021="" 03="" splitbanner1.jpg')="">

Why are the slashes being stripped out, and the ="" being added?

Help appreciated.