Files
piratepoet/tests/integration/Cron/Workers/ExportFilesCleanupTest.php
Rodrigo Primo 963da3bf16 Refactor the method processTaskStrategy() of some SimpleWorker child classes
This commit refactors the method processTaskStrategy() of some
SimpleWorker child classes to use Doctrine instead of Paris. In this
commit are included all the classes that it was only necessary to change
the method signature as they were receiving a ScheduledTask object as
the first parameter but didn't use it. Now they receive a
ScheduledTaskEntity object as the first param.

[MAILPOET-3843]
2021-10-05 13:21:53 +02: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);
}
}