diff --git a/app/Models/Foundation/Summit/Events/SummitEvent.php b/app/Models/Foundation/Summit/Events/SummitEvent.php index 9b2921437..5f40f83f3 100644 --- a/app/Models/Foundation/Summit/Events/SummitEvent.php +++ b/app/Models/Foundation/Summit/Events/SummitEvent.php @@ -1426,7 +1426,6 @@ public function getStreamDuration(): int public function setStreamingUrl(?string $streaming_url): void { $this->streaming_url = $streaming_url; - $this->overflow_streaming_url = $streaming_url;; $key = $this->getSecureStreamCacheKey(); $this->skipDateUpdate(); if (Cache::tags(sprintf('secure_streams_%s', $this->summit->getId()))->has($key)) @@ -1994,8 +1993,6 @@ public function setOverflow(string $overflow_streaming_url, { $this->overflow_streaming_url = $overflow_streaming_url; $this->overflow_stream_is_secure = $overflow_stream_is_secure; - $this->streaming_url = $overflow_streaming_url; - $this->stream_is_secure = $overflow_stream_is_secure; $this->occupancy = self::OccupancyOverflow; $this->skipDateUpdate(); } diff --git a/tests/Unit/Entities/SummitEventStreamingUrlTest.php b/tests/Unit/Entities/SummitEventStreamingUrlTest.php new file mode 100644 index 000000000..ee73acfcd --- /dev/null +++ b/tests/Unit/Entities/SummitEventStreamingUrlTest.php @@ -0,0 +1,66 @@ +addEvent($event); + return $event; + } + + public function testSetOverflowLeavesThePrimaryStreamUntouched(): void + { + $event = $this->eventWithSummit(); + $event->setStreamingUrl(self::PrimaryUrl); + $event->setStreamIsSecure(false); + + $event->setOverflow(self::OverflowUrl, true); + + $this->assertEquals(self::OverflowUrl, $event->getOverflowStreamingUrl()); + $this->assertTrue($event->getOverflowStreamIsSecure()); + $this->assertEquals(SummitEvent::OccupancyOverflow, $event->getOccupancy()); + + $this->assertEquals(self::PrimaryUrl, $event->getStreamingUrl(), 'setOverflow must not overwrite streaming_url'); + $this->assertFalse($event->IsSecureStream(), 'setOverflow must not overwrite stream_is_secure'); + } + + public function testSetStreamingUrlLeavesTheOverflowStreamUntouched(): void + { + $event = $this->eventWithSummit(); + $event->setOverflow(self::OverflowUrl, true); + + $event->setStreamingUrl(self::PrimaryUrl); + + $this->assertEquals(self::PrimaryUrl, $event->getStreamingUrl()); + $this->assertEquals(self::OverflowUrl, $event->getOverflowStreamingUrl(), 'setStreamingUrl must not overwrite overflow_streaming_url'); + } +}