Skip to content
Snippets Groups Projects
Commit 03584faf authored by efalcy's avatar efalcy
Browse files

hotline #59638 : add sql patch to clean abuse newsletter_dispatch records

parent f15b7130
Branches
Tags
4 merge requests!2334Master,!2147Dev#40650 contractuel 5255 dole preinscription en ligne bressuire concarneau ccvh,!2141Hotline#59638 newsletter envoi version anterieure,!2132dev #59734 first commit
Pipeline #1416 passed with stage
in 12 minutes and 17 seconds
<?php
try {
Zend_Db_Table_Abstract::getDefaultAdapter()
->query('delete from newsletter_dispatch where COLLECTED=0 and ended_on is NULL and error is NULL and DATE(created_on)!=CURDATE()');
} catch(Exception $e) {}
?>
\ No newline at end of file
......@@ -1336,3 +1336,26 @@ class UpgradeDB_321_Test extends UpgradeDBTestCase {
$this->assertFieldType('newsletters', 'titre', 'varchar(255)');
}
}
class UpgradeDB_322_Test extends UpgradeDBTestCase {
public function prepare() {
try {
$this->query("insert into newsletter_dispatch (newsletter_id, title, created_on, ended_on, error, collected) values ('1','Title for test', NOW(),NULL,NULL,0),
('1','Title 2 for test', '2017-05-08 14:00:00',NULL,NULL,0)");
} catch(Exception $e) {}
}
/** @test */
public function newslettersDispatchWithSameDateShouldNotBeDeleted() {
$data = $this->query('select * from newsletter_dispatch where title="Title for test" ;')->fetch();
$this->assertNotNull($data);
}
/** @test */
public function newslettersDispatchShouldBeDeleted() {
$data = $this->query('select * from newsletter_dispatch where title="Title 2 for test" ;')->fetch();
$this->assertNull($data);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment