Commit ad7aa91d authored by Patrick Barroca's avatar Patrick Barroca

dev #46014 : delete cascade blacklist, add tests

parent 75e1533f
......@@ -71,6 +71,10 @@ class Class_Newsletter extends Storm_Model_Abstract {
protected $_has_many =
[
'blacklists' => ['model' => 'Class_Newsletter_Blacklist',
'role' => 'newsletter',
'dependents' => 'delete'],
'dispatchs' => ['model' => 'Class_Newsletter_Dispatch',
'role' => 'newsletter',
'dependents' => 'delete'],
......@@ -79,7 +83,8 @@ class Class_Newsletter extends Storm_Model_Abstract {
'role' => 'newsletter',
'dependents' => 'delete'],
'user_groups' => ['through' => 'newsletter_group_subscriptions']];
'user_groups' => ['through' => 'newsletter_group_subscriptions'],
];
protected $_notices_finder;
protected $_recipent_size = 20;
......
......@@ -431,6 +431,14 @@ class Admin_NewsletterControllerDeleteActionTest extends Admin_AbstractControlle
parent::setUp();
$this->fixture('Class_Newsletter', ['id' => 4]);
$this->fixture('Class_Newsletter_Blacklist',
['id' => 42,
'newsletter_id' => 4,
'mail' => 'never@send.to.me']);
$this->fixture('Class_Newsletter_Dispatch',
['id' => 42,
'newsletter_id' => 4]);
$this->dispatch('/admin/newsletter/delete/id/4', true);
}
......@@ -448,6 +456,18 @@ class Admin_NewsletterControllerDeleteActionTest extends Admin_AbstractControlle
}
/** @test */
public function linkedBlacklistShouldBeDeleted() {
$this->assertNull(Class_Newsletter_Blacklist::find(42));
}
/** @test */
public function linkedDispatchShouldBeDeleted() {
$this->assertNull(Class_Newsletter_Dispatch::find(42));
}
/** @test */
public function shouldRedirectToIndex() {
$this->assertRedirectTo('/admin/newsletter/index');
......@@ -455,6 +475,7 @@ class Admin_NewsletterControllerDeleteActionTest extends Admin_AbstractControlle
}
class Admin_NewsletterControllerSendInProgressActionTest extends Admin_NewsletterControllerTestCase {
protected
$_command,
......
Markdown is supported
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