Skip to content

Commit

Permalink
Add a failing test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-xo committed Aug 24, 2022
1 parent d653e6a commit 572148f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/RSS_Item_getID3_Podcast_Helper_AUTO_SAVE_COVERTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,37 @@ public function test_id3v2_artist_album_title_with_cover()
$this->assertEquals(file_get_contents('another.subdir/id3v2_artist_album_title_cover.jpg'), file_get_contents('../fixtures/empty.jpg'));
}

public function test_auto_save_doesnt_create_spurious_helper_duplication()
{
define('CLI_ONLY', true);

copy('../fixtures/id3v2_artist_album_title_cover.mp3', './id3v2_artist_album_title_cover.mp3');

mkdir('temp');
$mp = new Cached_Dir_Podcast('.', 'temp');
$mp->init();
$getid3 = $mp->addHelper(new Caching_getID3_Podcast_Helper('tmp', new getID3_Podcast_Helper()));
$atom = $mp->addHelper(new Atom_Podcast_Helper());
$itunes = $mp->addHelper(new iTunes_Podcast_Helper());
$content = $mp->generate();

# checking for duplication
$this->assertEquals(1, preg_match_all("/<\/itunes:duration>/", $content));

age_dir_by('.', 60);

$mp = new Cached_Dir_Podcast('.', 'temp');
$mp->init();
$getid3 = $mp->addHelper(new Caching_getID3_Podcast_Helper('tmp', new getID3_Podcast_Helper()));
$atom = $mp->addHelper(new Atom_Podcast_Helper());
$itunes = $mp->addHelper(new iTunes_Podcast_Helper());
$content = $mp->generate();

# checking for duplication
$this->assertEquals(1, preg_match_all("/<\/itunes:duration>/", $content));

}

public static function tearDownAfterClass(): void
{
chdir('..');
Expand Down

0 comments on commit 572148f

Please sign in to comment.