You are here

protected function EasyEmailTestBase::getIframeUrlAndQuery in Easy Email 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Functional/EasyEmailTestBase.php \Drupal\Tests\easy_email\Functional\EasyEmailTestBase::getIframeUrlAndQuery()

Parameters

\Behat\Mink\Element\NodeElement $iframe:

Return value

array

14 calls to EasyEmailTestBase::getIframeUrlAndQuery()
EasyEmailSendTest::testSaveWithoutSend in tests/src/Functional/EasyEmailSendTest.php
Tests email saving without sending.
EasyEmailSendTest::testSendHtmlAndPlainText in tests/src/Functional/EasyEmailSendTest.php
Tests sending email with an HTML and Plain Text version
EasyEmailSendTest::testSendHtmlGeneratePlainText in tests/src/Functional/EasyEmailSendTest.php
Tests email sending with plain text version generated from HTML version
EasyEmailSendTest::testSendHtmlOnly in tests/src/Functional/EasyEmailSendTest.php
Tests email sending with HTML version only
EasyEmailSendTest::testSendPlainOnly in tests/src/Functional/EasyEmailSendTest.php
Tests email sending with plain text version only

... See full list

File

tests/src/Functional/EasyEmailTestBase.php, line 220

Class

EasyEmailTestBase
Class EasyEmailTestBase

Namespace

Drupal\Tests\easy_email\Functional

Code

protected function getIframeUrlAndQuery(NodeElement $iframe) {
  $url = $iframe
    ->getAttribute('src');
  $front_url = Url::fromRoute('<front>', [], [
    'absolute' => FALSE,
  ]);
  $base_url = $front_url
    ->toString();
  $url = preg_replace('#^' . $base_url . '#', '', $url);
  $url = explode('?', $url);
  $query = [];
  if (!empty($url[1])) {
    $query_parts = explode('=', $url[1]);
    for ($i = 0; $i < count($query_parts); $i += 2) {
      $query[$query_parts[$i]] = $query_parts[$i + 1];
    }
  }
  return [
    'path' => $url[0],
    'query' => $query,
  ];
}