Skip to content

Commit

Permalink
Fixes unstable email integration tests, by decoding the raw contents …
Browse files Browse the repository at this point in the history
…which had a maximum line length of 76 to a parseable string without a maximum line length, so there is no chance a particular string used in an assertion is getting splitted over multiple lines.
  • Loading branch information
hostep committed Oct 29, 2019
1 parent 5e07374 commit 27e8916
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function testConfirm()

$this->assertContains(
'You have been successfully subscribed to our newsletter.',
$transportBuilder->getSentMessage()->getRawMessage()
$transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function testSend($isCustomerIdUsed)

$this->assertContains(
'John Smith,',
$this->transportBuilder->getSentMessage()->getRawMessage()
$this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function testProcess()
$this->observer->process();
$this->assertContains(
'John Smith,',
$this->transportBuilder->getSentMessage()->getRawMessage()
$this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
);
}

Expand Down Expand Up @@ -117,7 +117,7 @@ public function testProcessPortuguese()

// dispatch process() method and check sent message
$this->observer->process();
$message = $this->transportBuilder->getSentMessage()->getRawMessage();
$message = $this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent();
$expectedText = array_shift($translation);
$this->assertContains('/frontend/Magento/luma/pt_BR/', $message);
$this->assertContains(substr($expectedText, 0, 50), $message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function testSendAction()
\Magento\TestFramework\Mail\Template\TransportBuilderMock::class
);

$actualResult = quoted_printable_decode($transportBuilder->getSentMessage()->getRawMessage());
$actualResult = $transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent();

$this->assertStringMatchesFormat(
'%A' . $this->_customerViewHelper->getCustomerName($this->_customerSession->getCustomerDataObject())
Expand Down

0 comments on commit 27e8916

Please sign in to comment.