- Updates models' delete() method to delete parent newsletter

- Updates unit tests
This commit is contained in:
Vlad
2016-11-20 12:10:43 -05:00
parent e3c1ff6c8c
commit 0291c3a9a0
3 changed files with 59 additions and 14 deletions

View File

@@ -0,0 +1,28 @@
<?php
use MailPoet\Models\Newsletter;
use MailPoet\Models\SendingQueue;
class SendingQueueModelTest extends MailPoetTest {
function _before() {
$this->newsletter = Newsletter::create();
$this->newsletter->type = Newsletter::TYPE_STANDARD;
$this->newsletter->save();
expect(Newsletter::findMany())->count(1);
$this->sending_queue = SendingQueue::create();
$this->sending_queue->newsletter_id = $this->newsletter->id;
$this->sending_queue->save();
expect(SendingQueue::findMany())->count(1);
}
function testItDeletesParentNewsletter() {
$this->sending_queue->delete();
expect(Newsletter::findMany())->count(0);
expect(SendingQueue::findMany())->count(0);
}
function _after() {
ORM::raw_execute('TRUNCATE ' . Newsletter::$_table);
ORM::raw_execute('TRUNCATE ' . SendingQueue::$_table);
}
}