Fix action_argument_value of shortcode will be string if empty

[MAILPOET-4151]
This commit is contained in:
David Remer
2022-02-18 11:56:13 +02:00
committed by Veljko V
parent ec0f490397
commit eda969dd72
2 changed files with 10 additions and 1 deletions

View File

@ -151,7 +151,7 @@ class Shortcodes {
'';
$shortcodeDetails['action_argument_value'] = !empty($shortcodeDetails['argument_value']) ?
$shortcodeDetails['argument_value'] :
false;
'';
$shortcodeDetails['arguments'] = !empty($shortcodeDetails['arguments']) ?
$shortcodeDetails['arguments'] : [];

View File

@ -372,6 +372,15 @@ class ShortcodesTest extends \MailPoetTest {
}
}
public function testItCanProcessShortcodeWithEmptyDefault() {
$shortcode = '[subscriber:lastname | default:]';
$shortcodesObject = $this->shortcodesObject;
$subscriberWithoutLastname = new SubscriberEntity();
$shortcodesObject->setSubscriber($subscriberWithoutLastname);
$result = $shortcodesObject->process([$shortcode]);
expect($result[0])->equals('');
}
public function testItCanProcessCustomLinkShortcodes() {
$shortcodesObject = $this->shortcodesObject;
$shortcodesObject->setWpUserPreview(false);