Move dynamic segments from Premium plugin
[MAILPOET-2382]
This commit is contained in:
committed by
Jack Kitterhing
parent
0af9f09f50
commit
70a89b7939
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Premium\DynamicSegments\FreePluginConnectors;
|
||||
|
||||
use MailPoet\Premium\Models\DynamicSegment;
|
||||
|
||||
class SubscribersBulkActionHandlerTest extends \MailPoetTest {
|
||||
|
||||
function testItReturnsNullWithUnknownSegment() {
|
||||
$segment = [
|
||||
'name' => 'name',
|
||||
'description' => 'desc',
|
||||
'type' => 'unknown',
|
||||
];
|
||||
$handler = new SubscribersBulkActionHandler();
|
||||
$result = $handler->apply($segment, [
|
||||
'listing' => ['filter' => ['segment' => 5]],
|
||||
'action' => 'trash',
|
||||
]);
|
||||
expect($result)->null();
|
||||
}
|
||||
|
||||
function testItReturnsDataForDynamicSegment() {
|
||||
$segment = DynamicSegment::createOrUpdate([
|
||||
'name' => 'name',
|
||||
'description' => 'desc',
|
||||
'type' => DynamicSegment::TYPE_DYNAMIC,
|
||||
]);
|
||||
$handler = new SubscribersBulkActionHandler();
|
||||
$result = $handler->apply($segment->asArray(), [
|
||||
'listing' => ['filter' => ['segment' => $segment->id()]],
|
||||
'action' => 'trash',
|
||||
]);
|
||||
expect($result)->notNull();
|
||||
}
|
||||
|
||||
function _before() {
|
||||
$this->cleanData();
|
||||
}
|
||||
|
||||
function _after() {
|
||||
$this->cleanData();
|
||||
}
|
||||
|
||||
private function cleanData() {
|
||||
\ORM::raw_execute('TRUNCATE ' . DynamicSegment::$_table);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user