Move dynamic segments from Premium plugin
[MAILPOET-2382]
This commit is contained in:
committed by
Jack Kitterhing
parent
0af9f09f50
commit
70a89b7939
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Premium\DynamicSegments\FreePluginConnectors;
|
||||
|
||||
use MailPoet\Premium\Models\DynamicSegment;
|
||||
|
||||
class SubscribersListingsHandlerFactoryTest extends \MailPoetTest {
|
||||
|
||||
function testItReturnsNullWithUnknownSegment() {
|
||||
$segment = DynamicSegment::create();
|
||||
$segment->id = 1;
|
||||
$segment->name = 'name';
|
||||
$segment->type = 'unknown';
|
||||
$listings = new SubscribersListingsHandlerFactory();
|
||||
$result = $listings->get($segment, []);
|
||||
expect($result)->null();
|
||||
}
|
||||
|
||||
function testItReturnsDataForDynamicSegment() {
|
||||
$segment = DynamicSegment::createOrUpdate([
|
||||
'name' => 'name',
|
||||
'description' => 'desc',
|
||||
'type' => DynamicSegment::TYPE_DYNAMIC,
|
||||
]);
|
||||
$listings = new SubscribersListingsHandlerFactory();
|
||||
$result = $listings->get($segment, []);
|
||||
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