mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-12-22 23:46:10 +01:00

[FEATURE] Functional tests for the tea controller (#21)

This commit is contained in:
Oliver Klee 2018-05-27 00:28:13 +02:00 committed by GitHub
parent dd1ea7868d
commit a4089e04e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 137 additions and 2 deletions

View file

@ -12,8 +12,6 @@ env:
- typo3DatabaseHost=localhost typo3DatabaseName=typo3 typo3DatabaseUsername=travis typo3DatabasePassword=''
- TYPO3_PATH_ROOT=$PWD/.Build/public
matrix:
- TYPO3_VERSION="^7.6" DEPENDENCIES=latest
- TYPO3_VERSION="^7.6" DEPENDENCIES=oldest
- TYPO3_VERSION="^8.7" DEPENDENCIES=latest
- TYPO3_VERSION="^8.7" DEPENDENCIES=oldest

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<pages>
<uid>1</uid>
<pid>0</pid>
<title>Root</title>
<doktype>1</doktype>
<perms_everybody>15</perms_everybody>
</pages>
<tt_content>
<uid>1</uid>
<pid>1</pid>
<CType>list</CType>
<list_type>tea_tea</list_type>
<pi_flexform><![CDATA[
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3FlexForms>
<data>
<sheet index="general">
<language index="lDEF">
<field index="switchableControllerActions">
<value index="vDEF">Tea-&gt;index</value>
</field>
</language>
</sheet>
</data>
</T3FlexForms>
]]></pi_flexform>
</tt_content>
</dataset>

View file

@ -0,0 +1,54 @@
lib.dynamicContent = COA
lib.dynamicContent {
10 = LOAD_REGISTER
10.colPos.cObject = TEXT
10.colPos.cObject {
field = colPos
ifEmpty.cObject = TEXT
ifEmpty.cObject {
value.current = 1
ifEmpty = 0
}
}
20 = CONTENT
20 {
table = tt_content
select {
orderBy = sorting
where = colPos={register:colPos}
where.insertData = 1
}
}
90 = RESTORE_REGISTER
}
config {
doctype = html5
xmlprologue = none
inlineStyle2TempFile = 0
removeDefaultJS = 0
compressJs = 0
concatenateJs = 0
compressCss = 0
concatenateCss = 0
no_cache = 1
debug = 0
xhtml_cleaning = 0
admPanel = 0
disableAllHeaderCode = 1
sendCacheHeaders = 0
absRefPrefix = /
contentObjectExceptionHandler = 0
}
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
file = EXT:tea/Tests/Functional/Controller/Fixtures/Frontend/Template.html
}
}

View file

@ -0,0 +1 @@
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="{colPos: '0'}"/>

View file

@ -0,0 +1,51 @@
<?php
declare(strict_types = 1);
namespace OliverKlee\Tea\Tests\Functional\Controller;
use Nimut\TestingFramework\TestCase\FunctionalTestCase;
/**
* Test case.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaControllerTest extends FunctionalTestCase
{
/**
* @var string[]
*/
protected $testExtensionsToLoad = ['typo3conf/ext/tea'];
/**
* @var string[]
*/
protected $coreExtensionsToLoad = ['fluid_styled_content'];
protected function setUp()
{
parent::setUp();
$this->importDataSet(__DIR__ . '/Fixtures/Database/pages.xml');
$this->importDataSet(__DIR__ . '/../Domain/Repository/Fixtures/Product/Tea.xml');
$this->setUpFrontendRootPage(
1,
[
'EXT:fluid_styled_content/Configuration/TypoScript/setup.txt',
'EXT:tea/Configuration/TypoScript/setup.txt',
'EXT:tea/Tests/Functional/Controller/Fixtures/Frontend/Basic.typoscript',
]
);
}
/**
* @test
*/
public function indexActionRendersTeaTitle()
{
$responseContent = $this->getFrontendResponse(1)->getContent();
$teaTitle = 'Earl Grey';
$this->assertContains($teaTitle, $responseContent);
}
}

View file

@ -32,6 +32,7 @@
"typo3/cms-frontend": "^7.6.23 || ^8.7.9"
},
"require-dev": {
"typo3/cms-fluid-styled-content": "^7.6.23 || ^8.7.9",
"helhum/typo3-composer-setup": "^0.5.1",
"helmich/typo3-typoscript-lint": "^1.4.4",
"nimut/testing-framework": "^3.0.0",