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 - Part 2.
  • Loading branch information
hostep committed Apr 18, 2020
1 parent 2f95281 commit 3ec905f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ public function testUnsubscribeSubscribe(): void
$this->assertEquals($subscriber, $subscriber->unsubscribe());
$this->assertContains(
'You have been unsubscribed from the newsletter.',
$this->transportBuilder->getSentMessage()->getRawMessage()
$this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
);
$this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $subscriber->getSubscriberStatus());
// Subscribe and verify
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->subscribe('customer@example.com'));
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->getSubscriberStatus());
$this->assertContains(
'You have been successfully subscribed to our newsletter.',
$this->transportBuilder->getSentMessage()->getRawMessage()
$this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
);
}

Expand All @@ -116,14 +116,14 @@ public function testUnsubscribeSubscribeByCustomerId(): void
$this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $subscriber->getSubscriberStatus());
$this->assertContains(
'You have been unsubscribed from the newsletter.',
$this->transportBuilder->getSentMessage()->getRawMessage()
$this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
);
// Subscribe and verify
$this->assertSame($subscriber, $subscriber->subscribeCustomerById(1));
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->getSubscriberStatus());
$this->assertContains(
'You have been successfully subscribed to our newsletter.',
$this->transportBuilder->getSentMessage()->getRawMessage()
$this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
);
}

Expand All @@ -143,7 +143,7 @@ public function testConfirm(): void
$subscriber->confirm($subscriber->getSubscriberConfirmCode());
$this->assertContains(
'You have been successfully subscribed to our newsletter.',
$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 @@ -101,8 +101,8 @@ public function testSend($isCustomerIdUsed)
$this->_emailModel->send();

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

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

Expand Down

0 comments on commit 3ec905f

Please sign in to comment.