/**
     * @covers Openbuildings\Swiftmailer\GoogleCampaignPlugin::embedCampaigns
     */
    public function test_embed_campaigns()
    {
        $html = <<<HTML
<html><head></head><body><a class="some-class" href="http://example.com" data-some-attribute="test">Example.com
and some text <img src="http://example.com/image.png"/></a></body></html>
HTML;
        $expected_html = <<<HTML
<html><head></head><body><a class="some-class" href="http://example.com?utm_source=my_source" data-some-attribute="test">Example.com
and some text <img src="http://example.com/image.png"/></a></body></html>
HTML;
        $converted_html = GoogleCampaignPlugin::embedCampaigns($html, array('utm_source' => 'my_source'), array(), 'UTF-8');
        $this->assertEquals($expected_html, $converted_html);
    }
 /**
  *
  * @param Swift_Events_SendEvent $event
  */
 public function beforeSendPerformed(Swift_Events_SendEvent $event)
 {
     $message = $event->getMessage();
     if ($message->getContentType() === 'text/html') {
         $html = GoogleCampaignPlugin::embedCampaigns($message->getBody(), $this->getCampaign(), $this->getAdditionalCampaigns());
         $message->setBody($html);
     }
     foreach ($message->getChildren() as $part) {
         if (strpos($part->getContentType(), 'text/html') !== false) {
             $html = GoogleCampaignPlugin::embedCampaigns($part->getBody(), $this->getCampaign(), $this->getAdditionalCampaigns());
             $part->setBody($html);
         }
     }
 }