-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cbaa43
commit 1f7ae6f
Showing
6 changed files
with
160 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/Build/Local/report | ||
/Build/Local/.phpunit.result.cache | ||
/Documentation-GENERATED-temp | ||
/tempfile.sh | ||
/out.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<dataset> | ||
<pages> | ||
<uid>7</uid> | ||
<pid>1</pid> | ||
<title>Storage</title> | ||
</pages> | ||
<pages> | ||
<uid>9</uid> | ||
<pid>1</pid> | ||
<title>Single Pid</title> | ||
</pages> | ||
</dataset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace FriendsOfTYPO3\TtAddress\Tests\Functional\Hooks; | ||
|
||
/** | ||
* This file is part of the "tt_address" Extension for TYPO3 CMS. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
*/ | ||
|
||
use FriendsOfTYPO3\TtAddress\Hooks\PageLayoutViewHook; | ||
use TYPO3\CMS\Backend\Utility\BackendUtility; | ||
use TYPO3\CMS\Backend\View\PageLayoutView; | ||
use TYPO3\CMS\Core\Localization\LanguageService; | ||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; | ||
|
||
class PageLayoutViewHookTest extends FunctionalTestCase | ||
{ | ||
protected $testExtensionsToLoad = ['typo3conf/ext/tt_address']; | ||
|
||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
$this->importDataSet(__DIR__ . '/../Fixtures/tt_address.xml'); | ||
$this->importDataSet(__DIR__ . '/../Fixtures/tt_content.xml'); | ||
$this->importDataSet(__DIR__ . '/../Fixtures/pages.xml'); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function previewRowIsEnriched(): void | ||
{ | ||
$languageService = $this->getAccessibleMock(LanguageService::class, ['sl'], [], '', false, false); | ||
$languageService->expects($this->any())->method('sl')->willReturn('dummy label'); | ||
|
||
$GLOBALS['LANG'] = $languageService; | ||
|
||
$pageLayoutViewMock = $this->getAccessibleMock(PageLayoutView::class, ['dummy'], [], '', false); | ||
$drawItem = true; | ||
$headerContent = 'header'; | ||
$itemContent = 'item'; | ||
$row = BackendUtility::getRecord('tt_content', 4); | ||
$subject = new PageLayoutViewHook(); | ||
$subject->preProcess($pageLayoutViewMock, $drawItem, $headerContent, $itemContent, $row); | ||
|
||
$this->assertEquals('John', $row['_computed']['singleRecords'][0]['first_name']); | ||
$this->assertEquals('Jane', $row['_computed']['singleRecords'][1]['first_name']); | ||
$this->assertEquals('Madrid', $row['_computed']['groups'][0]['title']); | ||
$this->assertEquals('Kiev', $row['_computed']['groups'][1]['title']); | ||
$this->assertEquals('Storage', $row['_computed']['pages'][0]['title']); | ||
$this->assertEquals('Single Pid', $row['_computed']['singlePid']['title']); | ||
} | ||
} |