Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Fix PHP 8.0 warning with inline sychronize
Scenario: * Add a content element with an image in default language. * Translate the content element to some other language, this will create the image in the localized element, too. * Edit the default language element and add another image. * Edit the localized element, see the 'shadowed' new image, click "localize" button on the right. -> Red error pop up, logged warning: "Array to string conversion" in FormInlineAjaxController.php The patch fixes this, and adds two acceptance tests to have a basic coverage for the new content element wizard, the element browser inline image selection, and the localization 'synchronize' process. Change-Id: I9c930d3b7b625b96b6321c14c455d0e62f70b5dc Resolves: #97090 Releases: main, 11.5 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/73803 Tested-by: core-ci <typo3@b13.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
- Loading branch information
Showing
4 changed files
with
192 additions
and
6 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
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
119 changes: 119 additions & 0 deletions
119
...e/Tests/Acceptance/Application/FormEngine/InlineContentElementLocalizeSynchronizeCest.php
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,119 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine; | ||
|
||
use Facebook\WebDriver\Remote\RemoteWebDriver; | ||
use Facebook\WebDriver\WebDriverBy; | ||
use TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester; | ||
use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree; | ||
|
||
class InlineContentElementLocalizeSynchronizeCest | ||
{ | ||
public function _before(ApplicationTester $I, PageTree $pageTree): void | ||
{ | ||
$I->useExistingSession('admin'); | ||
|
||
$I->click('Page'); | ||
$I->waitForElement('svg .nodes .node'); | ||
$pageTree->openPath(['styleguide TCA demo', 'staticdata']); | ||
$I->switchToContentFrame(); | ||
$I->waitForText('staticdata', 20); | ||
} | ||
|
||
public function addingResourceToDefaultLangPageAddResourceToLocalizedPage(ApplicationTester $I): void | ||
{ | ||
// Add a content element type images and localize it | ||
$I->click('.module-body td[data-language-uid="0"] span[data-identifier="actions-add"]'); | ||
$I->switchToWindow(); | ||
$I->waitForText('Images Only'); | ||
$I->click('Images Only'); | ||
$I->switchToContentFrame(); | ||
$I->waitForText('Create new Page Content on page "staticdata"', 3, 'h1'); | ||
$I->click('Images'); | ||
// Inline add record in Resources tab | ||
$I->click('Images'); | ||
$I->click('span[data-identifier="actions-insert-record"]', 'div.active'); | ||
$I->switchToWindow(); | ||
$I->switchToIFrame('modal_frame'); | ||
// Find page 'styleguide' in page tree of modal and click it | ||
$context = $I->executeInSelenium(function (RemoteWebDriver $webdriver) { | ||
$context = $webdriver->findElement(WebDriverBy::cssSelector('div.element-browser-main-sidebar')); | ||
return $context->findElement(WebDriverBy::xpath('//*[text()=\'styleguide\']/..')); | ||
}); | ||
// Add an image, closes modal again | ||
$context->findElement(WebDriverBy::cssSelector('text.node-name'))->click(); | ||
$I->waitForElementVisible('#typo3-filelist a[data-file-name="telephone_box.jpg"]'); | ||
$I->click('#typo3-filelist a[data-file-name="telephone_box.jpg"]'); | ||
// Save, go back to page | ||
$I->switchToWindow(); | ||
$I->switchToContentFrame(); | ||
$I->click('.module-docheader a[title="Close"]'); | ||
$I->switchToWindow(); | ||
$I->waitForText('Save and close'); | ||
$I->click('Save and close'); | ||
// Switch to "All languages" view and localize content element | ||
$I->switchToContentFrame(); | ||
$I->waitForElementVisible('select[name=actionMenu]'); | ||
$I->selectOption('select[name=actionMenu]', 'Languages'); | ||
$I->waitForElementVisible('select[name=languageMenu]'); | ||
$I->selectOption('select[name=languageMenu]', 'All languages'); | ||
$I->waitForText('Translate'); | ||
$I->click('Translate'); | ||
$I->switchToWindow(); | ||
$I->waitForText('Localize page "staticdata - language 1" into styleguide demo language danish'); | ||
$I->click('span[data-identifier="actions-localize"]'); | ||
$I->click('Next'); | ||
$I->waitForText('Normal'); | ||
$I->click('Next'); | ||
$I->switchToContentFrame(); | ||
$I->waitForText('(copy 1)'); | ||
// Edit default language content element again and add another image | ||
$I->click('.module-body td[data-language-uid="0"] span[data-identifier="actions-open"]'); | ||
$I->waitForText('Edit Page Content on page "staticdata"', 3, 'h1'); | ||
$I->click('Images'); | ||
$I->click('span[data-identifier="actions-insert-record"]', 'div.active'); | ||
$I->switchToWindow(); | ||
$I->switchToIFrame('modal_frame'); | ||
// Find page 'styleguide' in page tree of modal and click it | ||
$context = $I->executeInSelenium(function (RemoteWebDriver $webdriver) { | ||
$context = $webdriver->findElement(WebDriverBy::cssSelector('div.element-browser-main-sidebar')); | ||
return $context->findElement(WebDriverBy::xpath('//*[text()=\'styleguide\']/..')); | ||
}); | ||
// Add an image, closes modal again | ||
$context->findElement(WebDriverBy::cssSelector('text.node-name'))->click(); | ||
$I->waitForElementVisible('#typo3-filelist a[data-file-name="underground.jpg"]'); | ||
$I->click('#typo3-filelist a[data-file-name="underground.jpg"]'); | ||
// Save, go back to page | ||
$I->switchToWindow(); | ||
$I->switchToContentFrame(); | ||
$I->click('.module-docheader a[title="Close"]'); | ||
$I->switchToWindow(); | ||
$I->waitForText('Save and close'); | ||
$I->click('Save and close'); | ||
// Open the localized element and see that the second image can be synchronized | ||
$I->switchToContentFrame(); | ||
$I->waitForText('(copy 1)'); | ||
$I->click('.module-body td[data-language-uid="1"] span[data-identifier="actions-open"]'); | ||
$I->waitForText('Edit Page Content " (copy 1)" on page "staticdata"', 3, 'h1'); | ||
$I->click('Images'); | ||
$I->waitForText('underground.jpg'); | ||
$I->click('span[data-identifier="actions-document-localize"]'); | ||
// Synchronized image has been opened | ||
$I->waitForText('Image Metadata'); | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
...3/sysext/core/Tests/Acceptance/Application/FormEngine/InlinePagesLocalizeResourceCest.php
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,72 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine; | ||
|
||
use Facebook\WebDriver\Remote\RemoteWebDriver; | ||
use Facebook\WebDriver\WebDriverBy; | ||
use TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester; | ||
use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree; | ||
|
||
class InlinePagesLocalizeResourceCest | ||
{ | ||
public function _before(ApplicationTester $I, PageTree $pageTree): void | ||
{ | ||
$I->useExistingSession('admin'); | ||
|
||
$I->click('List'); | ||
$I->waitForElement('svg .nodes .node'); | ||
$pageTree->openPath(['styleguide TCA demo', 'staticdata']); | ||
$I->switchToContentFrame(); | ||
$I->waitForText('staticdata', 20); | ||
} | ||
|
||
public function addingResourceToDefaultLangPageAddResourceToLocalizedPage(ApplicationTester $I): void | ||
{ | ||
// Add an image to media field of default lang page | ||
$I->click('.module-docheader a[title="Edit page properties"]'); | ||
$I->waitForText('Edit Page "staticdata"', 3, 'h1'); | ||
// Inline add record in Resources tab | ||
$I->click('Resources'); | ||
$I->click('span[data-identifier="actions-insert-record"]', 'div.active'); | ||
$I->switchToWindow(); | ||
$I->switchToIFrame('modal_frame'); | ||
// Find page 'styleguide' in page tree of modal and click it | ||
$context = $I->executeInSelenium(function (RemoteWebDriver $webdriver) { | ||
$context = $webdriver->findElement(WebDriverBy::cssSelector('div.element-browser-main-sidebar')); | ||
return $context->findElement(WebDriverBy::xpath('//*[text()=\'styleguide\']/..')); | ||
}); | ||
// Add an image, closes modal again | ||
$context->findElement(WebDriverBy::cssSelector('text.node-name'))->click(); | ||
$I->waitForElementVisible('#typo3-filelist a[data-file-name="telephone_box.jpg"]'); | ||
$I->click('#typo3-filelist a[data-file-name="telephone_box.jpg"]'); | ||
// Save, go back to list | ||
$I->switchToWindow(); | ||
$I->switchToContentFrame(); | ||
$I->click('.module-docheader a[title="Close"]'); | ||
$I->switchToWindow(); | ||
$I->waitForText('Save and close'); | ||
$I->click('Save and close'); | ||
// Edit the page translation and see if that resource has been added. | ||
$I->switchToContentFrame(); | ||
$I->waitForText('staticdata - language 1'); | ||
$I->click('staticdata - language 1'); | ||
$I->waitForText('Edit Page "staticdata - language 1"', 3, 'h1'); | ||
$I->click('Resources'); | ||
$I->see('telephone_box.jpg'); | ||
} | ||
} |