Skip to content

Commit

Permalink
[TASK] Adjust functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
schloram authored and lukaszuznanski committed Nov 7, 2023
1 parent fb8a805 commit 043f1af
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Tests/Functional/ContentTypes/BaseContentTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ protected function checkHeaderFields($contentElement, $header = '', $subheader =
self::assertTrue(isset($contentElementContent['headerLink']), 'headerLink not set');
}

protected function checkHeaderFieldsLink($contentElement, $link, $urlPrefix, $target)
protected function checkHeaderFieldsLink($contentElement, $linkText, $urlPrefix, $target)
{
$contentElementHeaderFieldsLink = $contentElement['content']['headerLink'];

self::assertIsArray($contentElementHeaderFieldsLink, 'headerLink not an array');
self::assertEquals($link, $contentElementHeaderFieldsLink['linkText'], 'link mismatch');
self::assertEquals($linkText, $contentElementHeaderFieldsLink['linkText'], 'linkText mismatch');
self::assertStringStartsWith($urlPrefix, $contentElementHeaderFieldsLink['href'], 'url mismatch');
self::assertEquals($target, $contentElementHeaderFieldsLink['target'], 'target mismatch');
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/ContentTypes/BasicListElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testBasicListContentElement()
$this->checkDefaultContentFields($contentElement, 6, 1, 'BasicList', 0);
$this->checkAppearanceFields($contentElement, 'layout-1', 'Frame', 'SpaceBefore', 'SpaceAfter');
$this->checkHeaderFields($contentElement, 'Header', 'SubHeader', 1, 2);
$this->checkHeaderFieldsLink($contentElement, 't3://page?uid=2 _blank LinkClass LinkTitle parameter=999', '/page1?parameter=999&cHash=', '_blank');
$this->checkHeaderFieldsLink($contentElement, 'Page 1', '/page1?parameter=999&cHash=', '_blank');
self::assertFalse(isset($contentElement['content']['bodytext']));
}
}
2 changes: 1 addition & 1 deletion Tests/Functional/ContentTypes/BulletsElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testBulletsContentElement()
$this->checkDefaultContentFields($contentElement, 8, 1, 'bullets', 0);
$this->checkAppearanceFields($contentElement, 'layout-1', 'Frame', 'SpaceBefore', 'SpaceAfter');
$this->checkHeaderFields($contentElement, 'Header', 'SubHeader', 1, 2);
$this->checkHeaderFieldsLink($contentElement, 't3://page?uid=2 _blank LinkClass LinkTitle parameter=999', '/page1?parameter=999&cHash=', '_blank');
$this->checkHeaderFieldsLink($contentElement, 'Page 1', '/page1?parameter=999&cHash=', '_blank');

self::assertEquals(1, $contentElement['content']['bulletsType']);
self::assertTrue(is_array($contentElement['content']['bodytext']));
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/ContentTypes/HeaderElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function testHeaderContentElement()
$this->checkDefaultContentFields($contentElement, 3, 1, 'header', 0);
$this->checkAppearanceFields($contentElement, 'layout-1', 'Frame', 'SpaceBefore', 'SpaceAfter');
$this->checkHeaderFields($contentElement, 'Header', 'SubHeader', 1, 2);
$this->checkHeaderFieldsLink($contentElement, 't3://page?uid=2 _blank LinkClass LinkTitle parameter=999', '/page1?parameter=999&cHash=', '_blank');
$this->checkHeaderFieldsLink($contentElement, 'Page 1', '/page1?parameter=999&cHash=', '_blank');
}
}
2 changes: 1 addition & 1 deletion Tests/Functional/ContentTypes/ShortcutElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testShortcutContentElement()
$this->checkDefaultContentFields($contentElement['content']['shortcut'][1], 1, 1, 'text', 0, 'SysCategory1Title,SysCategory2Title');
$this->checkAppearanceFields($contentElement['content']['shortcut'][1], 'layout-1', 'Frame', 'SpaceBefore', 'SpaceAfter');
$this->checkHeaderFields($contentElement['content']['shortcut'][1], 'Header', 'SubHeader', 1, 2);
$this->checkHeaderFieldsLink($contentElement['content']['shortcut'][1], 't3://page?uid=2 _blank LinkClass LinkTitle parameter=999', '/page1?parameter=999&cHash=', '_blank');
$this->checkHeaderFieldsLink($contentElement['content']['shortcut'][1], 'Page 1', '/page1?parameter=999&cHash=', '_blank');
self::assertStringContainsString('<a href="/page1?parameter=999&amp;cHash=', $contentElement['content']['shortcut'][1]['content']['bodytext']);
}
}
2 changes: 1 addition & 1 deletion Tests/Functional/ContentTypes/TableElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testTableContentElement()
$this->checkDefaultContentFields($contentElement, 7, 1, 'table', 0);
$this->checkAppearanceFields($contentElement, 'layout-1', 'Frame', 'SpaceBefore', 'SpaceAfter');
$this->checkHeaderFields($contentElement, 'Header', 'SubHeader', 1, 2);
$this->checkHeaderFieldsLink($contentElement, 't3://page?uid=2 _blank LinkClass LinkTitle parameter=999', '/page1?parameter=999&cHash=', '_blank');
$this->checkHeaderFieldsLink($contentElement, 'Page 1', '/page1?parameter=999&cHash=', '_blank');

self::assertEquals('TableCaption', $contentElement['content']['tableCaption']);
self::assertEquals(1, $contentElement['content']['tableHeaderPosition']);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/ContentTypes/TextElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testTextContentElement()
$this->checkDefaultContentFields($contentElement, 1, 1, 'text', 0, 'SysCategory1Title,SysCategory2Title');
$this->checkAppearanceFields($contentElement, 'layout-1', 'Frame', 'SpaceBefore', 'SpaceAfter');
$this->checkHeaderFields($contentElement, 'Header', 'SubHeader', 1, 2);
$this->checkHeaderFieldsLink($contentElement, 't3://page?uid=2 _blank LinkClass LinkTitle parameter=999', '/page1?parameter=999&cHash=', '_blank');
$this->checkHeaderFieldsLink($contentElement, 'Page 1', '/page1?parameter=999&cHash=', '_blank');

// typolink parser was called on bodytext
self::assertStringContainsString('<a href="/page1?parameter=999&amp;cHash=', $contentElement['content']['bodytext']);
Expand Down

0 comments on commit 043f1af

Please sign in to comment.