From d653e6a8894951009a10784e74f266d9cf0b7f79 Mon Sep 17 00:00:00 2001 From: Ben XO <75862+ben-xo@users.noreply.github.com> Date: Wed, 24 Aug 2022 21:11:05 +0100 Subject: [PATCH] Make iTunes_Podcast_Helper defines more test friendly --- dir2cast.php | 5 ++++- test/RSS_Item_iTunes_Podcast_HelperTest.php | 2 +- test/SettingsHandlerTest.php | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dir2cast.php b/dir2cast.php index bfff1c0..2b41c7c 100644 --- a/dir2cast.php +++ b/dir2cast.php @@ -313,6 +313,8 @@ public function setSelfLink($link) class iTunes_Podcast_Helper extends GetterSetter implements Podcast_Helper { + static $ITUNES_SUBTITLE_SUFFIX = ''; + protected $owner_name, $owner_email, $image_href, $explicit; protected $categories = array(); @@ -404,7 +406,7 @@ public function appendToItem(DOMElement $item_element, DOMDocument $doc, RSS_Ite $itunes_subtitle = $item->getSubtitle(); if($itunes_subtitle !== '') { - $elements['subtitle'] = $itunes_subtitle . ITUNES_SUBTITLE_SUFFIX; + $elements['subtitle'] = $itunes_subtitle . iTunes_Podcast_Helper::$ITUNES_SUBTITLE_SUFFIX; } foreach($elements as $key => $val) @@ -1915,6 +1917,7 @@ public static function defaults(array $SERVER) Dir_Podcast::$DEBUG = DEBUG; Cached_Dir_Podcast::$MIN_CACHE_TIME = MIN_CACHE_TIME; getID3_Podcast_Helper::$AUTO_SAVE_COVER_ART = AUTO_SAVE_COVER_ART; + iTunes_Podcast_Helper::$ITUNES_SUBTITLE_SUFFIX = ITUNES_SUBTITLE_SUFFIX; // Set up up factory settings for RSS Items RSS_File_Item::$FILES_URL = MP3_URL; // TODO: rename this to MEDIA_URL diff --git a/test/RSS_Item_iTunes_Podcast_HelperTest.php b/test/RSS_Item_iTunes_Podcast_HelperTest.php index fa2a1b0..1637b9c 100644 --- a/test/RSS_Item_iTunes_Podcast_HelperTest.php +++ b/test/RSS_Item_iTunes_Podcast_HelperTest.php @@ -42,7 +42,7 @@ public function test_rss_item_added_to_podcast_channel_has_itunes_properties() */ public function test_rss_item_itunes_subtitle_suffix() { - define('ITUNES_SUBTITLE_SUFFIX', ' Click here for more…'); + iTunes_Podcast_Helper::$ITUNES_SUBTITLE_SUFFIX = ' Click here for more…'; $mp = new MyPodcast(); $helper = new iTunes_Podcast_Helper(); diff --git a/test/SettingsHandlerTest.php b/test/SettingsHandlerTest.php index b4a0895..dd7f052 100644 --- a/test/SettingsHandlerTest.php +++ b/test/SettingsHandlerTest.php @@ -57,6 +57,7 @@ public function test_default_defines_set() $this->assertFalse(getID3_Podcast_Helper::$AUTO_SAVE_COVER_ART); $this->assertEmpty(RSS_File_Item::$FILES_URL); $this->assertEmpty(RSS_File_Item::$FILES_DIR); + $this->assertEmpty(iTunes_Podcast_Helper::$ITUNES_SUBTITLE_SUFFIX); $this->assertFalse(Media_RSS_Item::$LONG_TITLES); $this->assertEquals('comment', Media_RSS_Item::$DESCRIPTION_SOURCE); @@ -191,6 +192,7 @@ public function test_sensible_defaults($argv0) $this->assertSame(Dir_Podcast::$MIN_FILE_AGE, MIN_FILE_AGE); $this->assertSame(Cached_Dir_Podcast::$MIN_CACHE_TIME, MIN_CACHE_TIME); $this->assertSame(getID3_Podcast_Helper::$AUTO_SAVE_COVER_ART, AUTO_SAVE_COVER_ART); + $this->assertSame(iTunes_Podcast_Helper::$ITUNES_SUBTITLE_SUFFIX, ITUNES_SUBTITLE_SUFFIX); $this->assertSame(RSS_File_Item::$FILES_URL, MP3_URL); $this->assertSame(RSS_File_Item::$FILES_DIR, MP3_DIR); $this->assertSame(Media_RSS_Item::$LONG_TITLES, LONG_TITLES);