diff --git a/modules/tide_site_preview/src/TideSitePreviewHelper.php b/modules/tide_site_preview/src/TideSitePreviewHelper.php index 4cb15a1..cb596f6 100644 --- a/modules/tide_site_preview/src/TideSitePreviewHelper.php +++ b/modules/tide_site_preview/src/TideSitePreviewHelper.php @@ -35,6 +35,8 @@ public function __construct(TideSiteHelper $site_helper) { * * @param \Drupal\node\NodeInterface $node * The node. + * @param \Drupal\Core\Url $url + * The url. * @param \Drupal\taxonomy\TermInterface $site * The site of the preview link. * @param \Drupal\taxonomy\TermInterface|null $section @@ -85,11 +87,12 @@ public function buildFrontendPreviewLink(NodeInterface $node, Url $url, TermInte * Get the frontend URL of a node. * * @param \Drupal\Core\Url $url - * The node. + * The url. * @param string $site_base_url * The base URL of the frontend. * @param array $url_options * The extra options. + * * @return \Drupal\Core\Url|string * The Url. */ @@ -97,7 +100,7 @@ public function getNodeFrontendUrl(Url $url, string $site_base_url = '', array $ try { $path = $url->toString(); $path = rtrim($path, '/'); - $clean_url = preg_replace('/\/site\-(\d+)\//', '/', $path,1); + $clean_url = preg_replace('/\/site\-(\d+)\//', '/', $path, 1); if ((strpos($clean_url, '/') !== 0) && (strpos($clean_url, '#') !== 0) && (strpos($clean_url, '?') !== 0)) { return $clean_url ? Url::fromUri($clean_url, $url_options) : $url; } @@ -106,7 +109,8 @@ public function getNodeFrontendUrl(Url $url, string $site_base_url = '', array $ return $clean_url ? Url::fromUri($clean_url, $url_options) : $url; } return $clean_url ? Url::fromUserInput($clean_url, $url_options) : $url; - } catch (Exception $exception) { + } + catch (Exception $exception) { watchdog_exception('tide_site_preview', $exception); } return ''; diff --git a/modules/tide_site_preview/tests/test_tide_site_preview/config/optional/field.field.taxonomy_term.sites.field_site_domains.yml b/modules/tide_site_preview/tests/modules/test_tide_site_preview/config/optional/field.field.taxonomy_term.sites.field_site_domains.yml similarity index 100% rename from modules/tide_site_preview/tests/test_tide_site_preview/config/optional/field.field.taxonomy_term.sites.field_site_domains.yml rename to modules/tide_site_preview/tests/modules/test_tide_site_preview/config/optional/field.field.taxonomy_term.sites.field_site_domains.yml diff --git a/modules/tide_site_preview/tests/test_tide_site_preview/config/optional/field.storage.taxonomy_term.field_site_domains.yml b/modules/tide_site_preview/tests/modules/test_tide_site_preview/config/optional/field.storage.taxonomy_term.field_site_domains.yml similarity index 100% rename from modules/tide_site_preview/tests/test_tide_site_preview/config/optional/field.storage.taxonomy_term.field_site_domains.yml rename to modules/tide_site_preview/tests/modules/test_tide_site_preview/config/optional/field.storage.taxonomy_term.field_site_domains.yml diff --git a/modules/tide_site_preview/tests/test_tide_site_preview/config/optional/taxonomy.vocabulary.sites.yml b/modules/tide_site_preview/tests/modules/test_tide_site_preview/config/optional/taxonomy.vocabulary.sites.yml similarity index 100% rename from modules/tide_site_preview/tests/test_tide_site_preview/config/optional/taxonomy.vocabulary.sites.yml rename to modules/tide_site_preview/tests/modules/test_tide_site_preview/config/optional/taxonomy.vocabulary.sites.yml diff --git a/modules/tide_site_preview/tests/test_tide_site_preview/test_tide_site_preview.info.yml b/modules/tide_site_preview/tests/modules/test_tide_site_preview/test_tide_site_preview.info.yml similarity index 100% rename from modules/tide_site_preview/tests/test_tide_site_preview/test_tide_site_preview.info.yml rename to modules/tide_site_preview/tests/modules/test_tide_site_preview/test_tide_site_preview.info.yml diff --git a/modules/tide_site_preview/tests/src/Kernel/TideSitePreviewHelperTest.php b/modules/tide_site_preview/tests/src/Kernel/TideSitePreviewHelperTest.php index 455d1a7..41e5db3 100644 --- a/modules/tide_site_preview/tests/src/Kernel/TideSitePreviewHelperTest.php +++ b/modules/tide_site_preview/tests/src/Kernel/TideSitePreviewHelperTest.php @@ -8,7 +8,7 @@ use Drupal\taxonomy\Entity\Term; /** - * Tests the TideSitePreviewHelper + * Tests the TideSitePreviewHelper. * * @group tide_site_preview */ @@ -99,6 +99,12 @@ public function testBuildFrontendPreviewLink($node_values, $url, $term_values, $ $this->assertEquals($expected, $url); } + /** + * Data provider of test dates. + * + * @return array + * Array of values. + */ public function buildFrontendPreviewLinkDataProvider() { return [ [