From 77c7a77495a9a0fed87cfd816d36def91a948fe0 Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Wed, 1 Jun 2016 13:10:03 +0300 Subject: [PATCH 01/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients --- .../Controller/EmailController.php | 2 +- .../EmailAddressRecipientsTransformer.php | 47 +++++++++++++++++++ .../Bundle/EmailBundle/Form/Model/Email.php | 1 + .../Form/Type/EmailAddressRecipientsType.php | 14 ++++++ 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php diff --git a/src/Oro/Bundle/EmailBundle/Controller/EmailController.php b/src/Oro/Bundle/EmailBundle/Controller/EmailController.php index 3f580cc595d..7d063566746 100644 --- a/src/Oro/Bundle/EmailBundle/Controller/EmailController.php +++ b/src/Oro/Bundle/EmailBundle/Controller/EmailController.php @@ -577,7 +577,7 @@ public function autocompleteRecipientAction(Request $request) { $query = $request->query->get('query'); if ($request->query->get('search_by_id', false)) { - $emails = explode(',', $query); + $emails = explode(EmailModel::EMAIL_SEPARATOR, $query); $results = array_map(function ($email) { $recipient = $this->getEmailRecipientsHelper()->createRecipientFromEmail($email); if ($recipient) { diff --git a/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php b/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php new file mode 100644 index 00000000000..0248ee59eca --- /dev/null +++ b/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Oro\Bundle\EmailBundle\Form\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\UnexpectedTypeException; + +/** + * {@inheritdoc} + * + * @author Bilal Amarni + */ +class EmailAddressRecipientsTransformer implements DataTransformerInterface +{ + /** + * {@inheritdoc} + */ + public function transform($array) + { + if (null === $array || !is_array($array)) { + return ''; + } + + return implode(';', $array); + } + + /** + * {@inheritdoc} + */ + public function reverseTransform($string) + { + if (is_array($string)) { + return $string; + } + + return explode(';', $string); + } +} diff --git a/src/Oro/Bundle/EmailBundle/Form/Model/Email.php b/src/Oro/Bundle/EmailBundle/Form/Model/Email.php index 7f56f371538..3c7658c7e86 100644 --- a/src/Oro/Bundle/EmailBundle/Form/Model/Email.php +++ b/src/Oro/Bundle/EmailBundle/Form/Model/Email.php @@ -22,6 +22,7 @@ class Email implements OrganizationAwareInterface const MAIL_TYPE_DIRECT = 'direct'; const MAIL_TYPE_REPLY = 'reply'; const MAIL_TYPE_FORWARD = 'forward'; + const EMAIL_SEPARATOR = ';'; /** @var string */ protected $gridName; diff --git a/src/Oro/Bundle/EmailBundle/Form/Type/EmailAddressRecipientsType.php b/src/Oro/Bundle/EmailBundle/Form/Type/EmailAddressRecipientsType.php index 250689956b7..59cd96337bc 100644 --- a/src/Oro/Bundle/EmailBundle/Form/Type/EmailAddressRecipientsType.php +++ b/src/Oro/Bundle/EmailBundle/Form/Type/EmailAddressRecipientsType.php @@ -6,9 +6,11 @@ use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\Form\FormBuilderInterface; use Oro\Bundle\EmailBundle\Form\Model\Email; use Oro\Bundle\ConfigBundle\Config\ConfigManager; +use Oro\Bundle\EmailBundle\Form\DataTransformer\EmailAddressRecipientsTransformer; class EmailAddressRecipientsType extends AbstractType { @@ -25,6 +27,17 @@ public function __construct(ConfigManager $cm) $this->cm = $cm; } + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->resetViewTransformers(); + $builder->addViewTransformer( + new EmailAddressRecipientsTransformer() + ); + } + /** * {@inheritdoc} */ @@ -61,6 +74,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) 'configs' => [ 'allowClear' => true, 'multiple' => true, + 'separator' => Email::EMAIL_SEPARATOR, 'route_name' => 'oro_email_autocomplete_recipient', 'minimumInputLength' => $this->cm->get('oro_email.minimum_input_length'), 'per_page' => 100, From 679086f68181548fd1ba7b071df55568fb7680c7 Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Thu, 9 Jun 2016 20:04:01 +0300 Subject: [PATCH 02/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients --- .../Controller/EmailController.php | 5 +-- .../EmailAddressRecipientsTransformer.php | 13 +++++--- .../Bundle/EmailBundle/Form/Model/Email.php | 1 - .../Form/Type/EmailAddressRecipientsType.php | 3 +- .../Provider/EmailRecipientsHelper.php | 33 +++++++++++++++++-- .../EmailBundle/Tools/EmailAddressHelper.php | 2 +- 6 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/Oro/Bundle/EmailBundle/Controller/EmailController.php b/src/Oro/Bundle/EmailBundle/Controller/EmailController.php index 7d063566746..3604d577c8d 100644 --- a/src/Oro/Bundle/EmailBundle/Controller/EmailController.php +++ b/src/Oro/Bundle/EmailBundle/Controller/EmailController.php @@ -577,7 +577,8 @@ public function autocompleteRecipientAction(Request $request) { $query = $request->query->get('query'); if ($request->query->get('search_by_id', false)) { - $emails = explode(EmailModel::EMAIL_SEPARATOR, $query); + + $emails = $this->getEmailRecipientsHelper()->extractFormRecipients($query); $results = array_map(function ($email) { $recipient = $this->getEmailRecipientsHelper()->createRecipientFromEmail($email); if ($recipient) { @@ -585,7 +586,7 @@ public function autocompleteRecipientAction(Request $request) } return [ - 'id' => $email, + 'id' => $this->getEmailRecipientsHelper()->prepareFormRecipientIds($email), 'text' => $email, ]; }, $emails); diff --git a/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php b/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php index 0248ee59eca..cd89c1776b8 100644 --- a/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php +++ b/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php @@ -13,6 +13,7 @@ use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Oro\Bundle\EmailBundle\Provider\EmailRecipientsHelper; /** * {@inheritdoc} @@ -26,11 +27,13 @@ class EmailAddressRecipientsTransformer implements DataTransformerInterface */ public function transform($array) { - if (null === $array || !is_array($array)) { - return ''; + if (!is_array($array)) { + return $array; } - return implode(';', $array); + $array = EmailRecipientsHelper::prepareFormRecipientIds($array); + + return $array; } /** @@ -42,6 +45,8 @@ public function reverseTransform($string) return $string; } - return explode(';', $string); + $array = EmailRecipientsHelper::extractFormRecipients($string); + + return $array; } } diff --git a/src/Oro/Bundle/EmailBundle/Form/Model/Email.php b/src/Oro/Bundle/EmailBundle/Form/Model/Email.php index 3c7658c7e86..7f56f371538 100644 --- a/src/Oro/Bundle/EmailBundle/Form/Model/Email.php +++ b/src/Oro/Bundle/EmailBundle/Form/Model/Email.php @@ -22,7 +22,6 @@ class Email implements OrganizationAwareInterface const MAIL_TYPE_DIRECT = 'direct'; const MAIL_TYPE_REPLY = 'reply'; const MAIL_TYPE_FORWARD = 'forward'; - const EMAIL_SEPARATOR = ';'; /** @var string */ protected $gridName; diff --git a/src/Oro/Bundle/EmailBundle/Form/Type/EmailAddressRecipientsType.php b/src/Oro/Bundle/EmailBundle/Form/Type/EmailAddressRecipientsType.php index 59cd96337bc..cbaf66b0850 100644 --- a/src/Oro/Bundle/EmailBundle/Form/Type/EmailAddressRecipientsType.php +++ b/src/Oro/Bundle/EmailBundle/Form/Type/EmailAddressRecipientsType.php @@ -11,6 +11,7 @@ use Oro\Bundle\EmailBundle\Form\Model\Email; use Oro\Bundle\ConfigBundle\Config\ConfigManager; use Oro\Bundle\EmailBundle\Form\DataTransformer\EmailAddressRecipientsTransformer; +use Oro\Bundle\EmailBundle\Provider\EmailRecipientsHelper; class EmailAddressRecipientsType extends AbstractType { @@ -74,7 +75,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) 'configs' => [ 'allowClear' => true, 'multiple' => true, - 'separator' => Email::EMAIL_SEPARATOR, + 'separator' => EmailRecipientsHelper::EMAIL_IDS_SEPARATOR, 'route_name' => 'oro_email_autocomplete_recipient', 'minimumInputLength' => $this->cm->get('oro_email.minimum_input_length'), 'per_page' => 100, diff --git a/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php b/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php index fe83539a460..910b97f4bcc 100644 --- a/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php +++ b/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php @@ -28,6 +28,7 @@ class EmailRecipientsHelper { const ORGANIZATION_PROPERTY = 'organization'; + const EMAIL_IDS_SEPARATOR = ';'; /** @var AclHelper */ protected $aclHelper; @@ -162,7 +163,7 @@ public function createRecipientData(Recipient $recipient) } return [ - 'id' => $recipient->getId(), + 'id' => $this->prepareFormRecipientIds($recipient->getId()), 'text' => $recipient->getName(), 'data' => json_encode($data), ]; @@ -321,7 +322,7 @@ protected function recipientsFromResult(array $result, $entityClass) foreach ($result as $row) { $recipient = new CategorizedRecipient( $row['email'], - sprintf('%s <%s>', $row['name'], $row['email']), + sprintf('"%s" <%s>', $row['name'], $row['email']), new RecipientEntity( $entityClass, $row['entityId'], @@ -347,4 +348,32 @@ protected function getPropertyAccessor() return $this->propertyAccessor; } + + public static function prepareFormRecipientIds($ids) + { + if (!is_array($ids) && is_string($ids)) { + return base64_encode($ids); + } + + $array = array_map("base64_encode", $ids); + + return implode(self::EMAIL_IDS_SEPARATOR, $array); + } + + public static function extractFormRecipients($value) + { + if (is_array($value)) { + return $value; + } + + $array = str_getcsv($value, self::EMAIL_IDS_SEPARATOR); + $array = array_map(function ($arrayPart) { + $arrayPart = base64_decode($arrayPart, true) ? base64_decode($arrayPart, true) : $arrayPart; + return $arrayPart; + }, + $array); + + return $array; + } + } diff --git a/src/Oro/Bundle/EmailBundle/Tools/EmailAddressHelper.php b/src/Oro/Bundle/EmailBundle/Tools/EmailAddressHelper.php index 1ccc015c925..fd17550f7bf 100644 --- a/src/Oro/Bundle/EmailBundle/Tools/EmailAddressHelper.php +++ b/src/Oro/Bundle/EmailBundle/Tools/EmailAddressHelper.php @@ -221,7 +221,7 @@ public function buildFullEmailAddress($pureEmailAddress, $emailAddressOwnerName) return trim($pureEmailAddress); } - return sprintf('%s <%s>', trim($emailAddressOwnerName), trim($pureEmailAddress)); + return sprintf('"%s" <%s>', trim($emailAddressOwnerName), trim($pureEmailAddress)); } /** From 31aaaad95a04dac36afe9b9457d9cbf193b9eeed Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Mon, 13 Jun 2016 15:44:13 +0300 Subject: [PATCH 03/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients --- .../EmailAddressRecipientsTransformer.php | 20 +++++++++---------- .../Provider/EmailRecipientsHelper.php | 16 +++++++++++---- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php b/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php index cd89c1776b8..a580c9fb962 100644 --- a/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php +++ b/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php @@ -17,35 +17,33 @@ /** * {@inheritdoc} - * - * @author Bilal Amarni */ class EmailAddressRecipientsTransformer implements DataTransformerInterface { /** * {@inheritdoc} */ - public function transform($array) + public function transform($value) { - if (!is_array($array)) { - return $array; + if (!is_array($value)) { + return $value; } - $array = EmailRecipientsHelper::prepareFormRecipientIds($array); + $string = EmailRecipientsHelper::prepareFormRecipientIds($value); - return $array; + return $string; } /** * {@inheritdoc} */ - public function reverseTransform($string) + public function reverseTransform($value) { - if (is_array($string)) { - return $string; + if (is_array($value)) { + return $value; } - $array = EmailRecipientsHelper::extractFormRecipients($string); + $array = EmailRecipientsHelper::extractFormRecipients($value); return $array; } diff --git a/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php b/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php index 910b97f4bcc..492544e84c5 100644 --- a/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php +++ b/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php @@ -349,17 +349,25 @@ protected function getPropertyAccessor() return $this->propertyAccessor; } + /** + * @param array|string $ids + * @return string; + */ public static function prepareFormRecipientIds($ids) { - if (!is_array($ids) && is_string($ids)) { + if (is_string($ids)) { return base64_encode($ids); } - $array = array_map("base64_encode", $ids); + $ids = array_map("base64_encode", $ids); - return implode(self::EMAIL_IDS_SEPARATOR, $array); + return implode(self::EMAIL_IDS_SEPARATOR, $ids); } + /** + * @param array|string $value + * @return array; + */ public static function extractFormRecipients($value) { if (is_array($value)) { @@ -368,7 +376,7 @@ public static function extractFormRecipients($value) $array = str_getcsv($value, self::EMAIL_IDS_SEPARATOR); $array = array_map(function ($arrayPart) { - $arrayPart = base64_decode($arrayPart, true) ? base64_decode($arrayPart, true) : $arrayPart; + $arrayPart = base64_decode($arrayPart, true) ? : $arrayPart; return $arrayPart; }, $array); From bcb3eeedb7305413a63c0628f9fed9b9949ee8a7 Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Mon, 13 Jun 2016 15:47:37 +0300 Subject: [PATCH 04/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients --- .../EmailAddressRecipientsTransformer.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php b/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php index a580c9fb962..8fdd3e5d153 100644 --- a/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php +++ b/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php @@ -1,14 +1,5 @@ - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - namespace Oro\Bundle\EmailBundle\Form\DataTransformer; use Symfony\Component\Form\DataTransformerInterface; From 7ee380f75f9052bafbee4d727e84c479e53d2ed0 Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Mon, 13 Jun 2016 16:52:48 +0300 Subject: [PATCH 05/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients --- .../EmailAddressRecipientsTransformer.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php b/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php index 8fdd3e5d153..e3c73e43fb5 100644 --- a/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php +++ b/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php @@ -7,7 +7,7 @@ use Oro\Bundle\EmailBundle\Provider\EmailRecipientsHelper; /** - * {@inheritdoc} + * Transforms between array of ids and string of ids. */ class EmailAddressRecipientsTransformer implements DataTransformerInterface { @@ -20,9 +20,7 @@ public function transform($value) return $value; } - $string = EmailRecipientsHelper::prepareFormRecipientIds($value); - - return $string; + return EmailRecipientsHelper::prepareFormRecipientIds($value); } /** @@ -34,8 +32,6 @@ public function reverseTransform($value) return $value; } - $array = EmailRecipientsHelper::extractFormRecipients($value); - - return $array; + return EmailRecipientsHelper::extractFormRecipients($value); } } From 02b6d82125742afa025784d6d0f47fa2751e64e1 Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Mon, 13 Jun 2016 18:42:25 +0300 Subject: [PATCH 06/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients --- .../Controller/EmailController.php | 4 +- .../EmailAddressRecipientsTransformer.php | 5 +- .../Provider/EmailRecipientsHelper.php | 25 ++++++---- .../Provider/EmailRecipientsHelperTest.php | 50 +++++++++++++++++++ 4 files changed, 69 insertions(+), 15 deletions(-) diff --git a/src/Oro/Bundle/EmailBundle/Controller/EmailController.php b/src/Oro/Bundle/EmailBundle/Controller/EmailController.php index 3604d577c8d..3f8ba3f4d49 100644 --- a/src/Oro/Bundle/EmailBundle/Controller/EmailController.php +++ b/src/Oro/Bundle/EmailBundle/Controller/EmailController.php @@ -578,7 +578,7 @@ public function autocompleteRecipientAction(Request $request) $query = $request->query->get('query'); if ($request->query->get('search_by_id', false)) { - $emails = $this->getEmailRecipientsHelper()->extractFormRecipients($query); + $emails = emailRecipientsHelper::extractFormRecipientIds($query); $results = array_map(function ($email) { $recipient = $this->getEmailRecipientsHelper()->createRecipientFromEmail($email); if ($recipient) { @@ -586,7 +586,7 @@ public function autocompleteRecipientAction(Request $request) } return [ - 'id' => $this->getEmailRecipientsHelper()->prepareFormRecipientIds($email), + 'id' => emailRecipientsHelper::prepareFormRecipientIds($email), 'text' => $email, ]; }, $emails); diff --git a/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php b/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php index e3c73e43fb5..ad0a16dda06 100644 --- a/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php +++ b/src/Oro/Bundle/EmailBundle/Form/DataTransformer/EmailAddressRecipientsTransformer.php @@ -3,11 +3,10 @@ namespace Oro\Bundle\EmailBundle\Form\DataTransformer; use Symfony\Component\Form\DataTransformerInterface; -use Symfony\Component\Form\Exception\UnexpectedTypeException; use Oro\Bundle\EmailBundle\Provider\EmailRecipientsHelper; /** - * Transforms between array of ids and string of ids. + * Transforms form value between array of full email addresses and string of base64 encoded full email addresses. */ class EmailAddressRecipientsTransformer implements DataTransformerInterface { @@ -32,6 +31,6 @@ public function reverseTransform($value) return $value; } - return EmailRecipientsHelper::extractFormRecipients($value); + return EmailRecipientsHelper::extractFormRecipientIds($value); } } diff --git a/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php b/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php index 492544e84c5..198e0c0747f 100644 --- a/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php +++ b/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php @@ -163,7 +163,7 @@ public function createRecipientData(Recipient $recipient) } return [ - 'id' => $this->prepareFormRecipientIds($recipient->getId()), + 'id' => emailRecipientsHelper::prepareFormRecipientIds($recipient->getId()), 'text' => $recipient->getName(), 'data' => json_encode($data), ]; @@ -350,6 +350,8 @@ protected function getPropertyAccessor() } /** + * Prepares base64 encoded emails to be used as ids in recipients form for select2 component. + * * @param array|string $ids * @return string; */ @@ -365,23 +367,26 @@ public static function prepareFormRecipientIds($ids) } /** + * Extracts base64 encoded selected email values, that are used as ids in recipients form for select2 component. + * * @param array|string $value * @return array; */ - public static function extractFormRecipients($value) + public static function extractFormRecipientIds($value) { if (is_array($value)) { return $value; } - - $array = str_getcsv($value, self::EMAIL_IDS_SEPARATOR); - $array = array_map(function ($arrayPart) { - $arrayPart = base64_decode($arrayPart, true) ? : $arrayPart; - return $arrayPart; + /* + * str_getcsv is used to cover the case if emails are pasted directly with ";" separator + * and it protects from ";" used in full email address. (example: "Recipient Name; Name2" ) + */ + $idsEncoded = str_getcsv($value, self::EMAIL_IDS_SEPARATOR); + $idsDecoded = array_map(function ($idEncoded) { + return base64_decode($idEncoded, true) ? : $idEncoded; }, - $array); + $idsEncoded); - return $array; + return $idsDecoded; } - } diff --git a/src/Oro/Bundle/EmailBundle/Tests/Unit/Provider/EmailRecipientsHelperTest.php b/src/Oro/Bundle/EmailBundle/Tests/Unit/Provider/EmailRecipientsHelperTest.php index 6d9ba9e8468..a3bdbbf9272 100644 --- a/src/Oro/Bundle/EmailBundle/Tests/Unit/Provider/EmailRecipientsHelperTest.php +++ b/src/Oro/Bundle/EmailBundle/Tests/Unit/Provider/EmailRecipientsHelperTest.php @@ -160,4 +160,54 @@ public function filterRecipientsDataProvider() ], ]; } + + /** + * @dataProvider prepareFormRecipientIdsDataProvider + */ + public function testPrepareFormRecipientIds($ids, $expectedResult) + { + $this->assertEquals($expectedResult, EmailRecipientsHelper::prepareFormRecipientIds($ids)); + } + + public function prepareFormRecipientIdsDataProvider() + { + return [ + [ + [ + '"Recipient1 Name; Name2" ', + '"Recipient2 Name, Name2" ' + ], + + 'IlJlY2lwaWVudDEgTmFtZTsgTmFtZTIiIDxyZWNpcGllbnQxQGV4YW1wbGUuY29tPg==;IlJlY2lwaWVudDIgTmFtZSwgTmFtZTIiIDxyZWNpcGllbnQyQGV4YW1wbGUuY29tPg==' + ] + ]; + } + + /** + * @dataProvider extractFormRecipientIdsDataProvider + */ + public function testExtractFormRecipientIds($value, $expectedResult) + { + $this->assertEquals($expectedResult, EmailRecipientsHelper::extractFormRecipientIds($value)); + } + + public function extractFormRecipientIdsDataProvider() + { + return [ + [ + 'IlJlY2lwaWVudDEgTmFtZTsgTmFtZTIiIDxyZWNpcGllbnQxQGV4YW1wbGUuY29tPg==;IlJlY2lwaWVudDIgTmFtZSwgTmFtZTIiIDxyZWNpcGllbnQyQGV4YW1wbGUuY29tPg==', + [ + '"Recipient1 Name; Name2" ', + '"Recipient2 Name, Name2" ' + ] + ], + [ + 'recipient1@example.com;recipient2@example.com', + [ + 'recipient1@example.com', + 'recipient2@example.com' + ] + ] + ]; + } } From dd84359604aef7b828b2e6af0309a8b003d6656f Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Tue, 14 Jun 2016 17:31:42 +0300 Subject: [PATCH 07/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients --- src/Oro/Bundle/EmailBundle/Controller/EmailController.php | 4 ++-- src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Oro/Bundle/EmailBundle/Controller/EmailController.php b/src/Oro/Bundle/EmailBundle/Controller/EmailController.php index 3f8ba3f4d49..93638b0ef7a 100644 --- a/src/Oro/Bundle/EmailBundle/Controller/EmailController.php +++ b/src/Oro/Bundle/EmailBundle/Controller/EmailController.php @@ -578,7 +578,7 @@ public function autocompleteRecipientAction(Request $request) $query = $request->query->get('query'); if ($request->query->get('search_by_id', false)) { - $emails = emailRecipientsHelper::extractFormRecipientIds($query); + $emails = EmailRecipientsHelper::extractFormRecipientIds($query); $results = array_map(function ($email) { $recipient = $this->getEmailRecipientsHelper()->createRecipientFromEmail($email); if ($recipient) { @@ -586,7 +586,7 @@ public function autocompleteRecipientAction(Request $request) } return [ - 'id' => emailRecipientsHelper::prepareFormRecipientIds($email), + 'id' => EmailRecipientsHelper::prepareFormRecipientIds($email), 'text' => $email, ]; }, $emails); diff --git a/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php b/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php index 198e0c0747f..57cb4844675 100644 --- a/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php +++ b/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php @@ -163,7 +163,7 @@ public function createRecipientData(Recipient $recipient) } return [ - 'id' => emailRecipientsHelper::prepareFormRecipientIds($recipient->getId()), + 'id' => EmailRecipientsHelper::prepareFormRecipientIds($recipient->getId()), 'text' => $recipient->getName(), 'data' => json_encode($data), ]; From f0fd4417f6f3559299468cece76b614955d54424 Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Tue, 14 Jun 2016 17:43:07 +0300 Subject: [PATCH 08/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients --- .../Bundle/EmailBundle/Provider/EmailRecipientsHelper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php b/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php index 57cb4844675..f72b3b72e5e 100644 --- a/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php +++ b/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php @@ -163,9 +163,9 @@ public function createRecipientData(Recipient $recipient) } return [ - 'id' => EmailRecipientsHelper::prepareFormRecipientIds($recipient->getId()), - 'text' => $recipient->getName(), - 'data' => json_encode($data), + 'id' => self::prepareFormRecipientIds($recipient->getId()), + 'text' => $recipient->getName(), + 'data' => json_encode($data), ]; } From 5f8bc7247e203f37b01833f25d2b707387e200eb Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Tue, 14 Jun 2016 20:52:56 +0300 Subject: [PATCH 09/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients, test fixes --- .../Helper/EmailModelBuilderHelperTest.php | 14 +++++------ .../Unit/Tools/EmailAddressHelperTest.php | 8 +++---- .../Workflow/Action/SendEmailTemplateTest.php | 24 +++++++++---------- .../Unit/Workflow/Action/SendEmailTest.php | 24 +++++++++---------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/Oro/Bundle/EmailBundle/Tests/Unit/Builder/Helper/EmailModelBuilderHelperTest.php b/src/Oro/Bundle/EmailBundle/Tests/Unit/Builder/Helper/EmailModelBuilderHelperTest.php index 9e80c7ffbf9..912c9170a96 100644 --- a/src/Oro/Bundle/EmailBundle/Tests/Unit/Builder/Helper/EmailModelBuilderHelperTest.php +++ b/src/Oro/Bundle/EmailBundle/Tests/Unit/Builder/Helper/EmailModelBuilderHelperTest.php @@ -114,7 +114,7 @@ protected function setUp() public function testPreciseFullEmailAddressIsFullQualifiedName() { - $emailAddress = 'Admin '; + $emailAddress = '"Admin" '; $this->entityRoutingHelper->expects($this->never()) ->method('getEntity'); @@ -131,7 +131,7 @@ public function testPreciseFullEmailAddressIsFullQualifiedName() public function testPreciseFullEmailAddressViaRoutingHelper() { $emailAddress = 'someaddress@example.com'; - $expected = 'Admin '; + $expected = '"Admin" '; $ownerClass = 'Oro\Bundle\UserBundle\Entity\User'; $ownerId = 1; @@ -183,7 +183,7 @@ public function testPreciseFullEmailAddressViaRoutingHelperWithExcludeCurrentUse public function testPreciseFullEmailAddressViaAddressManager() { $emailAddress = 'someaddress@example.com'; - $expected = 'Admin '; + $expected = '"Admin" '; $ownerClass = 'Oro\Bundle\UserBundle\Entity\User'; $ownerId = null; @@ -307,19 +307,19 @@ public function preciseFullEmailAddressProvider() { return [ [ - 'FirstName LastName ', + '"FirstName LastName" ', 'test@example.com', null, null ], [ - 'FirstName LastName ', + '"FirstName LastName" ', 'test@example.com', 'Oro\Bundle\EmailBundle\Tests\Unit\Fixtures\Entity\TestUser', null ], [ - 'OwnerFirstName OwnerLastName ', + '"OwnerFirstName OwnerLastName" ', 'test@example.com', 'Oro\Bundle\EmailBundle\Tests\Unit\Fixtures\Entity\TestUser', 123 @@ -410,7 +410,7 @@ public function testBuildFullEmailAddress() $user = $this->getMock('Oro\Bundle\UserBundle\Entity\User'); $email = 'email'; $format = 'format'; - $expected = 'format '; + $expected = '"format" '; $user->expects($this->once()) ->method('getEmail') diff --git a/src/Oro/Bundle/EmailBundle/Tests/Unit/Tools/EmailAddressHelperTest.php b/src/Oro/Bundle/EmailBundle/Tests/Unit/Tools/EmailAddressHelperTest.php index 2f563b1389c..19924ad82a1 100644 --- a/src/Oro/Bundle/EmailBundle/Tests/Unit/Tools/EmailAddressHelperTest.php +++ b/src/Oro/Bundle/EmailBundle/Tests/Unit/Tools/EmailAddressHelperTest.php @@ -91,8 +91,8 @@ public static function buildFullEmailAddressProvider() ['john@example.com', null, 'john@example.com'], ['john@example.com', '', 'john@example.com'], ['john@example.com', null, 'john@example.com'], - ['john@example.com', 'John Smith', 'John Smith '], - [' john@example.com ', ' John Smith ', 'John Smith '], + ['john@example.com', 'John Smith', '"John Smith" '], + [' john@example.com ', ' John Smith ', '"John Smith" '], ]; } @@ -126,7 +126,7 @@ public static function extractEmailAddressFirstNameProvider() { return [ ['John Smith IV. ', 'John'], - ['John Smith ', 'John'], + ['"John Smith" ', 'John'], ['John ', 'John'], ['john.smith@example.com', 'john'], ['john@example.com', 'john'], @@ -137,7 +137,7 @@ public static function extractEmailAddressLastNameProvider() { return [ ['John Smith IV. ', 'Smith IV.'], - ['John Smith ', 'Smith'], + ['"John Smith" ', 'Smith'], ['John ', 'example.com'], ['john.smith@example.com', 'smith'], ['john@example.com', 'example.com'], diff --git a/src/Oro/Bundle/EmailBundle/Tests/Unit/Workflow/Action/SendEmailTemplateTest.php b/src/Oro/Bundle/EmailBundle/Tests/Unit/Workflow/Action/SendEmailTemplateTest.php index 18a477aa472..9970214c8fd 100644 --- a/src/Oro/Bundle/EmailBundle/Tests/Unit/Workflow/Action/SendEmailTemplateTest.php +++ b/src/Oro/Bundle/EmailBundle/Tests/Unit/Workflow/Action/SendEmailTemplateTest.php @@ -508,14 +508,14 @@ public function executeOptionsDataProvider() ], 'simple with name' => [ [ - 'from' => 'Test ', - 'to' => 'Test ', + 'from' => '"Test" ', + 'to' => '"Test" ', 'template' => 'test', 'entity' => new \stdClass(), ], [ - 'from' => 'Test ', - 'to' => ['Test '], + 'from' => '"Test" ', + 'to' => ['"Test" '], 'subject' => 'Test subject', 'body' => 'Test body', ] @@ -534,8 +534,8 @@ public function executeOptionsDataProvider() 'entity' => new \stdClass(), ], [ - 'from' => 'Test ', - 'to' => ['Test '], + 'from' => '"Test" ', + 'to' => ['"Test" '], 'subject' => 'Test subject', 'body' => 'Test body', ] @@ -554,8 +554,8 @@ public function executeOptionsDataProvider() 'entity' => new \stdClass(), ], [ - 'from' => '_Formatted ', - 'to' => ['_Formatted '], + 'from' => '"_Formatted" ', + 'to' => ['"_Formatted" '], 'subject' => 'Test subject', 'body' => 'Test body', ] @@ -572,18 +572,18 @@ public function executeOptionsDataProvider() 'email' => 'test@test.com' ], 'test@test.com', - 'Test ' + '"Test" ' ], 'template' => 'test', 'entity' => new \stdClass(), 'attribute' => 'attr' ], [ - 'from' => 'Test ', + 'from' => '"Test" ', 'to' => [ - 'Test ', + '"Test" ', 'test@test.com', - 'Test ' + '"Test" ' ], 'subject' => 'Test subject', 'body' => 'Test body', diff --git a/src/Oro/Bundle/EmailBundle/Tests/Unit/Workflow/Action/SendEmailTest.php b/src/Oro/Bundle/EmailBundle/Tests/Unit/Workflow/Action/SendEmailTest.php index 7bd612e5658..80323dcf7b8 100644 --- a/src/Oro/Bundle/EmailBundle/Tests/Unit/Workflow/Action/SendEmailTest.php +++ b/src/Oro/Bundle/EmailBundle/Tests/Unit/Workflow/Action/SendEmailTest.php @@ -313,14 +313,14 @@ public function executeOptionsDataProvider() ), 'simple with name' => array( array( - 'from' => 'Test ', - 'to' => 'Test ', + 'from' => '"Test" ', + 'to' => '"Test" ', 'subject' => 'test', 'body' => 'test' ), array( - 'from' => 'Test ', - 'to' => array('Test '), + 'from' => '"Test" ', + 'to' => array('"Test" '), 'subject' => 'test', 'body' => 'test' ) @@ -339,8 +339,8 @@ public function executeOptionsDataProvider() 'body' => 'test' ), array( - 'from' => 'Test ', - 'to' => array('Test '), + 'from' => '"Test" ', + 'to' => array('"Test" '), 'subject' => 'test', 'body' => 'test' ) @@ -359,8 +359,8 @@ public function executeOptionsDataProvider() 'body' => 'test' ), array( - 'from' => '_Formatted ', - 'to' => array('_Formatted '), + 'from' => '"_Formatted" ', + 'to' => array('"_Formatted" '), 'subject' => 'test', 'body' => 'test' ) @@ -377,18 +377,18 @@ public function executeOptionsDataProvider() 'email' => 'test@test.com' ), 'test@test.com', - 'Test ' + '"Test" ' ), 'subject' => 'test', 'body' => 'test', 'attribute' => 'attr' ), array( - 'from' => 'Test ', + 'from' => '"Test" ', 'to' => array( - 'Test ', + '"Test" ', 'test@test.com', - 'Test ' + '"Test" ' ), 'subject' => 'test', 'body' => 'test' From 5278a30a15c8d76e8def74834d64dc7c858abd95 Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Tue, 14 Jun 2016 22:14:35 +0300 Subject: [PATCH 10/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients, test fixes --- .../Tests/Unit/Provider/EmailRecipientsHelperTest.php | 4 ++-- .../EmailBundle/Tests/Unit/Tools/EmailAddressHelperTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Oro/Bundle/EmailBundle/Tests/Unit/Provider/EmailRecipientsHelperTest.php b/src/Oro/Bundle/EmailBundle/Tests/Unit/Provider/EmailRecipientsHelperTest.php index a3bdbbf9272..3d036c65abd 100644 --- a/src/Oro/Bundle/EmailBundle/Tests/Unit/Provider/EmailRecipientsHelperTest.php +++ b/src/Oro/Bundle/EmailBundle/Tests/Unit/Provider/EmailRecipientsHelperTest.php @@ -178,7 +178,7 @@ public function prepareFormRecipientIdsDataProvider() '"Recipient2 Name, Name2" ' ], - 'IlJlY2lwaWVudDEgTmFtZTsgTmFtZTIiIDxyZWNpcGllbnQxQGV4YW1wbGUuY29tPg==;IlJlY2lwaWVudDIgTmFtZSwgTmFtZTIiIDxyZWNpcGllbnQyQGV4YW1wbGUuY29tPg==' + base64_encode('"Recipient1 Name; Name2" ').';'.base64_encode('"Recipient2 Name, Name2" ') ] ]; } @@ -195,7 +195,7 @@ public function extractFormRecipientIdsDataProvider() { return [ [ - 'IlJlY2lwaWVudDEgTmFtZTsgTmFtZTIiIDxyZWNpcGllbnQxQGV4YW1wbGUuY29tPg==;IlJlY2lwaWVudDIgTmFtZSwgTmFtZTIiIDxyZWNpcGllbnQyQGV4YW1wbGUuY29tPg==', + base64_encode('"Recipient1 Name; Name2" ').';'.base64_encode('"Recipient2 Name, Name2" '), [ '"Recipient1 Name; Name2" ', '"Recipient2 Name, Name2" ' diff --git a/src/Oro/Bundle/EmailBundle/Tests/Unit/Tools/EmailAddressHelperTest.php b/src/Oro/Bundle/EmailBundle/Tests/Unit/Tools/EmailAddressHelperTest.php index 19924ad82a1..0bec6bfd28f 100644 --- a/src/Oro/Bundle/EmailBundle/Tests/Unit/Tools/EmailAddressHelperTest.php +++ b/src/Oro/Bundle/EmailBundle/Tests/Unit/Tools/EmailAddressHelperTest.php @@ -126,7 +126,7 @@ public static function extractEmailAddressFirstNameProvider() { return [ ['John Smith IV. ', 'John'], - ['"John Smith" ', 'John'], + ['"John Smith" ', 'John'], ['John ', 'John'], ['john.smith@example.com', 'john'], ['john@example.com', 'john'], @@ -137,7 +137,7 @@ public static function extractEmailAddressLastNameProvider() { return [ ['John Smith IV. ', 'Smith IV.'], - ['"John Smith" ', 'Smith'], + ['"John Smith" ', 'Smith'], ['John ', 'example.com'], ['john.smith@example.com', 'smith'], ['john@example.com', 'example.com'], From cdcce0f58997e944d819c0c78c35ce995119255b Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Wed, 15 Jun 2016 13:14:24 +0300 Subject: [PATCH 11/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients, test fixes --- .../Bundle/EmailBundle/Provider/EmailRecipientsHelper.php | 5 ++--- .../Tests/Unit/Provider/EmailRecipientsHelperTest.php | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php b/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php index f72b3b72e5e..bd38e1befb7 100644 --- a/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php +++ b/src/Oro/Bundle/EmailBundle/Provider/EmailRecipientsHelper.php @@ -383,9 +383,8 @@ public static function extractFormRecipientIds($value) */ $idsEncoded = str_getcsv($value, self::EMAIL_IDS_SEPARATOR); $idsDecoded = array_map(function ($idEncoded) { - return base64_decode($idEncoded, true) ? : $idEncoded; - }, - $idsEncoded); + return base64_decode($idEncoded, true) ? : $idEncoded; + }, $idsEncoded); return $idsDecoded; } diff --git a/src/Oro/Bundle/EmailBundle/Tests/Unit/Provider/EmailRecipientsHelperTest.php b/src/Oro/Bundle/EmailBundle/Tests/Unit/Provider/EmailRecipientsHelperTest.php index 3d036c65abd..a74bcc3300c 100644 --- a/src/Oro/Bundle/EmailBundle/Tests/Unit/Provider/EmailRecipientsHelperTest.php +++ b/src/Oro/Bundle/EmailBundle/Tests/Unit/Provider/EmailRecipientsHelperTest.php @@ -178,7 +178,8 @@ public function prepareFormRecipientIdsDataProvider() '"Recipient2 Name, Name2" ' ], - base64_encode('"Recipient1 Name; Name2" ').';'.base64_encode('"Recipient2 Name, Name2" ') + base64_encode('"Recipient1 Name; Name2" ') . ';' + . base64_encode('"Recipient2 Name, Name2" ') ] ]; } @@ -195,7 +196,8 @@ public function extractFormRecipientIdsDataProvider() { return [ [ - base64_encode('"Recipient1 Name; Name2" ').';'.base64_encode('"Recipient2 Name, Name2" '), + base64_encode('"Recipient1 Name; Name2" ') . ';' + . base64_encode('"Recipient2 Name, Name2" '), [ '"Recipient1 Name; Name2" ', '"Recipient2 Name, Name2" ' From 6a4d24708325d3ef040f7ac64565bb6d00d2f73b Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Thu, 16 Jun 2016 15:26:33 +0300 Subject: [PATCH 12/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients. Functional tests fix --- src/Oro/Bundle/EmailBundle/Controller/EmailController.php | 1 - .../EmailBundle/Tests/Functional/EmailControllerTest.php | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Oro/Bundle/EmailBundle/Controller/EmailController.php b/src/Oro/Bundle/EmailBundle/Controller/EmailController.php index 93638b0ef7a..e0fcecdc77d 100644 --- a/src/Oro/Bundle/EmailBundle/Controller/EmailController.php +++ b/src/Oro/Bundle/EmailBundle/Controller/EmailController.php @@ -577,7 +577,6 @@ public function autocompleteRecipientAction(Request $request) { $query = $request->query->get('query'); if ($request->query->get('search_by_id', false)) { - $emails = EmailRecipientsHelper::extractFormRecipientIds($query); $results = array_map(function ($email) { $recipient = $this->getEmailRecipientsHelper()->createRecipientFromEmail($email); diff --git a/src/Oro/Bundle/EmailBundle/Tests/Functional/EmailControllerTest.php b/src/Oro/Bundle/EmailBundle/Tests/Functional/EmailControllerTest.php index 3624df05ead..72d8b1a0c67 100644 --- a/src/Oro/Bundle/EmailBundle/Tests/Functional/EmailControllerTest.php +++ b/src/Oro/Bundle/EmailBundle/Tests/Functional/EmailControllerTest.php @@ -232,7 +232,7 @@ public function testReply() $this->assertEquals(1, $crawler->filter('div.widget-content input[name=\'oro_email_email[cc]\']')->count()); $this->assertEquals( 1, - $crawler->filter('div.widget-content input[value=\'' . $email->getFromName() . '\']')->count() + $crawler->filter('div.widget-content input[value=\'' . base64_encode($email->getFromName()) . '\']')->count() ); $cc = $email->getCc()->first()->getEmailAddress()->getEmail(); $this->assertEquals( @@ -258,12 +258,12 @@ public function testReplyAll() $this->assertEquals(1, $crawler->filter('div.widget-content input[name=\'oro_email_email[cc]\']')->count()); $this->assertEquals( 1, - $crawler->filter('div.widget-content input[value=\'' . $email->getFromName() . '\']')->count() + $crawler->filter('div.widget-content input[value=\'' . base64_encode($email->getFromName()) . '\']')->count() ); $cc = $email->getCc()->first()->getEmailAddress()->getEmail(); $this->assertEquals( 1, - $crawler->filter('div.widget-content input[value=\'' . $cc . '\']')->count() + $crawler->filter('div.widget-content input[value=\'' . base64_encode($cc) . '\']')->count() ); $bcc = $email->getBcc()->first()->getEmailAddress()->getEmail(); $this->assertEquals( From 9788ceb04b028538225fe0e492f055fa34851dac Mon Sep 17 00:00:00 2001 From: Andrey Agafonkin Date: Thu, 16 Jun 2016 16:20:11 +0300 Subject: [PATCH 13/13] CRM-5529: Recipient names which contain a comma may be perceived as two different recipients. Functional tests --- .../EmailBundle/Tests/Functional/EmailControllerTest.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Oro/Bundle/EmailBundle/Tests/Functional/EmailControllerTest.php b/src/Oro/Bundle/EmailBundle/Tests/Functional/EmailControllerTest.php index 72d8b1a0c67..b1f604073c1 100644 --- a/src/Oro/Bundle/EmailBundle/Tests/Functional/EmailControllerTest.php +++ b/src/Oro/Bundle/EmailBundle/Tests/Functional/EmailControllerTest.php @@ -232,7 +232,9 @@ public function testReply() $this->assertEquals(1, $crawler->filter('div.widget-content input[name=\'oro_email_email[cc]\']')->count()); $this->assertEquals( 1, - $crawler->filter('div.widget-content input[value=\'' . base64_encode($email->getFromName()) . '\']')->count() + $crawler->filter('div.widget-content input[value=\'' + . base64_encode($email->getFromName()) + . '\']')->count() ); $cc = $email->getCc()->first()->getEmailAddress()->getEmail(); $this->assertEquals( @@ -258,7 +260,9 @@ public function testReplyAll() $this->assertEquals(1, $crawler->filter('div.widget-content input[name=\'oro_email_email[cc]\']')->count()); $this->assertEquals( 1, - $crawler->filter('div.widget-content input[value=\'' . base64_encode($email->getFromName()) . '\']')->count() + $crawler->filter('div.widget-content input[value=\'' + . base64_encode($email->getFromName()) + . '\']')->count() ); $cc = $email->getCc()->first()->getEmailAddress()->getEmail(); $this->assertEquals(