Convert properties not caught by Code Sniffer to camel case
[MAILPOET-1796]
This commit is contained in:
@ -20,7 +20,7 @@ class MP2Migration {
|
||||
public function render() {
|
||||
$this->mp2Migrator->init();
|
||||
$data = [
|
||||
'log_file_url' => $this->mp2Migrator->log_file_url,
|
||||
'log_file_url' => $this->mp2Migrator->logFileUrl,
|
||||
'progress_url' => $this->mp2Migrator->progressbar->url,
|
||||
];
|
||||
$this->pageRenderer->displayPage('mp2migration.html', $data);
|
||||
|
@ -89,7 +89,7 @@ class NewslettersTest extends \MailPoetTest {
|
||||
$sentNewsletters[$i] = Newsletter::create();
|
||||
$sentNewsletters[$i]->type = Newsletter::TYPE_STANDARD;
|
||||
$sentNewsletters[$i]->subject = 'Sent newsletter ' . $i;
|
||||
$sentNewsletters[$i]->sent_at = '2017-01-0' . $i . ' 01:01:01';
|
||||
$sentNewsletters[$i]->sentAt = '2017-01-0' . $i . ' 01:01:01';
|
||||
$sentNewsletters[$i]->save();
|
||||
};
|
||||
|
||||
|
@ -94,7 +94,7 @@ class CronWorkerRunnerTest extends \MailPoetTest {
|
||||
|
||||
$result = $this->cronWorkerRunner->run($worker);
|
||||
expect($result)->false();
|
||||
expect(ScheduledTask::findOne()->scheduled_at)->same($inOneWeek->format('Y-m-d H:i:s'));
|
||||
expect(ScheduledTask::findOne()->scheduledAt)->same($inOneWeek->format('Y-m-d H:i:s'));
|
||||
}
|
||||
|
||||
public function testItWillRescheduleTaskIfItIsRunningForTooLong() {
|
||||
|
@ -74,8 +74,8 @@ class SendingQueueTest extends \MailPoetTest {
|
||||
$populator->up();
|
||||
$this->subscriber = Subscriber::create();
|
||||
$this->subscriber->email = 'john@doe.com';
|
||||
$this->subscriber->first_name = 'John';
|
||||
$this->subscriber->last_name = 'Doe';
|
||||
$this->subscriber->firstName = 'John';
|
||||
$this->subscriber->lastName = 'Doe';
|
||||
$this->subscriber->status = Subscriber::STATUS_SUBSCRIBED;
|
||||
$this->subscriber->source = 'administrator';
|
||||
$this->subscriber->save();
|
||||
@ -83,8 +83,8 @@ class SendingQueueTest extends \MailPoetTest {
|
||||
$this->segment->name = 'segment';
|
||||
$this->segment->save();
|
||||
$this->subscriberSegment = SubscriberSegment::create();
|
||||
$this->subscriberSegment->subscriber_id = $this->subscriber->id;
|
||||
$this->subscriberSegment->segment_id = (int)$this->segment->id;
|
||||
$this->subscriberSegment->subscriberId = $this->subscriber->id;
|
||||
$this->subscriberSegment->segmentId = (int)$this->segment->id;
|
||||
$this->subscriberSegment->save();
|
||||
$this->newsletter = Newsletter::create();
|
||||
$this->newsletter->type = Newsletter::TYPE_STANDARD;
|
||||
@ -93,17 +93,17 @@ class SendingQueueTest extends \MailPoetTest {
|
||||
$this->newsletter->body = Fixtures::get('newsletter_body_template');
|
||||
$this->newsletter->save();
|
||||
$this->newsletterSegment = NewsletterSegment::create();
|
||||
$this->newsletterSegment->newsletter_id = $this->newsletter->id;
|
||||
$this->newsletterSegment->segment_id = (int)$this->segment->id;
|
||||
$this->newsletterSegment->newsletterId = $this->newsletter->id;
|
||||
$this->newsletterSegment->segmentId = (int)$this->segment->id;
|
||||
$this->newsletterSegment->save();
|
||||
$this->queue = SendingTask::create();
|
||||
$this->queue->newsletter_id = $this->newsletter->id;
|
||||
$this->queue->newsletterId = $this->newsletter->id;
|
||||
$this->queue->setSubscribers([$this->subscriber->id]);
|
||||
$this->queue->count_total = 1;
|
||||
$this->queue->countCotal = 1;
|
||||
$this->queue->save();
|
||||
$this->newsletterLink = NewsletterLink::create();
|
||||
$this->newsletterLink->newsletter_id = $this->newsletter->id;
|
||||
$this->newsletterLink->queue_id = $this->queue->id;
|
||||
$this->newsletterLink->newsletterId = $this->newsletter->id;
|
||||
$this->newsletterLink->queueId = $this->queue->id;
|
||||
$this->newsletterLink->url = '[link:subscription_unsubscribe_url]';
|
||||
$this->newsletterLink->hash = 'abcde';
|
||||
$this->newsletterLink->save();
|
||||
@ -141,9 +141,9 @@ class SendingQueueTest extends \MailPoetTest {
|
||||
}
|
||||
|
||||
public function testItConstructs() {
|
||||
expect($this->sendingQueueWorker->batch_size)->equals(SendingQueueWorker::BATCH_SIZE);
|
||||
expect($this->sendingQueueWorker->mailer_task instanceof MailerTask);
|
||||
expect($this->sendingQueueWorker->newsletter_task instanceof NewsletterTask);
|
||||
expect($this->sendingQueueWorker->batchSize)->equals(SendingQueueWorker::BATCH_SIZE);
|
||||
expect($this->sendingQueueWorker->mailerTask instanceof MailerTask);
|
||||
expect($this->sendingQueueWorker->newsletterTask instanceof NewsletterTask);
|
||||
}
|
||||
|
||||
public function testItEnforcesExecutionLimitsBeforeQueueProcessing() {
|
||||
|
@ -133,7 +133,7 @@ class MailerTest extends \MailPoetTest {
|
||||
]
|
||||
);
|
||||
// mailer instance should be properly configured
|
||||
expect($mailerTask->mailer->mailer_instance instanceof $phpMailClass)
|
||||
expect($mailerTask->mailer->mailerInstance instanceof $phpMailClass)
|
||||
->true();
|
||||
// send method should return true
|
||||
expect($mailerTask->send('Newsletter', 'Subscriber'))->true();
|
||||
|
@ -48,8 +48,8 @@ class NewsletterTest extends \MailPoetTest {
|
||||
$this->newsletterTask = new NewsletterTask();
|
||||
$this->subscriber = Subscriber::create();
|
||||
$this->subscriber->email = 'test@example.com';
|
||||
$this->subscriber->first_name = 'John';
|
||||
$this->subscriber->last_name = 'Doe';
|
||||
$this->subscriber->firstName = 'John';
|
||||
$this->subscriber->lastName = 'Doe';
|
||||
$this->subscriber->save();
|
||||
$this->newsletter = Newsletter::create();
|
||||
$this->newsletter->type = Newsletter::TYPE_STANDARD;
|
||||
@ -72,7 +72,7 @@ class NewsletterTest extends \MailPoetTest {
|
||||
}
|
||||
|
||||
public function testItConstructs() {
|
||||
expect($this->newsletterTask->tracking_enabled)->true();
|
||||
expect($this->newsletterTask->trackingEnabled)->true();
|
||||
}
|
||||
|
||||
public function testItDoesNotGetNewsletterWhenStatusIsNotActiveOrSending() {
|
||||
@ -217,7 +217,7 @@ class NewsletterTest extends \MailPoetTest {
|
||||
|
||||
public function testItSavesNewsletterPosts() {
|
||||
$this->newsletter->type = Newsletter::TYPE_NOTIFICATION_HISTORY;
|
||||
$this->newsletter->parent_id = $this->newsletter->id;
|
||||
$this->newsletter->parentId = $this->newsletter->id;
|
||||
$postsTask = $this->make(PostsTask::class, [
|
||||
'getAlcPostsCount' => 1,
|
||||
'logger_factory' => $this->loggerFactory,
|
||||
@ -314,7 +314,7 @@ class NewsletterTest extends \MailPoetTest {
|
||||
$this->subscriber,
|
||||
$this->queue
|
||||
);
|
||||
expect($result['subject'])->contains($this->subscriber->first_name);
|
||||
expect($result['subject'])->contains($this->subscriber->firstName);
|
||||
expect($result['body']['html'])
|
||||
->contains(Router::NAME . '&endpoint=track&action=click&data=');
|
||||
expect($result['body']['text'])
|
||||
|
@ -61,8 +61,8 @@ class UnsubscribeTokensTest extends \MailPoetTest {
|
||||
$worker->processTaskStrategy(ScheduledTask::createOrUpdate(), microtime(true));
|
||||
$this->newsletterWithToken = Newsletter::findOne($this->newsletterWithToken->id);
|
||||
$this->newsletterWithoutToken = Newsletter::findOne($this->newsletterWithoutToken->id);
|
||||
expect($this->newsletterWithToken->unsubscribe_token)->equals('aaabbbcccdddeee');
|
||||
expect(strlen($this->newsletterWithoutToken->unsubscribe_token))->equals(15);
|
||||
expect($this->newsletterWithToken->unsubscribeToken)->equals('aaabbbcccdddeee');
|
||||
expect(strlen($this->newsletterWithoutToken->unsubscribeToken))->equals(15);
|
||||
}
|
||||
|
||||
public function _after() {
|
||||
|
@ -65,7 +65,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
}
|
||||
|
||||
public function testItsConstructorWorks() {
|
||||
expect($this->mailer->aws_endpoint)
|
||||
expect($this->mailer->awsEndpoint)
|
||||
->equals(
|
||||
sprintf('email.%s.amazonaws.com', $this->settings['region'])
|
||||
);
|
||||
@ -74,7 +74,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
sprintf('https://email.%s.amazonaws.com', $this->settings['region'])
|
||||
);
|
||||
expect(preg_match('!^\d{8}T\d{6}Z$!', $this->mailer->date))->equals(1);
|
||||
expect(preg_match('!^\d{8}$!', $this->mailer->date_without_time))->equals(1);
|
||||
expect(preg_match('!^\d{8}$!', $this->mailer->dateWithoutTime))->equals(1);
|
||||
}
|
||||
|
||||
public function testWhenReturnPathIsNullItIsSetToSenderEmail() {
|
||||
@ -148,7 +148,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
expect($request['timeout'])->equals(10);
|
||||
expect($request['httpversion'])->equals('1.1');
|
||||
expect($request['method'])->equals('POST');
|
||||
expect($request['headers']['Host'])->equals($this->mailer->aws_endpoint);
|
||||
expect($request['headers']['Host'])->equals($this->mailer->awsEndpoint);
|
||||
expect($request['headers']['Authorization'])
|
||||
->equals($this->mailer->signRequest($body));
|
||||
expect($request['headers']['X-Amz-Date'])->equals($this->mailer->date);
|
||||
@ -167,11 +167,11 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
'POST',
|
||||
'/',
|
||||
'',
|
||||
'host:' . $this->mailer->aws_endpoint,
|
||||
'host:' . $this->mailer->awsEndpoint,
|
||||
'x-amz-date:' . $this->mailer->date,
|
||||
'',
|
||||
'host;x-amz-date',
|
||||
hash($this->mailer->hash_algorithm,
|
||||
hash($this->mailer->hashAlgorithm,
|
||||
urldecode(http_build_query($body))
|
||||
),
|
||||
]
|
||||
@ -182,10 +182,10 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
$credentialScope = $this->mailer->getCredentialScope();
|
||||
expect($credentialScope)
|
||||
->equals(
|
||||
$this->mailer->date_without_time . '/' .
|
||||
$this->mailer->aws_region . '/' .
|
||||
$this->mailer->aws_service . '/' .
|
||||
$this->mailer->aws_termination_string
|
||||
$this->mailer->dateWithoutTime . '/' .
|
||||
$this->mailer->awsRegion . '/' .
|
||||
$this->mailer->awsService . '/' .
|
||||
$this->mailer->awsTerminationString
|
||||
);
|
||||
}
|
||||
|
||||
@ -201,10 +201,10 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
expect($stringToSing)
|
||||
->equals(
|
||||
[
|
||||
$this->mailer->aws_signing_algorithm,
|
||||
$this->mailer->awsSigningAlgorithm,
|
||||
$this->mailer->date,
|
||||
$credentialScope,
|
||||
hash($this->mailer->hash_algorithm, $canonicalRequest),
|
||||
hash($this->mailer->hashAlgorithm, $canonicalRequest),
|
||||
]
|
||||
);
|
||||
}
|
||||
@ -214,8 +214,8 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
$signedRequest = $this->mailer->signRequest($body);
|
||||
expect($signedRequest)
|
||||
->contains(
|
||||
$this->mailer->aws_signing_algorithm . ' Credential=' .
|
||||
$this->mailer->aws_access_key . '/' .
|
||||
$this->mailer->awsSigningAlgorithm . ' Credential=' .
|
||||
$this->mailer->awsAccessKey . '/' .
|
||||
$this->mailer->getCredentialScope() . ', ' .
|
||||
'SignedHeaders=host;x-amz-date, Signature='
|
||||
);
|
||||
@ -225,7 +225,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
|
||||
public function testItCannotSendWithoutProperAccessKey() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$this->mailer->aws_access_key = 'somekey';
|
||||
$this->mailer->awsAccessKey = 'somekey';
|
||||
$result = $this->mailer->send(
|
||||
$this->newsletter,
|
||||
$this->subscriber
|
||||
|
@ -140,8 +140,8 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
|
||||
public function testItWillNotSendIfApiKeyIsMarkedInvalid() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$this->mailer->api_key = 'someapi';
|
||||
$this->mailer->services_checker = Stub::make(
|
||||
$this->mailer->apiKey = 'someapi';
|
||||
$this->mailer->servicesChecker = Stub::make(
|
||||
new ServicesChecker(),
|
||||
['isMailPoetAPIKeyValid' => false],
|
||||
$this
|
||||
|
@ -85,7 +85,7 @@ class SendGridTest extends \MailPoetTest {
|
||||
|
||||
public function testItCannotSendWithoutProperApiKey() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$this->mailer->api_key = 'someapi';
|
||||
$this->mailer->apiKey = 'someapi';
|
||||
$result = $this->mailer->send(
|
||||
$this->newsletter,
|
||||
$this->subscriber
|
||||
|
@ -15,8 +15,8 @@ class SendingQueueTest extends \MailPoetTest {
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->queue = SendingQueue::create();
|
||||
$this->queue->task_id = 0;
|
||||
$this->queue->newsletter_id = 1;
|
||||
$this->queue->taskId = 0;
|
||||
$this->queue->newsletterId = 1;
|
||||
$this->queue->save();
|
||||
|
||||
$this->renderedBody = [
|
||||
|
@ -759,15 +759,15 @@ class SubscriberTest extends \MailPoetTest {
|
||||
$subscriber[$i] = Subscriber::create();
|
||||
$subscriber[$i]->status = Subscriber::STATUS_SUBSCRIBED;
|
||||
$subscriber[$i]->email = $i . '@test.com';
|
||||
$subscriber[$i]->first_name = 'first ' . $i;
|
||||
$subscriber[$i]->last_name = 'last ' . $i;
|
||||
$subscriber[$i]->firstName = 'first ' . $i;
|
||||
$subscriber[$i]->lastName = 'last ' . $i;
|
||||
$subscriber[$i]->save();
|
||||
$segment[$i] = Segment::create();
|
||||
$segment[$i]->name = 'segment ' . $i;
|
||||
$segment[$i]->save();
|
||||
$subscriberSegment[$i] = SubscriberSegment::create();
|
||||
$subscriberSegment[$i]->subscriber_id = $subscriber[$i]->id;
|
||||
$subscriberSegment[$i]->segment_id = (int)$segment[$i]->id;
|
||||
$subscriberSegment[$i]->subscriberId = $subscriber[$i]->id;
|
||||
$subscriberSegment[$i]->segmentId = (int)$segment[$i]->id;
|
||||
$subscriberSegment[$i]->save();
|
||||
}
|
||||
return [
|
||||
|
@ -566,8 +566,8 @@ class RendererTest extends \MailPoetTest {
|
||||
|
||||
public function testItDoesNotAddMailpoetLogoWhenPremiumIsActive() {
|
||||
$this->renderer->preview = false;
|
||||
$this->renderer->mss_activated = false;
|
||||
$this->renderer->premium_activated = true;
|
||||
$this->renderer->mssActivated = false;
|
||||
$this->renderer->premiumActivated = true;
|
||||
|
||||
$this->renderer->newsletter['body'] = json_decode(Fixtures::get('newsletter_body_template'), true);
|
||||
$template = $this->renderer->render();
|
||||
@ -576,8 +576,8 @@ class RendererTest extends \MailPoetTest {
|
||||
|
||||
public function testItDoesNotAddMailpoetLogoWhenMSSIsActive() {
|
||||
$this->renderer->preview = false;
|
||||
$this->renderer->premium_activated = false;
|
||||
$this->renderer->mss_activated = true;
|
||||
$this->renderer->premiumActivated = false;
|
||||
$this->renderer->mssActivated = true;
|
||||
|
||||
$this->renderer->newsletter['body'] = json_decode(Fixtures::get('newsletter_body_template'), true);
|
||||
$template = $this->renderer->render();
|
||||
@ -585,8 +585,8 @@ class RendererTest extends \MailPoetTest {
|
||||
}
|
||||
|
||||
public function testItDoesNotAddMailpoetLogoWhenPreviewIsEnabled() {
|
||||
$this->renderer->mss_activated = false;
|
||||
$this->renderer->premium_activated = false;
|
||||
$this->renderer->mssActivated = false;
|
||||
$this->renderer->premiumActivated = false;
|
||||
$this->renderer->preview = true;
|
||||
|
||||
$this->renderer->newsletter['body'] = json_decode(Fixtures::get('newsletter_body_template'), true);
|
||||
@ -596,8 +596,8 @@ class RendererTest extends \MailPoetTest {
|
||||
|
||||
public function testItAddsMailpoetLogo() {
|
||||
$this->renderer->newsletter['body'] = json_decode(Fixtures::get('newsletter_body_template'), true);
|
||||
$this->renderer->mss_activated = false;
|
||||
$this->renderer->premium_activated = false;
|
||||
$this->renderer->mssActivated = false;
|
||||
$this->renderer->premiumActivated = false;
|
||||
$this->renderer->preview = false;
|
||||
|
||||
$template = $this->renderer->render();
|
||||
|
@ -110,9 +110,9 @@ class ExportTest extends \MailPoetTest {
|
||||
}
|
||||
|
||||
public function testItCanConstruct() {
|
||||
expect($this->export->export_format_option)
|
||||
expect($this->export->exportFormatOption)
|
||||
->equals('csv');
|
||||
expect($this->export->subscriber_fields)
|
||||
expect($this->export->subscriberFields)
|
||||
->equals(
|
||||
[
|
||||
'email',
|
||||
@ -120,28 +120,28 @@ class ExportTest extends \MailPoetTest {
|
||||
'1',
|
||||
]
|
||||
);
|
||||
expect($this->export->subscriber_custom_fields)
|
||||
expect($this->export->subscriberCustomFields)
|
||||
->equals($this->export->getSubscriberCustomFields());
|
||||
expect($this->export->formatted_subscriber_fields)
|
||||
expect($this->export->formattedSubscriberFields)
|
||||
->equals(
|
||||
$this->export->formatSubscriberFields(
|
||||
$this->export->subscriber_fields,
|
||||
$this->export->subscriber_custom_fields
|
||||
$this->export->subscriberFields,
|
||||
$this->export->subscriberCustomFields
|
||||
)
|
||||
);
|
||||
expect(
|
||||
preg_match(
|
||||
'|' .
|
||||
preg_quote(Env::$tempPath, '|') . '/MailPoet_export_[a-z0-9]{15}.' .
|
||||
$this->export->export_format_option .
|
||||
'|', $this->export->export_file)
|
||||
$this->export->exportFormatOption .
|
||||
'|', $this->export->exportFile)
|
||||
)->equals(1);
|
||||
expect(
|
||||
preg_match(
|
||||
'|' .
|
||||
preg_quote(Env::$tempUrl, '|') . '/' .
|
||||
basename($this->export->export_file) .
|
||||
'|', $this->export->export_file_URL)
|
||||
basename($this->export->exportFile) .
|
||||
'|', $this->export->exportFileURL)
|
||||
)->equals(1);
|
||||
}
|
||||
|
||||
@ -172,28 +172,28 @@ class ExportTest extends \MailPoetTest {
|
||||
}
|
||||
|
||||
public function testItCanGetSubscribers() {
|
||||
$this->export->default_subscribers_getter = new DefaultSubscribersGetter([1], 100);
|
||||
$this->export->defaultSubscribersGetter = new DefaultSubscribersGetter([1], 100);
|
||||
$subscribers = $this->export->getSubscribers();
|
||||
expect($subscribers)->count(2);
|
||||
|
||||
$this->export->default_subscribers_getter = new DefaultSubscribersGetter([2], 100);
|
||||
$this->export->defaultSubscribersGetter = new DefaultSubscribersGetter([2], 100);
|
||||
$subscribers = $this->export->getSubscribers();
|
||||
expect($subscribers)->count(2);
|
||||
|
||||
$this->export->default_subscribers_getter = new DefaultSubscribersGetter([1, 2], 100);
|
||||
$this->export->defaultSubscribersGetter = new DefaultSubscribersGetter([1, 2], 100);
|
||||
$subscribers = $this->export->getSubscribers();
|
||||
expect($subscribers)->count(4);
|
||||
|
||||
}
|
||||
|
||||
public function testItAlwaysGroupsSubscribersBySegments() {
|
||||
$this->export->default_subscribers_getter = new DefaultSubscribersGetter([0, 1, 2], 100);
|
||||
$this->export->defaultSubscribersGetter = new DefaultSubscribersGetter([0, 1, 2], 100);
|
||||
$subscribers = $this->export->getSubscribers();
|
||||
expect($subscribers)->count(5);
|
||||
}
|
||||
|
||||
public function testItCanGetSubscribersOnlyWithoutSegments() {
|
||||
$this->export->default_subscribers_getter = new DefaultSubscribersGetter([0], 100);
|
||||
$this->export->defaultSubscribersGetter = new DefaultSubscribersGetter([0], 100);
|
||||
$subscribers = $this->export->getSubscribers();
|
||||
expect($subscribers)->count(1);
|
||||
expect($subscribers[0]['segment_name'])->equals('Not In Segment');
|
||||
@ -201,7 +201,7 @@ class ExportTest extends \MailPoetTest {
|
||||
|
||||
public function testItRequiresWritableExportFile() {
|
||||
try {
|
||||
$this->export->export_path = '/fake_folder';
|
||||
$this->export->exportPath = '/fake_folder';
|
||||
$this->export->process();
|
||||
$this->fail('Export did not throw an exception');
|
||||
} catch (\Exception $e) {
|
||||
@ -212,8 +212,8 @@ class ExportTest extends \MailPoetTest {
|
||||
|
||||
public function testItCanProcess() {
|
||||
try {
|
||||
$this->export->export_file = $this->export->getExportFile('csv');
|
||||
$this->export->export_format_option = 'csv';
|
||||
$this->export->exportFile = $this->export->getExportFile('csv');
|
||||
$this->export->exportFormatOption = 'csv';
|
||||
$result = $this->export->process();
|
||||
} catch (\Exception $e) {
|
||||
$this->fail('Export to .csv process threw an exception');
|
||||
@ -222,8 +222,8 @@ class ExportTest extends \MailPoetTest {
|
||||
expect($result['exportFileURL'])->notEmpty();
|
||||
|
||||
try {
|
||||
$this->export->export_file = $this->export->getExportFile('xlsx');
|
||||
$this->export->export_format_option = 'xlsx';
|
||||
$this->export->exportFile = $this->export->getExportFile('xlsx');
|
||||
$this->export->exportFormatOption = 'xlsx';
|
||||
$result = $this->export->process();
|
||||
} catch (\Exception $e) {
|
||||
$this->fail('Export to .xlsx process threw an exception');
|
||||
|
@ -66,13 +66,13 @@ class ImportTest extends \MailPoetTest {
|
||||
}
|
||||
|
||||
public function testItConstructs() {
|
||||
expect(is_array($this->import->subscribers_data))->true();
|
||||
expect($this->import->segments_ids)->equals($this->testData['segments']);
|
||||
expect(is_array($this->import->subscribers_fields))->true();
|
||||
expect(is_array($this->import->subscribers_custom_fields))->true();
|
||||
expect($this->import->subscribers_count)->equals(2);
|
||||
expect($this->import->created_at)->notEmpty();
|
||||
expect($this->import->updated_at)->notEmpty();
|
||||
expect(is_array($this->import->subscribersData))->true();
|
||||
expect($this->import->segmentsIds)->equals($this->testData['segments']);
|
||||
expect(is_array($this->import->subscribersFields))->true();
|
||||
expect(is_array($this->import->subscribersCustomFields))->true();
|
||||
expect($this->import->subscribersCount)->equals(2);
|
||||
expect($this->import->createdAt)->notEmpty();
|
||||
expect($this->import->updatedAt)->notEmpty();
|
||||
}
|
||||
|
||||
public function testItChecksForRequiredDataFields() {
|
||||
@ -151,13 +151,13 @@ class ImportTest extends \MailPoetTest {
|
||||
|
||||
public function testItTransformsSubscribers() {
|
||||
$customField = $this->subscribersCustomFields[0];
|
||||
expect($this->import->subscribers_data['first_name'][0])
|
||||
expect($this->import->subscribersData['first_name'][0])
|
||||
->equals($this->testData['subscribers'][0][0]);
|
||||
expect($this->import->subscribers_data['last_name'][0])
|
||||
expect($this->import->subscribersData['last_name'][0])
|
||||
->equals($this->testData['subscribers'][0][1]);
|
||||
expect($this->import->subscribers_data['email'][0])
|
||||
expect($this->import->subscribersData['email'][0])
|
||||
->equals($this->testData['subscribers'][0][2]);
|
||||
expect($this->import->subscribers_data[$customField][0])
|
||||
expect($this->import->subscribersData[$customField][0])
|
||||
->equals($this->testData['subscribers'][0][3]);
|
||||
}
|
||||
|
||||
@ -405,7 +405,7 @@ class ImportTest extends \MailPoetTest {
|
||||
expect($result['updated'])->equals(0);
|
||||
$result = $this->import->process();
|
||||
expect($result['updated'])->equals(2);
|
||||
$this->import->update_subscribers = false;
|
||||
$this->import->updateSubscribers = false;
|
||||
$result = $this->import->process();
|
||||
expect($result['updated'])->equals(0);
|
||||
}
|
||||
@ -496,8 +496,8 @@ class ImportTest extends \MailPoetTest {
|
||||
->findOne()
|
||||
->delete();
|
||||
$timestamp = time() + 1;
|
||||
$this->import->created_at = $this->import->required_subscribers_fields['created_at'] = date('Y-m-d H:i:s', $timestamp);
|
||||
$this->import->updated_at = date('Y-m-d H:i:s', $timestamp + 1);
|
||||
$this->import->createdAt = $this->import->requiredSubscribersFields['created_at'] = date('Y-m-d H:i:s', $timestamp);
|
||||
$this->import->updatedAt = date('Y-m-d H:i:s', $timestamp + 1);
|
||||
$result = $this->import->process();
|
||||
expect($result['created'])->equals(1);
|
||||
$dbSubscribers = array_column(
|
||||
|
@ -30,7 +30,7 @@ class ConflictResolverTest extends \MailPoetTest {
|
||||
public function testItUnloadsAllStylesFromLocationsNotOnPermittedList() {
|
||||
expect(!empty($this->wpFilter['mailpoet_conflict_resolver_styles']))->true();
|
||||
// grab a random permitted style location
|
||||
$permittedAssetLocation = $this->conflictResolver->permitted_assets_locations['styles'][array_rand($this->conflictResolver->permitted_assets_locations['styles'], 1)];
|
||||
$permittedAssetLocation = $this->conflictResolver->permittedAssetsLocations['styles'][array_rand($this->conflictResolver->permittedAssetsLocations['styles'], 1)];
|
||||
// enqueue styles
|
||||
wp_enqueue_style('select2', '/wp-content/some/offending/plugin/select2.css');
|
||||
wp_enqueue_style('permitted_style', trim($permittedAssetLocation, '^'));
|
||||
@ -68,7 +68,7 @@ class ConflictResolverTest extends \MailPoetTest {
|
||||
public function testItUnloadsAllScriptsFromLocationsNotOnPermittedList() {
|
||||
expect(!empty($this->wpFilter['mailpoet_conflict_resolver_scripts']))->true();
|
||||
// grab a random permitted script location
|
||||
$permittedAssetLocation = $this->conflictResolver->permitted_assets_locations['scripts'][array_rand($this->conflictResolver->permitted_assets_locations['scripts'], 1)];
|
||||
$permittedAssetLocation = $this->conflictResolver->permittedAssetsLocations['scripts'][array_rand($this->conflictResolver->permittedAssetsLocations['scripts'], 1)];
|
||||
// enqueue scripts
|
||||
wp_enqueue_script('select2', '/wp-content/some/offending/plugin/select2.js');
|
||||
wp_enqueue_script('some_random_script', 'http://example.com/some_script.js', [], null, $inFooter = true); // test inside footer
|
||||
|
@ -107,7 +107,7 @@ class SubscriptionTest extends \MailPoetTest {
|
||||
$subscribed = $this->subscription->subscribeOnCheckout($this->orderId, $data);
|
||||
expect($subscribed)->equals(null);
|
||||
// not a WooCommerce user
|
||||
$this->subscriber->is_woocommerce_user = 0;
|
||||
$this->subscriber->isWoocommerceUser = 0;
|
||||
$this->subscriber->save();
|
||||
$data['billing_email'] = $this->subscriber->email;
|
||||
$subscribed = $this->subscription->subscribeOnCheckout($this->orderId, $data);
|
||||
|
Reference in New Issue
Block a user