Add public keyword to methods
[MAILPOET-2413]
This commit is contained in:
@@ -11,7 +11,7 @@ use MailPoet\Subscribers\ImportExport\Import\Import;
|
||||
use MailPoetVendor\Idiorm\ORM;
|
||||
|
||||
class ImportTest extends \MailPoetTest {
|
||||
function _before() {
|
||||
public function _before() {
|
||||
$custom_field = CustomField::create();
|
||||
$custom_field->name = 'country';
|
||||
$custom_field->type = 'text';
|
||||
@@ -58,7 +58,7 @@ class ImportTest extends \MailPoetTest {
|
||||
);
|
||||
}
|
||||
|
||||
function testItConstructs() {
|
||||
public function testItConstructs() {
|
||||
expect(is_array($this->import->subscribers_data))->true();
|
||||
expect($this->import->segments_ids)->equals($this->test_data['segments']);
|
||||
expect(is_array($this->import->subscribers_fields))->true();
|
||||
@@ -68,7 +68,7 @@ class ImportTest extends \MailPoetTest {
|
||||
expect($this->import->updated_at)->notEmpty();
|
||||
}
|
||||
|
||||
function testItChecksForRequiredDataFields() {
|
||||
public function testItChecksForRequiredDataFields() {
|
||||
$data = $this->test_data;
|
||||
// exception should be thrown when one or more fields do not exist
|
||||
unset($data['timestamp']);
|
||||
@@ -82,7 +82,7 @@ class ImportTest extends \MailPoetTest {
|
||||
$this->import->validateImportData($this->test_data);
|
||||
}
|
||||
|
||||
function testItValidatesColumnNames() {
|
||||
public function testItValidatesColumnNames() {
|
||||
$data = $this->test_data;
|
||||
$data['columns']['test) values ((ExtractValue(1,CONCAT(0x5c, (SELECT version())))))%23'] = true;
|
||||
try {
|
||||
@@ -93,7 +93,7 @@ class ImportTest extends \MailPoetTest {
|
||||
}
|
||||
}
|
||||
|
||||
function testItValidatesSubscribersEmail() {
|
||||
public function testItValidatesSubscribersEmail() {
|
||||
$validation_rules = ['email' => 'email'];
|
||||
|
||||
// invalid email is removed from data object
|
||||
@@ -114,7 +114,7 @@ class ImportTest extends \MailPoetTest {
|
||||
expect($result)->equals($data);
|
||||
}
|
||||
|
||||
function testItThrowsErrorWhenNoValidSubscribersAreFoundDuringImport() {
|
||||
public function testItThrowsErrorWhenNoValidSubscribersAreFoundDuringImport() {
|
||||
$data = [
|
||||
'subscribers' => [
|
||||
[
|
||||
@@ -142,7 +142,7 @@ class ImportTest extends \MailPoetTest {
|
||||
}
|
||||
}
|
||||
|
||||
function testItTransformsSubscribers() {
|
||||
public function testItTransformsSubscribers() {
|
||||
$custom_field = $this->subscribers_custom_fields[0];
|
||||
expect($this->import->subscribers_data['first_name'][0])
|
||||
->equals($this->test_data['subscribers'][0][0]);
|
||||
@@ -154,7 +154,7 @@ class ImportTest extends \MailPoetTest {
|
||||
->equals($this->test_data['subscribers'][0][3]);
|
||||
}
|
||||
|
||||
function testItSplitsSubscribers() {
|
||||
public function testItSplitsSubscribers() {
|
||||
$subscribers_data = $this->subscribers_data;
|
||||
$subscribers_data_existing = [
|
||||
[
|
||||
@@ -188,7 +188,7 @@ class ImportTest extends \MailPoetTest {
|
||||
expect($wp_users)->equals([$subscribers_data_existing[0]['wp_user_id']]);
|
||||
}
|
||||
|
||||
function testItAddsMissingRequiredFieldsToSubscribersObject() {
|
||||
public function testItAddsMissingRequiredFieldsToSubscribersObject() {
|
||||
$data = [
|
||||
'subscribers' => [
|
||||
[
|
||||
@@ -228,7 +228,7 @@ class ImportTest extends \MailPoetTest {
|
||||
expect($result['data']['created_at'][0])->equals($import->created_at);
|
||||
}
|
||||
|
||||
function testItGetsSubscriberFields() {
|
||||
public function testItGetsSubscriberFields() {
|
||||
$data = [
|
||||
'one',
|
||||
'two',
|
||||
@@ -242,7 +242,7 @@ class ImportTest extends \MailPoetTest {
|
||||
]);
|
||||
}
|
||||
|
||||
function testItGetsCustomSubscribersFields() {
|
||||
public function testItGetsCustomSubscribersFields() {
|
||||
$data = [
|
||||
'one',
|
||||
'two',
|
||||
@@ -252,7 +252,7 @@ class ImportTest extends \MailPoetTest {
|
||||
expect($fields)->equals([39]);
|
||||
}
|
||||
|
||||
function testItAddsOrUpdatesSubscribers() {
|
||||
public function testItAddsOrUpdatesSubscribers() {
|
||||
$subscribers_data = [
|
||||
'data' => $this->subscribers_data,
|
||||
'fields' => $this->subscribers_fields,
|
||||
@@ -276,7 +276,7 @@ class ImportTest extends \MailPoetTest {
|
||||
->equals($subscribers_data['data']['first_name'][1]);
|
||||
}
|
||||
|
||||
function testItDeletesTrashedSubscribers() {
|
||||
public function testItDeletesTrashedSubscribers() {
|
||||
$subscribers_data = [
|
||||
'data' => $this->subscribers_data,
|
||||
'fields' => $this->subscribers_fields,
|
||||
@@ -311,7 +311,7 @@ class ImportTest extends \MailPoetTest {
|
||||
expect(count($db_subscribers))->equals(1);
|
||||
}
|
||||
|
||||
function testItCreatesOrUpdatesCustomFields() {
|
||||
public function testItCreatesOrUpdatesCustomFields() {
|
||||
$subscribers_data = [
|
||||
'data' => $this->subscribers_data,
|
||||
'fields' => $this->subscribers_fields,
|
||||
@@ -345,7 +345,7 @@ class ImportTest extends \MailPoetTest {
|
||||
->equals($subscribers_data['data'][$custom_field][1]);
|
||||
}
|
||||
|
||||
function testItAddsSubscribersToSegments() {
|
||||
public function testItAddsSubscribersToSegments() {
|
||||
$subscribers_data = [
|
||||
'data' => $this->subscribers_data,
|
||||
'fields' => $this->subscribers_fields,
|
||||
@@ -377,7 +377,7 @@ class ImportTest extends \MailPoetTest {
|
||||
}
|
||||
}
|
||||
|
||||
function testItDeletesExistingTrashedSubscribers() {
|
||||
public function testItDeletesExistingTrashedSubscribers() {
|
||||
$subscribers_data = [
|
||||
'data' => $this->subscribers_data,
|
||||
'fields' => $this->subscribers_fields,
|
||||
@@ -393,7 +393,7 @@ class ImportTest extends \MailPoetTest {
|
||||
);
|
||||
}
|
||||
|
||||
function testItUpdatesSubscribers() {
|
||||
public function testItUpdatesSubscribers() {
|
||||
$result = $this->import->process();
|
||||
expect($result['updated'])->equals(0);
|
||||
$result = $this->import->process();
|
||||
@@ -403,7 +403,7 @@ class ImportTest extends \MailPoetTest {
|
||||
expect($result['updated'])->equals(0);
|
||||
}
|
||||
|
||||
function testItDoesNotUpdateExistingSubscribersStatusWhenStatusColumnIsNotPresent() {
|
||||
public function testItDoesNotUpdateExistingSubscribersStatusWhenStatusColumnIsNotPresent() {
|
||||
$subscriber = Subscriber::create();
|
||||
$subscriber->hydrate(
|
||||
[
|
||||
@@ -418,7 +418,7 @@ class ImportTest extends \MailPoetTest {
|
||||
expect($updated_subscriber->status)->equals('unsubscribed');
|
||||
}
|
||||
|
||||
function testItDoesNotUpdateExistingSubscribersStatusWhenStatusColumnIsPresent() {
|
||||
public function testItDoesNotUpdateExistingSubscribersStatusWhenStatusColumnIsPresent() {
|
||||
$data = $this->test_data;
|
||||
$data['columns']['status'] = ['index' => 4];
|
||||
$data['subscribers'][0][] = 'subscribed';
|
||||
@@ -438,7 +438,7 @@ class ImportTest extends \MailPoetTest {
|
||||
expect($updated_subscriber->status)->equals('unsubscribed');
|
||||
}
|
||||
|
||||
function testItImportsNewsSubscribersWithAllAdditionalParameters() {
|
||||
public function testItImportsNewsSubscribersWithAllAdditionalParameters() {
|
||||
$data = $this->test_data;
|
||||
$data['columns']['status'] = ['index' => 4];
|
||||
$data['subscribers'][0][] = 'unsubscribed';
|
||||
@@ -462,7 +462,7 @@ class ImportTest extends \MailPoetTest {
|
||||
expect($new_subscribers[1]->last_subscribed_at)->equals($test_time);
|
||||
}
|
||||
|
||||
function testItDoesNotUpdateExistingSubscribersLastSubscribedAtWhenItIsPresent() {
|
||||
public function testItDoesNotUpdateExistingSubscribersLastSubscribedAtWhenItIsPresent() {
|
||||
$data = $this->test_data;
|
||||
$data['columns']['last_subscribed_at'] = ['index' => 4];
|
||||
$data['subscribers'][0][] = '2018-12-12 12:12:00';
|
||||
@@ -482,7 +482,7 @@ class ImportTest extends \MailPoetTest {
|
||||
expect($updated_subscriber->last_subscribed_at)->equals('2017-12-12 12:12:00');
|
||||
}
|
||||
|
||||
function testItRunsImport() {
|
||||
public function testItRunsImport() {
|
||||
$result = $this->import->process();
|
||||
expect($result['created'])->equals(2);
|
||||
Subscriber::where('email', 'mary@jane.com')
|
||||
@@ -506,7 +506,7 @@ class ImportTest extends \MailPoetTest {
|
||||
}
|
||||
}
|
||||
|
||||
function _after() {
|
||||
public function _after() {
|
||||
ORM::raw_execute('TRUNCATE ' . Subscriber::$_table);
|
||||
ORM::raw_execute('TRUNCATE ' . Segment::$_table);
|
||||
ORM::raw_execute('TRUNCATE ' . SubscriberSegment::$_table);
|
||||
|
Reference in New Issue
Block a user