Skip to content

Commit

Permalink
[TASK] Added functional tests and replaced require with autoloading
Browse files Browse the repository at this point in the history
  • Loading branch information
galoppi committed Aug 6, 2015
1 parent a5f35b3 commit ce97354
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
26 changes: 24 additions & 2 deletions Tests/Functional/Service/ContentServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
* The TYPO3 project - inspiring people to share!
*/

require_once 'typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php';
// Register composer autoloader
if (!file_exists(__DIR__ . '/../../../vendor/autoload.php')) {
throw new \RuntimeException(
'Could not find vendor/autoload.php, make sure you ran composer.'
);
}

/** @var Composer\Autoload\ClassLoader $autoloader */
$autoloader = require __DIR__ . '/../../../vendor/autoload.php';
$autoloader->addPsr4('TYPO3\\CMS\\Core\\Tests\\Functional\\DataHandling\\', __DIR__ . '/../../../vendor/typo3/cms/typo3/sysext/core/Tests/Functional/DataHandling/');

use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase;
Expand Down Expand Up @@ -44,6 +53,8 @@ class ContentServiceTest extends AbstractDataHandlerActionTestCase {
const FLUIDCONTENT_NESTED_OUTER_CONTAINER_ID = 300;
const FLUIDCONTENT_NESTED_INNER_CONTAINER_ID = 301;
const FLUIDCONTENT_NESTED_INNER_CONTENT_ID = 302;
const LANGUAGE_DEFAULT = 0;
const LANGUAGE_TARGET = 1;

public function setUp() {
parent::setUp();
Expand Down Expand Up @@ -334,5 +345,16 @@ public function copyNestedFluidcontentElementToDifferentPage() {
$this->assertContentInFluxElement($newInnerContainerRecord['uid'], 'headline', $newContentRecord);
}

/**
* @test
*
* creates a localisation of a standard content element that doesn't reside in a flux container
* and checks, if this doesn't have a flux parent
*/
public function translatedRecordOutsideFluxElementHasFluxParentZeroAfterCreation() {
$mappingArray = $this->actionService->localizeRecord('tt_content', self::CONTENT_ID_BELOW, self::LANGUAGE_TARGET);

$localizedRecord = BackendUtility::getRecord('tt_content', $mappingArray['tt_content'][self::CONTENT_ID_BELOW]);
$this->assertContentNotInFluxElement($localizedRecord);
}
}

5 changes: 4 additions & 1 deletion Tests/Functional/Service/DataSet/DefaultElements.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"sys_language",,,,,,,,,,,,,,,
,"uid","pid","hidden","title","flag",,,,,,,,,,
,1,0,0,"English","en",,,,,,,,,,
"pages",
,"uid","pid","title"
,"100","0","first page"
Expand All @@ -10,4 +13,4 @@
,"203","100","text","64","0","text element on page before content","","0"
,"300","100","fluidcontent_content","64","0","fluidcontent element","","0"
,"301","100","fluidcontent_content","128","18181","nested fluidcontent element","column1","300"
,"302","100","text","256","18181","text element in nested fluidcontent","headline","301"
,"302","100","text","256","18181","text element in nested fluidcontent","headline","301"

0 comments on commit ce97354

Please sign in to comment.