Files
piratepoet/mailpoet/tests/integration/Cron/Workers/ExportFilesCleanupTest.php
Jan Jakes 9f790efbf0 Move plugin files to a subfolder
[MAILPOET-3988]
2022-01-18 15:30:22 +01:00

23 lines
729 B
PHP

<?php
namespace MailPoet\Test\Cron\Workers;
use MailPoet\Cron\Workers\ExportFilesCleanup;
use MailPoet\Entities\ScheduledTaskEntity;
class ExportFilesCleanupTest extends \MailPoetTest {
public function testItWorks() {
$wpUploadDir = wp_upload_dir();
$oldFilePath = $wpUploadDir['basedir'] . '/mailpoet/MailPoet_export_old_file.csv';
$newFilePath = $wpUploadDir['basedir'] . '/mailpoet/MailPoet_export_new_file.csv';
touch($oldFilePath, time() - (60 * 60 * 24 * 7));
touch($newFilePath);
$cleanup = new ExportFilesCleanup();
$cleanup->processTaskStrategy(new ScheduledTaskEntity(), microtime(true));
$this->assertFileExists($newFilePath);
$this->assertFileNotExists($oldFilePath);
}
}