public function testRegisterClick() { $authCodeForLink = md5($this->authCode . 3001); $this->linkRepository->registerClick(30, $authCodeForLink, false); $link = $this->linkRepository->findByUid(3001); $this->assertEquals(1, $link->getOpenedCount(), 'the link opened count must have been incrementated'); $this->assertRecipientListCallbackWasCalled('clicked recipient2@example.com'); $db = $this->getDatabaseConnection(); $count = $db->exec_SELECTcountRows('*', 'tx_newsletter_domain_model_linkopened', 'link = 3001 AND email = 302'); $this->assertEquals(1, $count, 'must have exactly 1 linkopened record for this link'); $email = $this->emailRepository->findByUid(302); $this->assertTrue($email->isOpened(), 'email should be marked as open, even if the open spy did not work, because a link was clicked'); $this->assertRecipientListCallbackWasCalled('opened recipient2@example.com'); }
public function testRegisterClick() { $authCodeForLink = md5($this->authCode . 3001); $url = $this->linkRepository->registerClick(30, $authCodeForLink, false); $this->assertEquals('http://example.com/index.php?id=1&tx_newsletter_p%5Baction%5D=show&tx_newsletter_p%5Bcontroller%5D=Email&type=1342671779&c=87c4e9b09085befbb7f20faa7482213a', $url, 'the URL returned must have markers substituted'); $link = $this->linkRepository->findByUid(3001); $this->assertEquals(1, $link->getOpenedCount(), 'the link opened count must have been incrementated'); $this->assertRecipientListCallbackWasCalled('clicked recipient2@example.com'); $db = $this->getDatabaseConnection(); $count = $db->exec_SELECTcountRows('*', 'tx_newsletter_domain_model_linkopened', 'link = 3001 AND email = 302'); $this->assertEquals(1, $count, 'must have exactly 1 linkopened record for this link'); $email = $this->emailRepository->findByUid(302); $this->assertTrue($email->isOpened(), 'email should be marked as open, even if the open spy did not work, because a link was clicked'); $this->assertRecipientListCallbackWasCalled('opened recipient2@example.com'); }