Skip to content

Commit e8f160a

Browse files
committed
Adding failing test
1 parent 416647d commit e8f160a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

generator/tests/GeneratedFilesTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,19 @@ public function testSprintf()
3232
restore_error_handler();
3333
}
3434
}
35+
36+
public function testPregMatch()
37+
{
38+
require_once __DIR__.'/../../generated/pcre.php';
39+
require_once __DIR__.'/../../lib/Exceptions/SafeExceptionInterface.php';
40+
require_once __DIR__.'/../../lib/Exceptions/AbstractSafeException.php';
41+
require_once __DIR__.'/../../generated/Exceptions/PcreException.php';
42+
43+
44+
$url = 'https://open.spotify.com/track/0nCqpKBrvDchO1BIvt7DTR?si=iLUKDfkLSy-IpnLA7qImnw';
45+
$spotifyRegex = "/https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:track\/|\?uri=spotify:track:)((\w|-){22})/";
46+
preg_match($spotifyRegex, $url, $matches);
47+
\preg_match($spotifyRegex, $url, $originalMatches);
48+
$this->assertSame($originalMatches, $matches);
49+
}
3550
}

0 commit comments

Comments
 (0)