diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php index 5a4f132..d770e07 100755 --- a/Classes/Controller/ModuleController.php +++ b/Classes/Controller/ModuleController.php @@ -64,7 +64,7 @@ public function indexAction() $configuration = array( 'pageId' => $this->pageId, 'pageType' => $pageType, - 'emailShowUrl' => UriBuilder::buildFrontendUri('show', array(), 'Email'), + 'emailShowUrl' => UriBuilder::buildFrontendUri($this->pageId, 'Email', 'show'), ); $this->view->assign('configuration', $configuration); diff --git a/Classes/Domain/Model/RecipientList.php b/Classes/Domain/Model/RecipientList.php index 6bbf4b1..3e44e6a 100755 --- a/Classes/Domain/Model/RecipientList.php +++ b/Classes/Domain/Model/RecipientList.php @@ -249,8 +249,8 @@ public function getExtract($limit = 30) $out = '' . $out . '
'; $authCode = \TYPO3\CMS\Core\Utility\GeneralUtility::stdAuthCode($this->_getCleanProperties()); - $uriXml = UriBuilder::buildFrontendUri('export', array('uidRecipientList' => $this->getUid(), 'authCode' => $authCode, 'format' => 'xml'), 'RecipientList'); - $uriCsv = UriBuilder::buildFrontendUri('export', array('uidRecipientList' => $this->getUid(), 'authCode' => $authCode, 'format' => 'csv'), 'RecipientList'); + $uriXml = UriBuilder::buildFrontendUri($this->getPid(), 'RecipientList', 'export', array('uidRecipientList' => $this->getUid(), 'authCode' => $authCode, 'format' => 'xml')); + $uriCsv = UriBuilder::buildFrontendUri($this->getPid(), 'RecipientList', 'export', array('uidRecipientList' => $this->getUid(), 'authCode' => $authCode, 'format' => 'csv')); $out .= '

' . $i . '/' . $this->getCount() . ' recipients (export XML, ' diff --git a/Classes/Mailer.php b/Classes/Mailer.php index 6a0342d..e0f662d 100755 --- a/Classes/Mailer.php +++ b/Classes/Mailer.php @@ -223,9 +223,7 @@ private function findAttachments($src) */ private function injectOpenSpy(Email $email) { - $url = UriBuilder::buildFrontendUri('opened', array( - 'c' => $email->getAuthCode(), - ), 'Email'); + $url = UriBuilder::buildFrontendUri($email->getPid(), 'Email', 'opened', array('c' => $email->getAuthCode())); $this->html = str_ireplace('', '

', $this->html); } @@ -302,7 +300,7 @@ private function getLinkAuthCode(Email $email, $url, $isPreview, $isPlainText = if ($isPlainText) { $arguments['p'] = 1; } - $newUrl = UriBuilder::buildFrontendUri('clicked', $arguments, 'Link'); + $newUrl = UriBuilder::buildFrontendUri($email->getPid(), 'Link', 'clicked', $arguments); return $newUrl; } diff --git a/Classes/Utility/MarkerSubstitutor.php b/Classes/Utility/MarkerSubstitutor.php index 03e2d2f..a057aec 100644 --- a/Classes/Utility/MarkerSubstitutor.php +++ b/Classes/Utility/MarkerSubstitutor.php @@ -119,8 +119,8 @@ private function getMarkers(Email $email) // Add predefined markers $authCode = $email->getAuthCode(); - $markers['newsletter_view_url'] = UriBuilder::buildFrontendUri('show', array('c' => $authCode), 'Email'); - $markers['newsletter_unsubscribe_url'] = UriBuilder::buildFrontendUri('unsubscribe', array('c' => $authCode), 'Email'); + $markers['newsletter_view_url'] = UriBuilder::buildFrontendUri($email->getPid(), 'Email', 'show', array('c' => $authCode)); + $markers['newsletter_unsubscribe_url'] = UriBuilder::buildFrontendUri($email->getPid(), 'Email', 'unsubscribe', array('c' => $authCode)); return $markers; } diff --git a/Classes/Utility/UriBuilder.php b/Classes/Utility/UriBuilder.php index 8469c52..f46f355 100644 --- a/Classes/Utility/UriBuilder.php +++ b/Classes/Utility/UriBuilder.php @@ -32,29 +32,40 @@ */ abstract class UriBuilder { + const EXTENSION_NAME = 'newsletter'; + const PLUGIN_NAME = 'p'; + /** - * UriBuilder - * @var \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder + * UriBuilders indexed by PID + * @var \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder[] */ - private static $uriBuilder = null; + private static $uriBuilder = array(); + + private static function getUriBuilder($currentPid) + { + if (!isset(self::$uriBuilder[$currentPid])) { + $builder = self::createUriBuilder($currentPid); + self::$uriBuilder[$currentPid] = $builder; + } + + return self::$uriBuilder[$currentPid]; + } /** * Build an uriBuilder that can be used from any context (backend, frontend, TCA) to generate frontend URI - * @param string $extensionName - * @param string $pluginName + * @param int $currentPid * @return \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder */ - private static function buildUriBuilder($extensionName, $pluginName) + private static function createUriBuilder($currentPid) { - // If we are in Backend we need to simulate minimal TSFE if (!isset($GLOBALS['TSFE']) || !($GLOBALS['TSFE'] instanceof \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController)) { if (!is_object($GLOBALS['TT'])) { $GLOBALS['TT'] = new \TYPO3\CMS\Core\TimeTracker\TimeTracker(); $GLOBALS['TT']->start(); } - $pid = 0; - $TSFE = @\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $pid, '0', 1); + + $TSFE = @\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $currentPid, '0', 1); $GLOBALS['TSFE'] = $TSFE; $GLOBALS['TSFE']->initFEuser(); @@ -70,7 +81,7 @@ private static function buildUriBuilder($extensionName, $pluginName) $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); if (!(isset($GLOBALS['dispatcher']) && $GLOBALS['dispatcher'] instanceof \TYPO3\CMS\Extbase\Core\Bootstrap)) { $extbaseBootstrap = $objectManager->get('TYPO3\\CMS\\Extbase\\Core\\Bootstrap'); - $extbaseBootstrap->initialize(array('extensionName' => $extensionName, 'pluginName' => $pluginName)); + $extbaseBootstrap->initialize(array('extensionName' => self::EXTENSION_NAME, 'pluginName' => self::PLUGIN_NAME)); } return $objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder'); @@ -78,38 +89,33 @@ private static function buildUriBuilder($extensionName, $pluginName) /** * Returns a frontend URI independently of current context, with or without extbase, and with or without TSFE - * @param string $actionName - * @param array $controllerArguments + * @param int $currentPid * @param string $controllerName - * @param string $extensionName - * @param string $pluginName - * @param array $otherArguments + * @param string $actionName + * @param array $arguments * @return string absolute URI */ - public static function buildFrontendUri($actionName, array $controllerArguments, $controllerName, $extensionName = 'newsletter', $pluginName = 'p', array $otherArguments = null) + public static function buildFrontendUri($currentPid, $controllerName, $actionName, array $arguments = array()) { - if (!self::$uriBuilder) { - self::$uriBuilder = self::buildUriBuilder($extensionName, $pluginName); - } - $controllerArguments['action'] = $actionName; - $controllerArguments['controller'] = $controllerName; - $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); $extensionService = $objectManager->get('TYPO3\\CMS\\Extbase\\Service\\ExtensionService'); - $pluginNamespace = $extensionService->getPluginNamespace($extensionName, $pluginName); + $pluginNamespace = $extensionService->getPluginNamespace(self::EXTENSION_NAME, self::PLUGIN_NAME); - if (!isset($otherArguments) || is_null($otherArguments)) { - $otherArguments = array(); - } + // Prepare arguments + $arguments['action'] = $actionName; + $arguments['controller'] = $controllerName; + $namespacedArguments = array($pluginNamespace => $arguments); + + // Configure Uri + $uriBuilder = self::getUriBuilder($currentPid); + $uriBuilder->reset() + ->setUseCacheHash(false) + ->setCreateAbsoluteUri(true) + ->setArguments($namespacedArguments) + ->setTargetPageType(1342671779); - $arguments = $otherArguments; - $arguments[$pluginNamespace] = $controllerArguments; - self::$uriBuilder->reset() - ->setUseCacheHash(false) - ->setCreateAbsoluteUri(true) - ->setArguments($arguments) - ->setTargetPageType(1342671779); + $uri = $uriBuilder->buildFrontendUri(); - return self::$uriBuilder->buildFrontendUri(); + return $uri; } } diff --git a/Tests/Functional/AbstractFunctionalTestCase.php b/Tests/Functional/AbstractFunctionalTestCase.php index b7a5d82..e989535 100644 --- a/Tests/Functional/AbstractFunctionalTestCase.php +++ b/Tests/Functional/AbstractFunctionalTestCase.php @@ -20,7 +20,6 @@ public function setUp() parent::setUp(); $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); - $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml'); $this->importDataSet(__DIR__ . '/Fixtures/fixtures.xml'); $this->authCode = md5(302 . 'recipient2@example.com'); } diff --git a/Tests/Functional/Fixtures/fixtures.xml b/Tests/Functional/Fixtures/fixtures.xml index 3db9b76..545c89d 100644 --- a/Tests/Functional/Fixtures/fixtures.xml +++ b/Tests/Functional/Fixtures/fixtures.xml @@ -16,6 +16,74 @@ + + 6 + alternative-domain.com + + + + 6 + 1 + + page = PAGE + page { + typeNum = 0 + } + + + + + 1 + 0 + Root 1 + 0 + 15 + 1 + 1 + + + 2 + 1 + Dummy 1-2 + 0 + 15 + 1 + + + 3 + 2 + Dummy 1-2-3 + 0 + 15 + 1 + + + + 4 + 0 + Root 2 + 0 + 15 + 1 + 1 + + + 5 + 4 + Dummy 2-2 + 0 + 15 + 1 + + + 6 + 5 + Dummy 2-2-3 + 0 + 15 + 1 + + 10 2 diff --git a/Tests/Functional/Fixtures/mailer/basic/input.html b/Tests/Functional/Fixtures/mailer/input.html similarity index 100% rename from Tests/Functional/Fixtures/mailer/basic/input.html rename to Tests/Functional/Fixtures/mailer/input.html diff --git a/Tests/Functional/Fixtures/mailer/basic/output-false-false.html b/Tests/Functional/Fixtures/mailer/output-2-false-false.html similarity index 85% rename from Tests/Functional/Fixtures/mailer/basic/output-false-false.html rename to Tests/Functional/Fixtures/mailer/output-2-false-false.html index 08a721f..f663bfd 100644 --- a/Tests/Functional/Fixtures/mailer/basic/output-false-false.html +++ b/Tests/Functional/Fixtures/mailer/output-2-false-false.html @@ -14,20 +14,20 @@ HTML entities encoded mailto link should still work ###unknown_field_will_be_kept### - http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email - http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value http://unknown_field_will_be_kept - http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email - http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value https://unknown_field_will_be_kept - https://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email - https://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email + https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email + https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value diff --git a/Tests/Functional/Fixtures/mailer/basic/output-false-false.txt b/Tests/Functional/Fixtures/mailer/output-2-false-false.txt similarity index 81% rename from Tests/Functional/Fixtures/mailer/basic/output-false-false.txt rename to Tests/Functional/Fixtures/mailer/output-2-false-false.txt index 14e9582..2cb4dc7 100644 --- a/Tests/Functional/Fixtures/mailer/basic/output-false-false.txt +++ b/Tests/Functional/Fixtures/mailer/output-2-false-false.txt @@ -3,16 +3,16 @@ should be injected [1] this custom link should be injected [2] this link should be injected, and marker substituted [3] mailto link should still work HTML entities encoded mailto link should still work [4] ###unknown_field_will_be_kept### -http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email -http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value http://unknown_field_will_be_kept -http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email -http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value https://unknown_field_will_be_kept -https://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email -https://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email +https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email +https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value boolean_false= boolean_true=true-ish integer_false= integer_true=true-ish string_false= string_true=true-ish boolean_false=false-ish diff --git a/Tests/Functional/Fixtures/mailer/basic/output-false-true.html b/Tests/Functional/Fixtures/mailer/output-2-false-true.html similarity index 81% rename from Tests/Functional/Fixtures/mailer/basic/output-false-true.html rename to Tests/Functional/Fixtures/mailer/output-2-false-true.html index 1a12d54..0d7412e 100644 --- a/Tests/Functional/Fixtures/mailer/basic/output-false-true.html +++ b/Tests/Functional/Fixtures/mailer/output-2-false-true.html @@ -7,27 +7,27 @@ http://www.example.com this line should never be modified - this link should be injected - this custom link should be injected - this link should be injected, and marker substituted + this link should be injected + this custom link should be injected + this link should be injected, and marker substituted mailto link should still work HTML entities encoded mailto link should still work ###unknown_field_will_be_kept### - http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email - http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value http://unknown_field_will_be_kept - http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email - http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value https://unknown_field_will_be_kept - https://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email - https://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email + https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email + https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value diff --git a/Tests/Functional/Fixtures/mailer/basic/output-false-true.txt b/Tests/Functional/Fixtures/mailer/output-2-false-true.txt similarity index 77% rename from Tests/Functional/Fixtures/mailer/basic/output-false-true.txt rename to Tests/Functional/Fixtures/mailer/output-2-false-true.txt index 859c1bf..df66a6f 100644 --- a/Tests/Functional/Fixtures/mailer/basic/output-false-true.txt +++ b/Tests/Functional/Fixtures/mailer/output-2-false-true.txt @@ -3,16 +3,16 @@ should be injected [1] this custom link should be injected [2] this link should be injected, and marker substituted [3] mailto link should still work HTML entities encoded mailto link should still work [4] ###unknown_field_will_be_kept### -http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email -http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value http://unknown_field_will_be_kept -http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email -http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value https://unknown_field_will_be_kept -https://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email -https://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email +https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email +https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value boolean_false= boolean_true=true-ish integer_false= integer_true=true-ish string_false= string_true=true-ish boolean_false=false-ish @@ -21,7 +21,7 @@ string_false=false-ish string_true=true-ish Links: ------ -[1] http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bn%5D=12345&tx_newsletter_p%5Bl%5D=83d3cea3f4e089b7f7131719049a6efa&tx_newsletter_p%5Baction%5D=clicked&tx_newsletter_p%5Bcontroller%5D=Link -[2] http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bn%5D=12345&tx_newsletter_p%5Bl%5D=37ba48a2031ad61f5b9b32759c650179&tx_newsletter_p%5Baction%5D=clicked&tx_newsletter_p%5Bcontroller%5D=Link -[3] http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bn%5D=12345&tx_newsletter_p%5Bl%5D=1d6061672598d4a25c12d1e12c622bc2&tx_newsletter_p%5Baction%5D=clicked&tx_newsletter_p%5Bcontroller%5D=Link +[1] http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bn%5D=12345&tx_newsletter_p%5Bl%5D=83d3cea3f4e089b7f7131719049a6efa&tx_newsletter_p%5Baction%5D=clicked&tx_newsletter_p%5Bcontroller%5D=Link +[2] http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bn%5D=12345&tx_newsletter_p%5Bl%5D=37ba48a2031ad61f5b9b32759c650179&tx_newsletter_p%5Baction%5D=clicked&tx_newsletter_p%5Bcontroller%5D=Link +[3] http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bn%5D=12345&tx_newsletter_p%5Bl%5D=1d6061672598d4a25c12d1e12c622bc2&tx_newsletter_p%5Baction%5D=clicked&tx_newsletter_p%5Bcontroller%5D=Link [4] /mailto:john@example.com diff --git a/Tests/Functional/Fixtures/mailer/basic/output-true-false.html b/Tests/Functional/Fixtures/mailer/output-2-true-false.html similarity index 84% rename from Tests/Functional/Fixtures/mailer/basic/output-true-false.html rename to Tests/Functional/Fixtures/mailer/output-2-true-false.html index e12d993..0e3e34f 100644 --- a/Tests/Functional/Fixtures/mailer/basic/output-true-false.html +++ b/Tests/Functional/Fixtures/mailer/output-2-true-false.html @@ -14,20 +14,20 @@ HTML entities encoded mailto link should still work ###unknown_field_will_be_kept### - http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email - http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value http://unknown_field_will_be_kept - http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email - http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value https://unknown_field_will_be_kept - https://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email - https://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email + https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email + https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value @@ -46,5 +46,5 @@ string_true=true-ish image -
+
diff --git a/Tests/Functional/Fixtures/mailer/basic/output-true-false.txt b/Tests/Functional/Fixtures/mailer/output-2-true-false.txt similarity index 81% rename from Tests/Functional/Fixtures/mailer/basic/output-true-false.txt rename to Tests/Functional/Fixtures/mailer/output-2-true-false.txt index 2d54674..083adec 100644 --- a/Tests/Functional/Fixtures/mailer/basic/output-true-false.txt +++ b/Tests/Functional/Fixtures/mailer/output-2-true-false.txt @@ -3,16 +3,16 @@ should be injected [1] this custom link should be injected [2] this link should be injected, and marker substituted [3] mailto link should still work HTML entities encoded mailto link should still work [4] ###unknown_field_will_be_kept### -http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email -http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value http://unknown_field_will_be_kept -http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email -http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value https://unknown_field_will_be_kept -https://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email -https://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email +https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email +https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email recipient@example.com my custom value boolean_false= boolean_true=true-ish integer_false= integer_true=true-ish string_false= string_true=true-ish boolean_false=false-ish diff --git a/Tests/Functional/Fixtures/mailer/output-2-true-true.html b/Tests/Functional/Fixtures/mailer/output-2-true-true.html new file mode 100644 index 0000000..f0b521e --- /dev/null +++ b/Tests/Functional/Fixtures/mailer/output-2-true-true.html @@ -0,0 +1,50 @@ + + + + Newsletter Title + + + + + http://www.example.com this line should never be modified + this link should be injected + this custom link should be injected + this link should be injected, and marker substituted + mailto link should still work + HTML entities encoded mailto link should still work + + ###unknown_field_will_be_kept### + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email + recipient@example.com + my custom value + + http://unknown_field_will_be_kept + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email + http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email + recipient@example.com + my custom value + + https://unknown_field_will_be_kept + https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email + https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email + recipient@example.com + my custom value + + boolean_false= + boolean_true=true-ish + integer_false= + integer_true=true-ish + string_false= + string_true=true-ish + + boolean_false=false-ish + boolean_true=true-ish + integer_false=false-ish + integer_true=true-ish + string_false=false-ish + string_true=true-ish + + image +
+ diff --git a/Tests/Functional/Fixtures/mailer/output-2-true-true.txt b/Tests/Functional/Fixtures/mailer/output-2-true-true.txt new file mode 100644 index 0000000..d189799 --- /dev/null +++ b/Tests/Functional/Fixtures/mailer/output-2-true-true.txt @@ -0,0 +1,28 @@ + http://www.example.com this line should never be modified this link +should be injected [1] this custom link should be injected [2] this +link should be injected, and marker substituted [3] mailto link should +still work HTML entities encoded mailto link should still work [4] +###unknown_field_will_be_kept### +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email +recipient@example.com my custom value +http://unknown_field_will_be_kept +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email +http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email +recipient@example.com my custom value +https://unknown_field_will_be_kept +https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email +https://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bc%5D=d41d8cd98f00b204e9800998ecf8427e&tx_newsletter_p%5Baction%5D=unsubscribe&tx_newsletter_p%5Bcontroller%5D=Email +recipient@example.com my custom value boolean_false= +boolean_true=true-ish integer_false= integer_true=true-ish +string_false= string_true=true-ish boolean_false=false-ish +boolean_true=true-ish integer_false=false-ish integer_true=true-ish +string_false=false-ish string_true=true-ish + + +Links: +------ +[1] http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bn%5D=12345&tx_newsletter_p%5Bl%5D=83d3cea3f4e089b7f7131719049a6efa&tx_newsletter_p%5Baction%5D=clicked&tx_newsletter_p%5Bcontroller%5D=Link +[2] http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bn%5D=12345&tx_newsletter_p%5Bl%5D=37ba48a2031ad61f5b9b32759c650179&tx_newsletter_p%5Baction%5D=clicked&tx_newsletter_p%5Bcontroller%5D=Link +[3] http://example.com/index.php?id=2&type=1342671779&tx_newsletter_p%5Bn%5D=12345&tx_newsletter_p%5Bl%5D=1d6061672598d4a25c12d1e12c622bc2&tx_newsletter_p%5Baction%5D=clicked&tx_newsletter_p%5Bcontroller%5D=Link +[4] /mailto:john@example.com diff --git a/Tests/Functional/Fixtures/mailer/basic/output-true-true.html b/Tests/Functional/Fixtures/mailer/output-6-true-true.html similarity index 100% rename from Tests/Functional/Fixtures/mailer/basic/output-true-true.html rename to Tests/Functional/Fixtures/mailer/output-6-true-true.html diff --git a/Tests/Functional/Fixtures/mailer/basic/output-true-true.txt b/Tests/Functional/Fixtures/mailer/output-6-true-true.txt similarity index 100% rename from Tests/Functional/Fixtures/mailer/basic/output-true-true.txt rename to Tests/Functional/Fixtures/mailer/output-6-true-true.txt diff --git a/Tests/Functional/MailerTest.php b/Tests/Functional/MailerTest.php index 08e5385..998f6c6 100644 --- a/Tests/Functional/MailerTest.php +++ b/Tests/Functional/MailerTest.php @@ -46,12 +46,11 @@ public function setUp() $this->mockNewsletter = $this->getMock('Ecodev\\Newsletter\\Domain\\Model\\Newsletter', array('getUid', 'getPid', 'getBaseUrl', 'getSenderName', 'getSenderEmail', 'getValidatedContent', 'getInjectOpenSpy', 'getInjectLinksSpy'), array(), '', false); $this->mockNewsletter->method('getUid')->will($this->returnValue(12345)); - $this->mockNewsletter->method('getPid')->will($this->returnValue(789)); $this->mockNewsletter->method('getBaseUrl')->will($this->returnValue('http://example.com')); $this->mockNewsletter->method('getSenderName')->will($this->returnValue('John Connor')); $this->mockNewsletter->method('getSenderEmail')->will($this->returnValue('noreply@example.com')); - $this->mockEmail = $this->getMock('Ecodev\\Newsletter\\Domain\\Model\\Email', array('s'), array(), '', false); + $this->mockEmail = $this->getMock('Ecodev\\Newsletter\\Domain\\Model\\Email', array('getPid'), array(), '', false); $this->mockEmail->setRecipientData(array( 'email' => 'recipient@example.com', 'my_custom_field' => 'my custom value', @@ -66,31 +65,40 @@ public function setUp() $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['newsletter'] = serialize(array('attach_images' => true)); } + private function getData($pid, $injectOpenSpy, $injectLinksSpy) + { + $folder = __DIR__ . '/Fixtures/mailer'; + $flags = implode('-', array($pid, var_export($injectOpenSpy, true), var_export($injectLinksSpy, true))); + + return array( + $pid, + $injectOpenSpy, + $injectLinksSpy, + $folder . '/input.html', + $folder . "/output-$flags.html", + $folder . "/output-$flags.txt", + ); + } + public function dataProviderTestMailer() { $data = array(); - foreach (glob(__DIR__ . '/Fixtures/mailer/*', GLOB_ONLYDIR) as $folder) { - foreach (array(false, true) as $injectLinksSpy) { - foreach (array(false, true) as $injectOpenSpy) { - $flags = var_export($injectOpenSpy, true) . '-' . var_export($injectLinksSpy, true); - $data[] = array( - $injectOpenSpy, - $injectLinksSpy, - $folder . '/input.html', - $folder . "/output-$flags.html", - $folder . "/output-$flags.txt", - ); - } + foreach (array(false, true) as $injectLinksSpy) { + foreach (array(false, true) as $injectOpenSpy) { + $data[] = $this->getData(2, $injectOpenSpy, $injectLinksSpy); } } + // One more test with a different PID that should output different domains + $data[] = $this->getData(6, true, true); + return $data; } /** * @dataProvider dataProviderTestMailer */ - public function testMailer($injectOpenSpy, $injectLinksSpy, $inputFile, $expectedHtmlFile, $expectedPlainFile) + public function testMailer($pid, $injectOpenSpy, $injectLinksSpy, $inputFile, $expectedHtmlFile, $expectedPlainFile) { $input = file_get_contents($inputFile); $expectedHtml = file_get_contents($expectedHtmlFile); @@ -106,6 +114,8 @@ public function testMailer($injectOpenSpy, $injectLinksSpy, $inputFile, $expecte )); $this->mockNewsletter->method('getInjectOpenSpy')->will($this->returnValue($injectOpenSpy)); $this->mockNewsletter->method('getInjectLinksSpy')->will($this->returnValue($injectLinksSpy)); + $this->mockNewsletter->method('getPid')->will($this->returnValue($pid)); + $this->mockEmail->method('getPid')->will($this->returnValue($pid)); $mailer = $this->objectManager->get('Ecodev\\Newsletter\\Mailer'); diff --git a/Tests/Functional/Repository/LinkRepositoryTest.php b/Tests/Functional/Repository/LinkRepositoryTest.php index f5171ad..26be9d9 100644 --- a/Tests/Functional/Repository/LinkRepositoryTest.php +++ b/Tests/Functional/Repository/LinkRepositoryTest.php @@ -76,7 +76,7 @@ public function testRegisterClick() { $authCodeForLink = md5($this->authCode . 3001); $url = $this->linkRepository->registerClick(30, $authCodeForLink, false); - $this->assertSame('http://example.com/index.php?id=1&type=1342671779&tx_newsletter_p%5Bc%5D=87c4e9b09085befbb7f20faa7482213a&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email', $url, 'the URL returned must have markers substituted'); + $this->assertSame('http://example.com/index.php?id=3&type=1342671779&tx_newsletter_p%5Bc%5D=87c4e9b09085befbb7f20faa7482213a&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email', $url, 'the URL returned must have markers substituted'); $link = $this->linkRepository->findByUid(3001); $this->assertSame(1, $link->getOpenedCount(), 'the link opened count must have been incrementated');