Fix extra arguments in method calls [MAILPOET-2488]

This commit is contained in:
wxa
2019-12-20 10:23:45 +03:00
committed by amine-mp
parent ce719433e8
commit 7285a4a075
12 changed files with 40 additions and 71 deletions

View File

@@ -100,6 +100,7 @@ use MailPoet\WP\Functions as WPFunctions;
* @method bool setExpr($key, $value = null)
* @method bool isDirty($key)
* @method static static filter(...$args)
* @method array asArray(...$args)
* @method $this hasMany($associated_class_name, $foreign_key_name=null, $foreign_key_name_in_current_models_table=null, $connection_name=null)
* @method $this hasManyThrough($associated_class_name, $join_class_name=null, $key_to_base_table=null, $key_to_associated_table=null, $key_in_base_table=null, $key_in_associated_table=null, $connection_name=null)
* @method mixed hasOne($associated_class_name, $foreign_key_name=null, $foreign_key_name_in_current_models_table=null, $connection_name=null)

View File

@@ -189,8 +189,7 @@ class NewslettersTest extends \MailPoetTest {
Emoji::class,
['encodeForUTF8Column' => Expected::once(function ($params) {
return $params;
})],
$this
})]
);
$wp = Stub::make(new WPFunctions, [
@@ -939,8 +938,7 @@ class NewslettersTest extends \MailPoetTest {
Emoji::class,
['encodeForUTF8Column' => Expected::once(function ($params) {
return $params;
})],
$this
})]
);
$wp = Stub::make(new WPFunctions, [

View File

@@ -31,8 +31,7 @@ class ServicesTest extends \MailPoetTest {
$spf_check = $this->make(
SPFCheck::class,
['checkSPFRecord' => false],
$this
['checkSPFRecord' => false]
);
$services_endpoint = $this->createServicesEndpointWithMockedSPFCheck($spf_check);
@@ -44,8 +43,7 @@ class ServicesTest extends \MailPoetTest {
public function testItRespondsWithSuccessIfSPFCheckPasses() {
$spf_check = $this->make(
SPFCheck::class,
['checkSPFRecord' => true],
$this
['checkSPFRecord' => true]
);
$services_endpoint = $this->createServicesEndpointWithMockedSPFCheck($spf_check);
@@ -65,8 +63,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkMSSKey' => ['state' => Bridge::KEY_VALID],
'storeMSSKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -80,8 +77,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkMSSKey' => ['state' => Bridge::KEY_INVALID],
'storeMSSKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
$response = $services_endpoint->checkMSSKey($this->data);
@@ -98,8 +94,7 @@ class ServicesTest extends \MailPoetTest {
'data' => ['expire_at' => $date->format('c')],
],
'storeMSSKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -115,8 +110,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkMSSKey' => ['code' => Bridge::CHECK_ERROR_UNAVAILABLE],
'storeMSSKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -135,8 +129,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkMSSKey' => null,
'storeMSSKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -155,8 +148,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkMSSKey' => ['code' => 404],
'storeMSSKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -173,8 +165,7 @@ class ServicesTest extends \MailPoetTest {
throw new \Exception('test');
},
'storeMSSKeyAndState' => Expected::never(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -195,8 +186,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkPremiumKey' => ['state' => Bridge::KEY_VALID],
'storePremiumKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -213,8 +203,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkPremiumKey' => ['state' => Bridge::KEY_INVALID],
'storePremiumKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -228,8 +217,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkPremiumKey' => ['state' => Bridge::KEY_ALREADY_USED],
'storePremiumKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -247,8 +235,7 @@ class ServicesTest extends \MailPoetTest {
'data' => ['expire_at' => $date->format('c')],
],
'storePremiumKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -264,8 +251,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkPremiumKey' => ['code' => Bridge::CHECK_ERROR_UNAVAILABLE],
'storePremiumKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -284,8 +270,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkPremiumKey' => null,
'storePremiumKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -304,8 +289,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkPremiumKey' => ['code' => 404],
'storePremiumKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -322,8 +306,7 @@ class ServicesTest extends \MailPoetTest {
throw new \Exception('test');
},
'storePremiumKeyAndState' => Expected::never(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -345,8 +328,7 @@ class ServicesTest extends \MailPoetTest {
'data' => [ 'public_id' => $fake_public_id ],
],
'storeMSSKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -365,8 +347,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkMSSKey' => [ 'state' => Bridge::KEY_VALID ],
'storeMSSKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -389,8 +370,7 @@ class ServicesTest extends \MailPoetTest {
'data' => [ 'public_id' => $fake_public_id ],
],
'storePremiumKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);
@@ -409,8 +389,7 @@ class ServicesTest extends \MailPoetTest {
[
'checkPremiumKey' => ['state' => Bridge::KEY_VALID],
'storePremiumKeyAndState' => Expected::once(),
],
$this
]
);
$services_endpoint = $this->createServicesEndpointWithMockedBridge($bridge);

View File

@@ -57,7 +57,7 @@ class FirstPurchaseTest extends \MailPoetTest {
public function testDateShortcodeHandlerReturnsCurrentDateWhenDateIsMissingInQueueMeta() {
$event = new FirstPurchase();
$shortcode = $event::ORDER_DATE_SHORTCODE;
$queue = SendingQueue::create(['task_id' => 1]);
$queue = SendingQueue::create();
WPFunctions::set(Stub::make(new WPFunctions, [
'dateI18n' => 'success',
@@ -69,7 +69,7 @@ class FirstPurchaseTest extends \MailPoetTest {
public function testDateShortcodeHandlerReturnsSystemFormattedDate() {
$event = new FirstPurchase();
$shortcode = $event::ORDER_DATE_SHORTCODE;
$queue = SendingQueue::create(['task_id' => 1]);
$queue = SendingQueue::create();
WPFunctions::set(Stub::make(new WPFunctions, [
'dateI18n' => 'success',
]));
@@ -105,7 +105,7 @@ class FirstPurchaseTest extends \MailPoetTest {
]);
$event = new FirstPurchase($helper);
$shortcode = $event::ORDER_TOTAL_SHORTCODE;
$queue = SendingQueue::create(['task_id' => 1]);
$queue = SendingQueue::create();
$result = $event->handleOrderTotalShortcode($shortcode, true, true, $queue);
expect($result)->equals(0);
}
@@ -118,7 +118,7 @@ class FirstPurchaseTest extends \MailPoetTest {
]);
$event = new FirstPurchase($helper);
$shortcode = $event::ORDER_TOTAL_SHORTCODE;
$queue = SendingQueue::create(['task_id' => 1]);
$queue = SendingQueue::create();
$queue->meta = ['order_amount' => 15];
$result = $event->handleOrderTotalShortcode($shortcode, true, true, $queue);
expect($result)->equals(15);

View File

@@ -267,7 +267,7 @@ class SendingQueueTest extends \MailPoetTest {
// queue no longer exists
$this->sending_queue_worker->process();
$queue = SendingQueue::findOne($this->queue->id);
expect($queue)->false(false);
expect($queue)->false();
}
public function testItPassesExtraParametersToMailerWhenTrackingIsDisabled() {

View File

@@ -290,8 +290,7 @@ class NewsletterTest extends \MailPoetTest {
Emoji::class,
['decodeEmojisInBody' => Expected::once(function ($params) {
return $params;
})],
$this
})]
);
$newsletter_task = new NewsletterTask(null, null, null, $emoji);
$result = $newsletter_task->prepareNewsletterForSending(
@@ -437,8 +436,7 @@ class NewsletterTest extends \MailPoetTest {
Emoji::class,
['encodeEmojisInBody' => Expected::once(function ($params) {
return $params;
})],
$this
})]
);
$newsletter_task = new NewsletterTask(null, null, null, $emoji);
expect($newsletter_task->preProcessNewsletter($this->newsletter, $queue_mock))->equals($this->newsletter);

View File

@@ -264,8 +264,7 @@ class MailPoetAPITest extends \MailPoetTest {
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
'status' => API::SENDING_STATUS_SEND_ERROR,
'message' => MailerError::MESSAGE_EMAIL_NOT_AUTHORIZED,
]],
$this
]]
);
$mailer->send([$this->newsletter], [$this->subscriber]);
}

View File

@@ -248,8 +248,7 @@ class PostContentTransformerTest extends \MailPoetTest {
'getContent' => Expected::once($this->content_mock),
'getFeaturedImage' => null,
'getTitle' => 'Title',
],
$this
]
);
$extractor->expects($this->once())
->method('getContent')
@@ -279,8 +278,7 @@ class PostContentTransformerTest extends \MailPoetTest {
'getContent' => Expected::once($this->content_mock),
'getFeaturedImage' => null,
'getTitle' => 'Title',
],
$this
]
);
$extractor->expects($this->once())
->method('getContent')
@@ -305,8 +303,7 @@ class PostContentTransformerTest extends \MailPoetTest {
'getFeaturedImage' => $image,
'getTitle' => $title,
'isProduct' => false,
],
$this
]
);
$transformer = new PostTransformer($args, $extractor);
return $transformer;

View File

@@ -530,7 +530,7 @@ class RendererTest extends \MailPoetTest {
'iconType' => 'custom',
],
];
$rendered_block = Social::render($block, self::COLUMN_BASE_WIDTH);
$rendered_block = Social::render($block);
expect($rendered_block)->equals('');
}

View File

@@ -132,8 +132,7 @@ class ViewInBrowserTest extends \MailPoetTest {
Emoji::class,
['decodeEmojisInBody' => Expected::once(function ($params) {
return $params;
})],
$this
})]
);
$view_in_browser = new ViewInBrowser($emoji, false);
$rendered_body = $view_in_browser->renderNewsletter(

View File

@@ -26,8 +26,7 @@ class EmojiTest extends \MailPoetTest {
Emoji::class,
['encodeForUTF8Column' => Expected::exactly(3, function ($params) {
return $params;
})],
$this
})]
);
$emoji->encodeEmojisInBody(['text' => 'call 1', 'html' => 'call 2']);
$emoji->encodeEmojisInBody('string, call 3');
@@ -38,8 +37,7 @@ class EmojiTest extends \MailPoetTest {
Emoji::class,
['decodeEntities' => Expected::exactly(3, function ($params) {
return $params;
})],
$this
})]
);
$emoji->decodeEmojisInBody(['text' => 'call 1', 'html' => 'call 2']);
$emoji->decodeEmojisInBody('string, call 3');

View File

@@ -74,7 +74,7 @@ class RendererTest extends \MailPoetTest {
)
);
$renderer->render($this->newsletter, $newsletter_renderer);
$html = $renderer->getHTMLAfterContent('Heading Text');
$html = $renderer->getHTMLAfterContent();
expect($html)->notContains('Some text before heading');
expect($html)->notContains('Heading Text');
expect($html)->notContains('Some text between heading and content');