@@ -751,4 +751,56 @@ public static function enableTracingDataProvider(): array
751751 [true , null , true ],
752752 ];
753753 }
754+
755+ /**
756+ * @dataProvider spotlightUrlNormalizationDataProvider
757+ */
758+ public function testSpotlightUrlNormalization (array $ data , string $ expected ): void
759+ {
760+ $ options = new Options ($ data );
761+ $ this ->assertSame ($ expected , $ options ->getSpotlightUrl ());
762+ }
763+
764+ public static function spotlightUrlNormalizationDataProvider (): \Generator
765+ {
766+ yield [['spotlight_url ' => 'http://localhost:8969 ' ], 'http://localhost:8969 ' ];
767+ yield [['spotlight_url ' => 'http://localhost:8969/stream ' ], 'http://localhost:8969 ' ];
768+ yield [['spotlight_url ' => 'http://localhost:8969/foo ' ], 'http://localhost:8969/foo ' ];
769+ yield [['spotlight_url ' => 'http://localhost:8969/foo/stream ' ], 'http://localhost:8969/foo ' ];
770+ yield [['spotlight_url ' => 'http://localhost:8969/stream/foo ' ], 'http://localhost:8969/stream/foo ' ];
771+ yield [['spotlight ' => 'http://localhost:8969 ' ], 'http://localhost:8969 ' ];
772+ yield [['spotlight ' => 'http://localhost:8969/stream ' ], 'http://localhost:8969 ' ];
773+ yield [['spotlight ' => 'http://localhost:8969/foo ' ], 'http://localhost:8969/foo ' ];
774+ yield [['spotlight ' => 'http://localhost:8969/foo/stream ' ], 'http://localhost:8969/foo ' ];
775+ yield [['spotlight ' => 'http://localhost:8969/stream/foo ' ], 'http://localhost:8969/stream/foo ' ];
776+ }
777+
778+ /**
779+ * @dataProvider setSpotlightUrlNormalizationDataProvider
780+ */
781+ public function testSetSpotlightUrlNormalization (string $ url , string $ expected ): void
782+ {
783+ $ options = new Options ();
784+ $ options ->setSpotlightUrl ($ url );
785+ $ this ->assertSame ($ expected , $ options ->getSpotlightUrl ());
786+ }
787+
788+ /**
789+ * @dataProvider setSpotlightUrlNormalizationDataProvider
790+ */
791+ public function testEnableSpotlightNormalization (string $ url , string $ expected ): void
792+ {
793+ $ options = new Options ();
794+ $ options ->enableSpotlight ($ url );
795+ $ this ->assertSame ($ expected , $ options ->getSpotlightUrl ());
796+ }
797+
798+ public static function setSpotlightUrlNormalizationDataProvider (): \Generator
799+ {
800+ yield ['http://localhost:8969 ' , 'http://localhost:8969 ' ];
801+ yield ['http://localhost:8969/stream ' , 'http://localhost:8969 ' ];
802+ yield ['http://localhost:8969/foo ' , 'http://localhost:8969/foo ' ];
803+ yield ['http://localhost:8969/foo/stream ' , 'http://localhost:8969/foo ' ];
804+ yield ['http://localhost:8969/stream/foo ' , 'http://localhost:8969/stream/foo ' ];
805+ }
754806}
0 commit comments