diff --git a/test/AgeDirTest.php b/test/AgeDirTest.php new file mode 100644 index 0000000..f03d2f7 --- /dev/null +++ b/test/AgeDirTest.php @@ -0,0 +1,32 @@ +assertEquals($mtime1 - 10, filemtime('dir2cast.php')); + $this->assertEquals($mtime2 - 10, filemtime('temp')); + $this->assertEquals($mtime3 - 10, filemtime('.')); + $this->assertEquals($mtime4 - 10, filemtime('out.xml')); + } + + public function tearDown(): void + { + chdir('..'); + } +} \ No newline at end of file diff --git a/test/CachingTest.php b/test/CachingTest.php index 4b8217a..35b5212 100644 --- a/test/CachingTest.php +++ b/test/CachingTest.php @@ -2,7 +2,7 @@ use PHPUnit\Framework\TestCase; -final class CachingTest extends TestCase +class CachingTest extends TestCase { public $file = 'out.xml'; public $output = ''; @@ -18,21 +18,6 @@ public function setUp(): void clearstatcache(); } - public function test_age_dir() - { - $mtime1 = filemtime('dir2cast.php'); - $mtime2 = filemtime('temp'); - $mtime3 = filemtime('.'); - $mtime4 = filemtime('out.xml'); - - age_dir_by('.', 10); - - $this->assertEquals($mtime1 - 10, filemtime('dir2cast.php')); - $this->assertEquals($mtime2 - 10, filemtime('temp')); - $this->assertEquals($mtime3 - 10, filemtime('.')); - $this->assertEquals($mtime4 - 10, filemtime('out.xml')); - } - public function test_default_empty_podcast_caches_output_in_default_folder(): void { // caches the output in the default temp folder diff --git a/test/CachingTest_prepopulatedTest.php b/test/CachingTest_prepopulatedTest.php new file mode 100644 index 0000000..730cae4 --- /dev/null +++ b/test/CachingTest_prepopulatedTest.php @@ -0,0 +1,22 @@ +output, $this->returncode); + $this->content = file_get_contents($this->file); + clearstatcache(); + } + + public function tearDown(): void + { + $this->assertEquals(1, preg_match('/pre-existing\.mp3/', file_get_contents($this->file))); + parent::tearDown(); + } +}