mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-09-19 23:36:13 +02:00

[CLEANUP] Reformat the code as PSR-2

This commit is contained in:
Oliver Klee 2016-05-07 21:43:25 +02:00
parent 39db663279
commit b6bb92d0da
25 changed files with 1591 additions and 1493 deletions

View file

@ -21,19 +21,21 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TestimonialController extends ActionController {
/**
* @inject
* @var \OliverKlee\Tea\Domain\Repository\TestimonialRepository
*/
protected $testimonialRepository = null;
class TestimonialController extends ActionController
{
/**
* @inject
* @var \OliverKlee\Tea\Domain\Repository\TestimonialRepository
*/
protected $testimonialRepository = null;
/**
* Lists all testimonials.
*
* @return void
*/
public function indexAction() {
$this->view->assign('testimonials', $this->testimonialRepository->findAll());
}
/**
* Lists all testimonials.
*
* @return void
*/
public function indexAction()
{
$this->view->assign('testimonials', $this->testimonialRepository->findAll());
}
}

View file

@ -19,26 +19,29 @@ namespace OliverKlee\Tea\Domain\Model;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class Addition extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject {
/**
* @var string
* @validate NotEmpty
*/
protected $title = '';
class Addition extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
{
/**
* @var string
* @validate NotEmpty
*/
protected $title = '';
/**
* @return string $title
*/
public function getTitle() {
return $this->title;
}
/**
* @return string $title
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
*
* @return void
*/
public function setTitle($title) {
$this->title = $title;
}
/**
* @param string $title
*
* @return void
*/
public function setTitle($title)
{
$this->title = $title;
}
}

View file

@ -19,154 +19,169 @@ namespace OliverKlee\Tea\Domain\Model;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* @var float
*/
protected $size = 0.0;
class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var float
*/
protected $size = 0.0;
/**
* @var \OliverKlee\Tea\Domain\Model\TeaType
* @lazy
*/
protected $type = null;
/**
* @var \OliverKlee\Tea\Domain\Model\TeaType
* @lazy
*/
protected $type = null;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Addition>
* @lazy
*/
protected $additions = null;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Addition>
* @lazy
*/
protected $additions = null;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Testimonial>
* @lazy
*/
protected $testimonials = null;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Testimonial>
* @lazy
*/
protected $testimonials = null;
/**
* The constructor.
*
* @return TeaBeverage
*/
public function __construct() {
$this->initializeStorageObjects();
}
/**
* The constructor.
*
* @return TeaBeverage
*/
public function __construct()
{
$this->initializeStorageObjects();
}
/**
* Initializes all ObjectStorage properties.
*
* @return void
*/
protected function initializeStorageObjects() {
$this->additions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->testimonials = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* Initializes all ObjectStorage properties.
*
* @return void
*/
protected function initializeStorageObjects()
{
$this->additions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->testimonials = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* @return float $size
*/
public function getSize() {
return $this->size;
}
/**
* @return float $size
*/
public function getSize()
{
return $this->size;
}
/**
* @param float $size
*
* @return void
*/
public function setSize($size) {
$this->size = $size;
}
/**
* @param float $size
*
* @return void
*/
public function setSize($size)
{
$this->size = $size;
}
/**
* @return \OliverKlee\Tea\Domain\Model\TeaType $type
*/
public function getType() {
return $this->type;
}
/**
* @return \OliverKlee\Tea\Domain\Model\TeaType $type
*/
public function getType()
{
return $this->type;
}
/**
* @param \OliverKlee\Tea\Domain\Model\TeaType $type
*
* @return void
*/
public function setType(\OliverKlee\Tea\Domain\Model\TeaType $type) {
$this->type = $type;
}
/**
* @param \OliverKlee\Tea\Domain\Model\TeaType $type
*
* @return void
*/
public function setType(\OliverKlee\Tea\Domain\Model\TeaType $type)
{
$this->type = $type;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Addition> $additions
*/
public function getAdditions() {
return $this->additions;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Addition> $additions
*/
public function getAdditions()
{
return $this->additions;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $additions
*
* @return void
*/
public function setAdditions(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $additions) {
$this->additions = $additions;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $additions
*
* @return void
*/
public function setAdditions(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $additions)
{
$this->additions = $additions;
}
/**
* Adds an Addition.
*
* @param \OliverKlee\Tea\Domain\Model\Addition $addition
*
* @return void
*/
public function addAddition(\OliverKlee\Tea\Domain\Model\Addition $addition) {
$this->additions->attach($addition);
}
/**
* Adds an Addition.
*
* @param \OliverKlee\Tea\Domain\Model\Addition $addition
*
* @return void
*/
public function addAddition(\OliverKlee\Tea\Domain\Model\Addition $addition)
{
$this->additions->attach($addition);
}
/**
* Removes an Addition.
*
* @param \OliverKlee\Tea\Domain\Model\Addition $additionToRemove The Addition to be removed
*
* @return void
*/
public function removeAddition(\OliverKlee\Tea\Domain\Model\Addition $additionToRemove) {
$this->additions->detach($additionToRemove);
}
/**
* Removes an Addition.
*
* @param \OliverKlee\Tea\Domain\Model\Addition $additionToRemove The Addition to be removed
*
* @return void
*/
public function removeAddition(\OliverKlee\Tea\Domain\Model\Addition $additionToRemove)
{
$this->additions->detach($additionToRemove);
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Testimonial> $testimonials
*/
public function getTestimonials() {
return $this->testimonials;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Testimonial> $testimonials
*/
public function getTestimonials()
{
return $this->testimonials;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $testimonials
*
* @return void
*/
public function setTestimonials(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $testimonials) {
$this->testimonials = $testimonials;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $testimonials
*
* @return void
*/
public function setTestimonials(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $testimonials)
{
$this->testimonials = $testimonials;
}
/**
* Adds an Testimonial.
*
* @param \OliverKlee\Tea\Domain\Model\Testimonial $testimonial
*
* @return void
*/
public function addTestimonial(\OliverKlee\Tea\Domain\Model\Testimonial $testimonial) {
$this->testimonials->attach($testimonial);
}
/**
* Adds an Testimonial.
*
* @param \OliverKlee\Tea\Domain\Model\Testimonial $testimonial
*
* @return void
*/
public function addTestimonial(\OliverKlee\Tea\Domain\Model\Testimonial $testimonial)
{
$this->testimonials->attach($testimonial);
}
/**
* Removes an Testimonial.
*
* @param \OliverKlee\Tea\Domain\Model\Testimonial $testimonialToRemove The Testimonial to be removed
*
* @return void
*/
public function removeTestimonial(\OliverKlee\Tea\Domain\Model\Testimonial $testimonialToRemove) {
$this->testimonials->detach($testimonialToRemove);
}
/**
* Removes an Testimonial.
*
* @param \OliverKlee\Tea\Domain\Model\Testimonial $testimonialToRemove The Testimonial to be removed
*
* @return void
*/
public function removeTestimonial(\OliverKlee\Tea\Domain\Model\Testimonial $testimonialToRemove)
{
$this->testimonials->detach($testimonialToRemove);
}
}

View file

@ -19,54 +19,60 @@ namespace OliverKlee\Tea\Domain\Model;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* @var string
* @validate NotEmpty
*/
protected $title = '';
class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var string
* @validate NotEmpty
*/
protected $title = '';
/**
* @var bool
*/
protected $caffeinated = false;
/**
* @var bool
*/
protected $caffeinated = false;
/**
* @return string $title
*/
public function getTitle() {
return $this->title;
}
/**
* @return string $title
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
*
* @return void
*/
public function setTitle($title) {
$this->title = $title;
}
/**
* @param string $title
*
* @return void
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return bool $caffeinated
*/
public function getCaffeinated() {
return $this->caffeinated;
}
/**
* @return bool $caffeinated
*/
public function getCaffeinated()
{
return $this->caffeinated;
}
/**
* @param bool $caffeinated
*
* @return void
*/
public function setCaffeinated($caffeinated) {
$this->caffeinated = $caffeinated;
}
/**
* @param bool $caffeinated
*
* @return void
*/
public function setCaffeinated($caffeinated)
{
$this->caffeinated = $caffeinated;
}
/**
* @return bool
*/
public function isCaffeinated() {
return $this->getCaffeinated();
}
/**
* @return bool
*/
public function isCaffeinated()
{
return $this->getCaffeinated();
}
}

View file

@ -19,67 +19,74 @@ namespace OliverKlee\Tea\Domain\Model;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* @var \DateTime
*/
protected $dateOfPosting = null;
class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var \DateTime
*/
protected $dateOfPosting = null;
/**
* @var int
*/
protected $numberOfConsumedCups = 0;
/**
* @var int
*/
protected $numberOfConsumedCups = 0;
/**
* @var string
*/
protected $text = '';
/**
* @var string
*/
protected $text = '';
/**
* @return \DateTime $dateOfPosting
*/
public function getDateOfPosting() {
return $this->dateOfPosting;
}
/**
* @return \DateTime $dateOfPosting
*/
public function getDateOfPosting()
{
return $this->dateOfPosting;
}
/**
* @param \DateTime $dateOfPosting
*
* @return void
*/
public function setDateOfPosting($dateOfPosting) {
$this->dateOfPosting = $dateOfPosting;
}
/**
* @param \DateTime $dateOfPosting
*
* @return void
*/
public function setDateOfPosting($dateOfPosting)
{
$this->dateOfPosting = $dateOfPosting;
}
/**
* @return int $numberOfConsumedCups
*/
public function getNumberOfConsumedCups() {
return $this->numberOfConsumedCups;
}
/**
* @return int $numberOfConsumedCups
*/
public function getNumberOfConsumedCups()
{
return $this->numberOfConsumedCups;
}
/**
* @param int $numberOfConsumedCups
*
* @return void
*/
public function setNumberOfConsumedCups($numberOfConsumedCups) {
$this->numberOfConsumedCups = $numberOfConsumedCups;
}
/**
* @param int $numberOfConsumedCups
*
* @return void
*/
public function setNumberOfConsumedCups($numberOfConsumedCups)
{
$this->numberOfConsumedCups = $numberOfConsumedCups;
}
/**
* @return string $text
*/
public function getText() {
return $this->text;
}
/**
* @return string $text
*/
public function getText()
{
return $this->text;
}
/**
* @param string $text
*
* @return void
*/
public function setText($text) {
$this->text = $text;
}
/**
* @param string $text
*
* @return void
*/
public function setText($text)
{
$this->text = $text;
}
}

View file

@ -19,5 +19,6 @@ namespace OliverKlee\Tea\Domain\Repository;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaBeverageRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
class TeaBeverageRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
}

View file

@ -19,5 +19,6 @@ namespace OliverKlee\Tea\Domain\Repository;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TestimonialRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
class TestimonialRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
}

View file

@ -19,27 +19,29 @@ namespace OliverKlee\Tea\Utility;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class FileUtility {
/**
* Concatenates the files given as $sourceFilePaths and writes their contents into $targetFilePath.
*
* @param string $targetFilePath
* @param string[] $sourceFilePaths
*
* @return void
*
* @throws \InvalidArgumentException
*/
public function concatenate($targetFilePath, array $sourceFilePaths) {
if ($targetFilePath === '') {
throw new \InvalidArgumentException('$targetFileName must not be empty.', 1445631384);
}
class FileUtility
{
/**
* Concatenates the files given as $sourceFilePaths and writes their contents into $targetFilePath.
*
* @param string $targetFilePath
* @param string[] $sourceFilePaths
*
* @return void
*
* @throws \InvalidArgumentException
*/
public function concatenate($targetFilePath, array $sourceFilePaths)
{
if ($targetFilePath === '') {
throw new \InvalidArgumentException('$targetFileName must not be empty.', 1445631384);
}
$concatenatedContents = '';
foreach ($sourceFilePaths as $sourceFilePath) {
$concatenatedContents .= file_get_contents($sourceFilePath);
}
$concatenatedContents = '';
foreach ($sourceFilePaths as $sourceFilePath) {
$concatenatedContents .= file_get_contents($sourceFilePath);
}
file_put_contents($targetFilePath, $concatenatedContents);
}
file_put_contents($targetFilePath, $concatenatedContents);
}
}

View file

@ -2,103 +2,103 @@
defined('TYPO3_MODE') or die('Access denied.');
$GLOBALS['TCA']['tx_tea_domain_model_addition'] = array(
'ctrl' => $GLOBALS['TCA']['tx_tea_domain_model_addition']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title',
),
'types' => array(
'1' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, title,--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access,starttime, endtime'),
),
'palettes' => array(
'1' => array('showitem' => ''),
),
'columns' => array(
'sys_language_uid' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => array(
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0),
),
),
),
'l10n_parent' => array(
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => array(
'type' => 'select',
'items' => array(
array('', 0),
),
'foreign_table' => 'tx_tea_domain_model_addition',
'foreign_table_where' => 'AND tx_tea_domain_model_addition.pid=###CURRENT_PID### AND tx_tea_domain_model_addition.sys_language_uid IN (-1,0)',
),
),
'l10n_diffsource' => array(
'config' => array(
'type' => 'passthrough',
),
),
't3ver_label' => array(
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => array(
'type' => 'input',
'size' => 30,
'max' => 255,
)
),
'hidden' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => array(
'type' => 'check',
),
),
'starttime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'endtime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'title' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_addition.title',
'config' => array(
'type' => 'input',
'size' => 30,
'eval' => 'trim,required',
),
),
),
'ctrl' => $GLOBALS['TCA']['tx_tea_domain_model_addition']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title',
),
'types' => array(
'1' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, title,--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access,starttime, endtime'),
),
'palettes' => array(
'1' => array('showitem' => ''),
),
'columns' => array(
'sys_language_uid' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => array(
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0),
),
),
),
'l10n_parent' => array(
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => array(
'type' => 'select',
'items' => array(
array('', 0),
),
'foreign_table' => 'tx_tea_domain_model_addition',
'foreign_table_where' => 'AND tx_tea_domain_model_addition.pid=###CURRENT_PID### AND tx_tea_domain_model_addition.sys_language_uid IN (-1,0)',
),
),
'l10n_diffsource' => array(
'config' => array(
'type' => 'passthrough',
),
),
't3ver_label' => array(
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => array(
'type' => 'input',
'size' => 30,
'max' => 255,
)
),
'hidden' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => array(
'type' => 'check',
),
),
'starttime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'endtime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'title' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_addition.title',
'config' => array(
'type' => 'input',
'size' => 30,
'eval' => 'trim,required',
),
),
),
);

View file

@ -2,166 +2,166 @@
defined('TYPO3_MODE') or die('Access denied.');
$GLOBALS['TCA']['tx_tea_domain_model_teabeverage'] = array(
'ctrl' => $GLOBALS['TCA']['tx_tea_domain_model_teabeverage']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, size, type, additions, testimonials',
),
'types' => array(
'1' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, size, type, additions, testimonials,--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access,starttime, endtime'),
),
'palettes' => array(
'1' => array('showitem' => ''),
),
'columns' => array(
'sys_language_uid' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => array(
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0),
),
),
),
'l10n_parent' => array(
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => array(
'type' => 'select',
'items' => array(
array('', 0),
),
'foreign_table' => 'tx_tea_domain_model_teabeverage',
'foreign_table_where' => 'AND tx_tea_domain_model_teabeverage.pid=###CURRENT_PID### AND tx_tea_domain_model_teabeverage.sys_language_uid IN (-1,0)',
),
),
'l10n_diffsource' => array(
'config' => array(
'type' => 'passthrough',
),
),
't3ver_label' => array(
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => array(
'type' => 'input',
'size' => 30,
'max' => 255,
)
),
'hidden' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => array(
'type' => 'check',
),
),
'starttime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'endtime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'size' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage.size',
'config' => array(
'type' => 'input',
'size' => 30,
'eval' => 'double2',
),
),
'type' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage.type',
'config' => array(
'type' => 'select',
'foreign_table' => 'tx_tea_domain_model_teatype',
'minitems' => 0,
'maxitems' => 1,
),
),
'additions' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage.additions',
'config' => array(
'type' => 'select',
'foreign_table' => 'tx_tea_domain_model_addition',
'MM' => 'tx_tea_teabeverage_addition_mm',
'size' => 10,
'autoSizeMax' => 30,
'maxitems' => 9999,
'multiple' => 0,
'wizards' => array(
'_PADDING' => 1,
'_VERTICAL' => 1,
'edit' => array(
'type' => 'popup',
'title' => 'Edit',
'script' => 'wizard_edit.php',
'icon' => 'edit2.gif',
'popup_onlyOpenIfSelected' => 1,
'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1',
),
'add' => array(
'type' => 'script',
'title' => 'Create new',
'icon' => 'add.gif',
'params' => array(
'table' => 'tx_tea_domain_model_addition',
'pid' => '###CURRENT_PID###',
'setValue' => 'prepend'
),
'script' => 'wizard_add.php',
),
),
),
),
'testimonials' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage.testimonials',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tx_tea_domain_model_testimonial',
'foreign_field' => 'teabeverage',
'maxitems' => 9999,
'appearance' => array(
'collapseAll' => 0,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showAllLocalizationLink' => 1,
),
),
),
),
'ctrl' => $GLOBALS['TCA']['tx_tea_domain_model_teabeverage']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, size, type, additions, testimonials',
),
'types' => array(
'1' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, size, type, additions, testimonials,--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access,starttime, endtime'),
),
'palettes' => array(
'1' => array('showitem' => ''),
),
'columns' => array(
'sys_language_uid' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => array(
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0),
),
),
),
'l10n_parent' => array(
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => array(
'type' => 'select',
'items' => array(
array('', 0),
),
'foreign_table' => 'tx_tea_domain_model_teabeverage',
'foreign_table_where' => 'AND tx_tea_domain_model_teabeverage.pid=###CURRENT_PID### AND tx_tea_domain_model_teabeverage.sys_language_uid IN (-1,0)',
),
),
'l10n_diffsource' => array(
'config' => array(
'type' => 'passthrough',
),
),
't3ver_label' => array(
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => array(
'type' => 'input',
'size' => 30,
'max' => 255,
)
),
'hidden' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => array(
'type' => 'check',
),
),
'starttime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'endtime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'size' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage.size',
'config' => array(
'type' => 'input',
'size' => 30,
'eval' => 'double2',
),
),
'type' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage.type',
'config' => array(
'type' => 'select',
'foreign_table' => 'tx_tea_domain_model_teatype',
'minitems' => 0,
'maxitems' => 1,
),
),
'additions' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage.additions',
'config' => array(
'type' => 'select',
'foreign_table' => 'tx_tea_domain_model_addition',
'MM' => 'tx_tea_teabeverage_addition_mm',
'size' => 10,
'autoSizeMax' => 30,
'maxitems' => 9999,
'multiple' => 0,
'wizards' => array(
'_PADDING' => 1,
'_VERTICAL' => 1,
'edit' => array(
'type' => 'popup',
'title' => 'Edit',
'script' => 'wizard_edit.php',
'icon' => 'edit2.gif',
'popup_onlyOpenIfSelected' => 1,
'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1',
),
'add' => array(
'type' => 'script',
'title' => 'Create new',
'icon' => 'add.gif',
'params' => array(
'table' => 'tx_tea_domain_model_addition',
'pid' => '###CURRENT_PID###',
'setValue' => 'prepend'
),
'script' => 'wizard_add.php',
),
),
),
),
'testimonials' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage.testimonials',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tx_tea_domain_model_testimonial',
'foreign_field' => 'teabeverage',
'maxitems' => 9999,
'appearance' => array(
'collapseAll' => 0,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showAllLocalizationLink' => 1,
),
),
),
),
);

View file

@ -2,111 +2,111 @@
defined('TYPO3_MODE') or die('Access denied.');
$GLOBALS['TCA']['tx_tea_domain_model_teatype'] = array(
'ctrl' => $GLOBALS['TCA']['tx_tea_domain_model_teatype']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, caffeinated',
),
'types' => array(
'1' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, title, caffeinated,--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access,starttime, endtime'),
),
'palettes' => array(
'1' => array('showitem' => ''),
),
'columns' => array(
'sys_language_uid' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => array(
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0),
),
),
),
'l10n_parent' => array(
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => array(
'type' => 'select',
'items' => array(
array('', 0),
),
'foreign_table' => 'tx_tea_domain_model_teatype',
'foreign_table_where' => 'AND tx_tea_domain_model_teatype.pid=###CURRENT_PID### AND tx_tea_domain_model_teatype.sys_language_uid IN (-1,0)',
),
),
'l10n_diffsource' => array(
'config' => array(
'type' => 'passthrough',
),
),
't3ver_label' => array(
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => array(
'type' => 'input',
'size' => 30,
'max' => 255,
)
),
'hidden' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => array(
'type' => 'check',
),
),
'starttime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'endtime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'title' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teatype.title',
'config' => array(
'type' => 'input',
'size' => 30,
'eval' => 'trim,required',
),
),
'caffeinated' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teatype.caffeinated',
'config' => array(
'type' => 'check',
'default' => 0,
),
),
),
'ctrl' => $GLOBALS['TCA']['tx_tea_domain_model_teatype']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, caffeinated',
),
'types' => array(
'1' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, title, caffeinated,--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access,starttime, endtime'),
),
'palettes' => array(
'1' => array('showitem' => ''),
),
'columns' => array(
'sys_language_uid' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => array(
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0),
),
),
),
'l10n_parent' => array(
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => array(
'type' => 'select',
'items' => array(
array('', 0),
),
'foreign_table' => 'tx_tea_domain_model_teatype',
'foreign_table_where' => 'AND tx_tea_domain_model_teatype.pid=###CURRENT_PID### AND tx_tea_domain_model_teatype.sys_language_uid IN (-1,0)',
),
),
'l10n_diffsource' => array(
'config' => array(
'type' => 'passthrough',
),
),
't3ver_label' => array(
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => array(
'type' => 'input',
'size' => 30,
'max' => 255,
)
),
'hidden' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => array(
'type' => 'check',
),
),
'starttime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'endtime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'title' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teatype.title',
'config' => array(
'type' => 'input',
'size' => 30,
'eval' => 'trim,required',
),
),
'caffeinated' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teatype.caffeinated',
'config' => array(
'type' => 'check',
'default' => 0,
),
),
),
);

View file

@ -2,130 +2,130 @@
defined('TYPO3_MODE') or die('Access denied.');
$GLOBALS['TCA']['tx_tea_domain_model_testimonial'] = array(
'ctrl' => $GLOBALS['TCA']['tx_tea_domain_model_testimonial']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, date_of_posting, number_of_consumed_cups, text',
),
'types' => array(
'1' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, date_of_posting, number_of_consumed_cups, text,--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access,starttime, endtime'),
),
'palettes' => array(
'1' => array('showitem' => ''),
),
'columns' => array(
'sys_language_uid' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => array(
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0),
),
),
),
'l10n_parent' => array(
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => array(
'type' => 'select',
'items' => array(
array('', 0),
),
'foreign_table' => 'tx_tea_domain_model_testimonial',
'foreign_table_where' => 'AND tx_tea_domain_model_testimonial.pid=###CURRENT_PID### AND tx_tea_domain_model_testimonial.sys_language_uid IN (-1,0)',
),
),
'l10n_diffsource' => array(
'config' => array(
'type' => 'passthrough',
),
),
't3ver_label' => array(
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => array(
'type' => 'input',
'size' => 30,
'max' => 255,
)
),
'hidden' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => array(
'type' => 'check',
),
),
'starttime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'endtime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'date_of_posting' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_testimonial.date_of_posting',
'config' => array(
'dbType' => 'datetime',
'type' => 'input',
'size' => 12,
'eval' => 'datetime',
'checkbox' => 0,
'default' => '0000-00-00 00:00:00',
),
),
'number_of_consumed_cups' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_testimonial.number_of_consumed_cups',
'config' => array(
'type' => 'input',
'size' => 4,
'eval' => 'int',
),
),
'text' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_testimonial.text',
'config' => array(
'type' => 'text',
'cols' => 40,
'rows' => 15,
'eval' => 'trim',
),
),
'teabeverage' => array(
'config' => array(
'type' => 'passthrough',
),
),
),
'ctrl' => $GLOBALS['TCA']['tx_tea_domain_model_testimonial']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, date_of_posting, number_of_consumed_cups, text',
),
'types' => array(
'1' => array('showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, date_of_posting, number_of_consumed_cups, text,--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access,starttime, endtime'),
),
'palettes' => array(
'1' => array('showitem' => ''),
),
'columns' => array(
'sys_language_uid' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => array(
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0),
),
),
),
'l10n_parent' => array(
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => array(
'type' => 'select',
'items' => array(
array('', 0),
),
'foreign_table' => 'tx_tea_domain_model_testimonial',
'foreign_table_where' => 'AND tx_tea_domain_model_testimonial.pid=###CURRENT_PID### AND tx_tea_domain_model_testimonial.sys_language_uid IN (-1,0)',
),
),
'l10n_diffsource' => array(
'config' => array(
'type' => 'passthrough',
),
),
't3ver_label' => array(
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => array(
'type' => 'input',
'size' => 30,
'max' => 255,
)
),
'hidden' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => array(
'type' => 'check',
),
),
'starttime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'endtime' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => array(
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
),
),
),
'date_of_posting' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_testimonial.date_of_posting',
'config' => array(
'dbType' => 'datetime',
'type' => 'input',
'size' => 12,
'eval' => 'datetime',
'checkbox' => 0,
'default' => '0000-00-00 00:00:00',
),
),
'number_of_consumed_cups' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_testimonial.number_of_consumed_cups',
'config' => array(
'type' => 'input',
'size' => 4,
'eval' => 'int',
),
),
'text' => array(
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_testimonial.text',
'config' => array(
'type' => 'text',
'cols' => 40,
'rows' => 15,
'eval' => 'trim',
),
),
'teabeverage' => array(
'config' => array(
'type' => 'passthrough',
),
),
),
);

View file

@ -24,77 +24,83 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaBeverageRepositoryTest extends \Tx_Phpunit_Database_TestCase {
/**
* @var TeaBeverageRepository|\PHPUnit_Framework_MockObject_MockObject
*/
protected $subject = null;
class TeaBeverageRepositoryTest extends \Tx_Phpunit_Database_TestCase
{
/**
* @var TeaBeverageRepository|\PHPUnit_Framework_MockObject_MockObject
*/
protected $subject = null;
protected function setUp() {
if (!$this->createDatabase()) {
self::markTestSkipped('Test database could not be created.');
}
$this->importExtensions(array('tea'));
protected function setUp()
{
if (!$this->createDatabase()) {
self::markTestSkipped('Test database could not be created.');
}
$this->importExtensions(array('tea'));
/** @var ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
// We are using the object manager instead of new so that the dependencies get injected.
// In a unit test, we would inject the mocked dependencies instead.
$this->subject = $objectManager->get(TeaBeverageRepository::class);
}
/** @var ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
// We are using the object manager instead of new so that the dependencies get injected.
// In a unit test, we would inject the mocked dependencies instead.
$this->subject = $objectManager->get(TeaBeverageRepository::class);
}
protected function tearDown() {
$this->dropDatabase();
$this->switchToTypo3Database();
}
protected function tearDown()
{
$this->dropDatabase();
$this->switchToTypo3Database();
}
/**
* @test
*/
public function findAllForNoRecordsReturnsEmptyContainer() {
$container = $this->subject->findAll();
/**
* @test
*/
public function findAllForNoRecordsReturnsEmptyContainer()
{
$container = $this->subject->findAll();
self::assertSame(
0,
$container->count()
);
}
self::assertSame(
0,
$container->count()
);
}
/**
* @test
*/
public function findAllWithOneRecordFindsThisRecord() {
$this->importDataSet(__DIR__ . '/Fixtures/TeaBeverages.xml');
/**
* @test
*/
public function findAllWithOneRecordFindsThisRecord()
{
$this->importDataSet(__DIR__ . '/Fixtures/TeaBeverages.xml');
$container = $this->subject->findAll();
/** @var TeaBeverage $first */
$first = $container->getFirst();
$container = $this->subject->findAll();
/** @var TeaBeverage $first */
$first = $container->getFirst();
self::assertSame(
1,
$container->count()
);
self::assertSame(
1,
$first->getUid()
);
}
self::assertSame(
1,
$container->count()
);
self::assertSame(
1,
$first->getUid()
);
}
/**
* @test
*/
public function findByUidForExistingRecordReturnsModelWithData() {
$this->importDataSet(__DIR__ . '/Fixtures/TeaBeverages.xml');
/**
* @test
*/
public function findByUidForExistingRecordReturnsModelWithData()
{
$this->importDataSet(__DIR__ . '/Fixtures/TeaBeverages.xml');
/** @var TeaBeverage $model */
$model = $this->subject->findByUid(1);
/** @var TeaBeverage $model */
$model = $this->subject->findByUid(1);
self::assertNotNull($model);
self::assertEquals(
3.141,
$model->getSize(),
'',
0.001
);
}
self::assertNotNull($model);
self::assertEquals(
3.141,
$model->getSize(),
'',
0.001
);
}
}

View file

@ -24,79 +24,85 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @var TestimonialRepository
*/
protected $subject = null;
class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
/**
* @var TestimonialRepository
*/
protected $subject = null;
/**
* @var \Tx_Phpunit_Framework
*/
protected $testingFramework = null;
/**
* @var \Tx_Phpunit_Framework
*/
protected $testingFramework = null;
protected function setUp() {
$this->testingFramework = new \Tx_Phpunit_Framework('tx_tea');
protected function setUp()
{
$this->testingFramework = new \Tx_Phpunit_Framework('tx_tea');
/** @var ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
// We are using the object manager instead of new so that the dependencies get injected.
// In a unit test, we would inject the mocked dependencies instead.
$this->subject = $objectManager->get(TestimonialRepository::class);
}
/** @var ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
// We are using the object manager instead of new so that the dependencies get injected.
// In a unit test, we would inject the mocked dependencies instead.
$this->subject = $objectManager->get(TestimonialRepository::class);
}
protected function tearDown() {
$this->testingFramework->cleanUp();
}
protected function tearDown()
{
$this->testingFramework->cleanUp();
}
/**
* @test
*/
public function findAllForNoRecordsReturnsEmptyContainer() {
$container = $this->subject->findAll();
/**
* @test
*/
public function findAllForNoRecordsReturnsEmptyContainer()
{
$container = $this->subject->findAll();
self::assertSame(
0,
$container->count()
);
}
self::assertSame(
0,
$container->count()
);
}
/**
* @test
*/
public function findAllWithOneRecordFindsThisRecord() {
$uid = $this->testingFramework->createRecord('tx_tea_domain_model_testimonial');
/**
* @test
*/
public function findAllWithOneRecordFindsThisRecord()
{
$uid = $this->testingFramework->createRecord('tx_tea_domain_model_testimonial');
$container = $this->subject->findAll();
/** @var Testimonial $first */
$first = $container->getFirst();
$container = $this->subject->findAll();
/** @var Testimonial $first */
$first = $container->getFirst();
self::assertSame(
1,
$container->count()
);
self::assertSame(
$uid,
$first->getUid()
);
}
self::assertSame(
1,
$container->count()
);
self::assertSame(
$uid,
$first->getUid()
);
}
/**
* @test
*/
public function findByUidForExistingRecordReturnsModelWithData() {
$text = 'A very good Early Grey!';
$uid = $this->testingFramework->createRecord(
'tx_tea_domain_model_testimonial', array('text' => $text)
);
/**
* @test
*/
public function findByUidForExistingRecordReturnsModelWithData()
{
$text = 'A very good Early Grey!';
$uid = $this->testingFramework->createRecord(
'tx_tea_domain_model_testimonial', array('text' => $text)
);
/** @var Testimonial $model */
$model = $this->subject->findByUid($uid);
/** @var Testimonial $model */
$model = $this->subject->findByUid($uid);
self::assertNotNull($model);
self::assertSame(
$text,
$model->getText()
);
}
self::assertNotNull($model);
self::assertSame(
$text,
$model->getText()
);
}
}

View file

@ -22,105 +22,112 @@ use org\bovigo\vfs\vfsStreamDirectory;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class FileUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @var \OliverKlee\Tea\Utility\FileUtility
*/
protected $subject = null;
class FileUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
/**
* @var \OliverKlee\Tea\Utility\FileUtility
*/
protected $subject = null;
/**
* @var vfsStreamDirectory
*/
protected $root = null;
/**
* @var vfsStreamDirectory
*/
protected $root = null;
/** @var string */
protected $rootDirectoryName = 'home';
/** @var string */
protected $rootDirectoryName = 'home';
/**
* @var string
*/
protected $targetFilePath = '';
/**
* @var string
*/
protected $targetFilePath = '';
protected function setUp() {
$this->root = vfsStream::setup('home');
$this->targetFilePath = vfsStream::url('home/target.txt');
protected function setUp()
{
$this->root = vfsStream::setup('home');
$this->targetFilePath = vfsStream::url('home/target.txt');
$this->subject = new \OliverKlee\Tea\Utility\FileUtility();
}
$this->subject = new \OliverKlee\Tea\Utility\FileUtility();
}
/**
* @test
* @expectedException \InvalidArgumentException
*/
public function concatenateWithEmptyTargetFileNameThrowsException() {
$this->subject->concatenate('', array('foo.txt'));
}
/**
* @test
* @expectedException \InvalidArgumentException
*/
public function concatenateWithEmptyTargetFileNameThrowsException()
{
$this->subject->concatenate('', array('foo.txt'));
}
/**
* @test
*/
public function concatenateWithNoSourceFilesCreatesEmptyTargetFile() {
$this->subject->concatenate($this->targetFilePath, array());
/**
* @test
*/
public function concatenateWithNoSourceFilesCreatesEmptyTargetFile()
{
$this->subject->concatenate($this->targetFilePath, array());
self::assertSame(
'',
file_get_contents($this->targetFilePath)
);
}
self::assertSame(
'',
file_get_contents($this->targetFilePath)
);
}
/**
* @test
*/
public function concatenateWithOneEmptySourceFileCreatesEmptyTargetFile() {
// This is one way to create a file with contents, using PHP's file functions.
$sourceFileName = vfsStream::url('home/source.txt');
// Just calling vfsStream::url does not create the file yet. We need to write into it to create it.
file_put_contents($sourceFileName, '');
/**
* @test
*/
public function concatenateWithOneEmptySourceFileCreatesEmptyTargetFile()
{
// This is one way to create a file with contents, using PHP's file functions.
$sourceFileName = vfsStream::url('home/source.txt');
// Just calling vfsStream::url does not create the file yet. We need to write into it to create it.
file_put_contents($sourceFileName, '');
$this->subject->concatenate($this->targetFilePath, array($sourceFileName));
$this->subject->concatenate($this->targetFilePath, array($sourceFileName));
self::assertSame(
'',
file_get_contents($this->targetFilePath)
);
}
self::assertSame(
'',
file_get_contents($this->targetFilePath)
);
}
/**
* @test
*/
public function concatenateWithOneFileCopiesContentsFromSourceFileToTargetFile() {
// This is vfsStream's way of creating a file with contents.
$contents = 'Hello world!';
$sourceFileName = vfsStream::url('home/source.txt');
vfsStream::newFile('source.txt')->at($this->root)->setContent($contents);
/**
* @test
*/
public function concatenateWithOneFileCopiesContentsFromSourceFileToTargetFile()
{
// This is vfsStream's way of creating a file with contents.
$contents = 'Hello world!';
$sourceFileName = vfsStream::url('home/source.txt');
vfsStream::newFile('source.txt')->at($this->root)->setContent($contents);
$this->subject->concatenate($this->targetFilePath, array($sourceFileName));
$this->subject->concatenate($this->targetFilePath, array($sourceFileName));
self::assertSame(
$contents,
file_get_contents($this->targetFilePath)
);
}
self::assertSame(
$contents,
file_get_contents($this->targetFilePath)
);
}
/**
* @test
*/
public function concatenateWithTwoFileCopiesContentsFromBothFilesInOrderToTargetFile() {
$contents1 = 'Hello ';
$sourceFileName1 = vfsStream::url('home/source1.txt');
file_put_contents($sourceFileName1, $contents1);
$contents2 = 'world!';
$sourceFileName2 = vfsStream::url('home/source2.txt');
file_put_contents($sourceFileName2, $contents2);
/**
* @test
*/
public function concatenateWithTwoFileCopiesContentsFromBothFilesInOrderToTargetFile()
{
$contents1 = 'Hello ';
$sourceFileName1 = vfsStream::url('home/source1.txt');
file_put_contents($sourceFileName1, $contents1);
$contents2 = 'world!';
$sourceFileName2 = vfsStream::url('home/source2.txt');
file_put_contents($sourceFileName2, $contents2);
$this->subject->concatenate(
$this->targetFilePath,
array($sourceFileName1, $sourceFileName2)
);
$this->subject->concatenate(
$this->targetFilePath,
array($sourceFileName1, $sourceFileName2)
);
self::assertSame(
$contents1 . $contents2,
file_get_contents($this->targetFilePath)
);
}
self::assertSame(
$contents1 . $contents2,
file_get_contents($this->targetFilePath)
);
}
}

View file

@ -14,59 +14,63 @@ namespace OliverKlee\Tea\Tests\Unit\Controller;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
use OliverKlee\Tea\Controller\TestimonialController;
use OliverKlee\Tea\Domain\Repository\TestimonialRepository;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* Test case.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TestimonialControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @var TestimonialController
*/
protected $subject = null;
class TestimonialControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
/**
* @var TestimonialController
*/
protected $subject = null;
/**
* @var ViewInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $view = null;
/**
* @var ViewInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $view = null;
/**
* @var TestimonialRepository|\PHPUnit_Framework_MockObject_MockObject
*/
protected $testimonialRepository = null;
/**
* @var TestimonialRepository|\PHPUnit_Framework_MockObject_MockObject
*/
protected $testimonialRepository = null;
protected function setUp() {
$this->subject = new TestimonialController();
protected function setUp()
{
$this->subject = new TestimonialController();
$this->view = $this->getMock(ViewInterface::class);
$this->inject($this->subject, 'view', $this->view);
$this->view = $this->getMock(ViewInterface::class);
$this->inject($this->subject, 'view', $this->view);
$this->testimonialRepository = $this->getMock(TestimonialRepository::class, array(), array(), '', false);
$this->inject($this->subject, 'testimonialRepository', $this->testimonialRepository);
}
$this->testimonialRepository = $this->getMock(TestimonialRepository::class, array(), array(), '', false);
$this->inject($this->subject, 'testimonialRepository', $this->testimonialRepository);
}
/**
* @test
*/
public function indexActionCanBeCalled() {
$this->subject->indexAction();
}
/**
* @test
*/
public function indexActionCanBeCalled()
{
$this->subject->indexAction();
}
/**
* @test
*/
public function indexActionPassesAllTestimonialsAsTestimonialsToView() {
$allTestimonials = new ObjectStorage();
$this->testimonialRepository->expects(self::any())->method('findAll')
->will(self::returnValue($allTestimonials));
/**
* @test
*/
public function indexActionPassesAllTestimonialsAsTestimonialsToView()
{
$allTestimonials = new ObjectStorage();
$this->testimonialRepository->expects(self::any())->method('findAll')
->will(self::returnValue($allTestimonials));
$this->view->expects(self::once())->method('assign')->with('testimonials', $allTestimonials);
$this->view->expects(self::once())->method('assign')->with('testimonials', $allTestimonials);
$this->subject->indexAction();
}
$this->subject->indexAction();
}
}

View file

@ -19,35 +19,39 @@ namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class AdditionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @var \OliverKlee\Tea\Domain\Model\Addition
*/
protected $subject = null;
class AdditionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
/**
* @var \OliverKlee\Tea\Domain\Model\Addition
*/
protected $subject = null;
protected function setUp() {
$this->subject = new \OliverKlee\Tea\Domain\Model\Addition();
}
protected function setUp()
{
$this->subject = new \OliverKlee\Tea\Domain\Model\Addition();
}
/**
* @test
*/
public function getTitleInitiallyReturnsEmptyString() {
self::assertSame(
'',
$this->subject->getTitle()
);
}
/**
* @test
*/
public function getTitleInitiallyReturnsEmptyString()
{
self::assertSame(
'',
$this->subject->getTitle()
);
}
/**
* @test
*/
public function setTitleSetsTitle() {
$this->subject->setTitle('foo bar');
/**
* @test
*/
public function setTitleSetsTitle()
{
$this->subject->setTitle('foo bar');
self::assertSame(
'foo bar',
$this->subject->getTitle()
);
}
self::assertSame(
'foo bar',
$this->subject->getTitle()
);
}
}

View file

@ -21,165 +21,179 @@ use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @var \OliverKlee\Tea\Domain\Model\TeaBeverage
*/
protected $subject = null;
class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
/**
* @var \OliverKlee\Tea\Domain\Model\TeaBeverage
*/
protected $subject = null;
protected function setUp() {
$this->subject = new \OliverKlee\Tea\Domain\Model\TeaBeverage();
}
protected function setUp()
{
$this->subject = new \OliverKlee\Tea\Domain\Model\TeaBeverage();
}
/**
* @test
*/
public function getSizeInitiallyReturnsZero() {
self::assertSame(
0.0,
$this->subject->getSize()
);
}
/**
* @test
*/
public function getSizeInitiallyReturnsZero()
{
self::assertSame(
0.0,
$this->subject->getSize()
);
}
/**
* @test
*/
public function setSizeSetsSize() {
$this->subject->setSize(1234.56);
/**
* @test
*/
public function setSizeSetsSize()
{
$this->subject->setSize(1234.56);
self::assertSame(
1234.56,
$this->subject->getSize()
);
}
self::assertSame(
1234.56,
$this->subject->getSize()
);
}
/**
* @test
*/
public function getTypeInitiallyReturnsNull() {
self::assertNull(
$this->subject->getType()
);
}
/**
* @test
*/
public function getTypeInitiallyReturnsNull()
{
self::assertNull(
$this->subject->getType()
);
}
/**
* @test
*/
public function setTypeSetsType() {
$type = new \OliverKlee\Tea\Domain\Model\TeaType();
$this->subject->setType($type);
/**
* @test
*/
public function setTypeSetsType()
{
$type = new \OliverKlee\Tea\Domain\Model\TeaType();
$this->subject->setType($type);
self::assertSame(
$type,
$this->subject->getType()
);
}
self::assertSame(
$type,
$this->subject->getType()
);
}
/**
* @test
*/
public function getAdditionsInitiallyReturnsEmptyStorage() {
self::assertEquals(
new ObjectStorage(),
$this->subject->getAdditions()
);
}
/**
* @test
*/
public function getAdditionsInitiallyReturnsEmptyStorage()
{
self::assertEquals(
new ObjectStorage(),
$this->subject->getAdditions()
);
}
/**
* @test
*/
public function setAdditionsSetsAdditions() {
$items = new ObjectStorage();
$this->subject->setAdditions($items);
/**
* @test
*/
public function setAdditionsSetsAdditions()
{
$items = new ObjectStorage();
$this->subject->setAdditions($items);
self::assertSame(
$items,
$this->subject->getAdditions()
);
}
self::assertSame(
$items,
$this->subject->getAdditions()
);
}
/**
* @test
*/
public function addAdditionAddsAddition() {
$items = new ObjectStorage();
$this->subject->setAdditions($items);
/**
* @test
*/
public function addAdditionAddsAddition()
{
$items = new ObjectStorage();
$this->subject->setAdditions($items);
$newItem = new \OliverKlee\Tea\Domain\Model\Addition();
$this->subject->addAddition($newItem);
$newItem = new \OliverKlee\Tea\Domain\Model\Addition();
$this->subject->addAddition($newItem);
self::assertTrue(
$this->subject->getAdditions()->contains($newItem)
);
}
self::assertTrue(
$this->subject->getAdditions()->contains($newItem)
);
}
/**
* @test
*/
public function removeAdditionRemovesAddition() {
$items = new ObjectStorage();
$this->subject->setAdditions($items);
/**
* @test
*/
public function removeAdditionRemovesAddition()
{
$items = new ObjectStorage();
$this->subject->setAdditions($items);
$newItem = new \OliverKlee\Tea\Domain\Model\Addition();
$this->subject->addAddition($newItem);
$this->subject->removeAddition($newItem);
$newItem = new \OliverKlee\Tea\Domain\Model\Addition();
$this->subject->addAddition($newItem);
$this->subject->removeAddition($newItem);
self::assertFalse(
$this->subject->getAdditions()->contains($newItem)
);
}
self::assertFalse(
$this->subject->getAdditions()->contains($newItem)
);
}
/**
* @test
*/
public function getTestimonialsInitiallyReturnsEmptyStorage() {
self::assertEquals(
new ObjectStorage(),
$this->subject->getTestimonials()
);
}
/**
* @test
*/
public function getTestimonialsInitiallyReturnsEmptyStorage()
{
self::assertEquals(
new ObjectStorage(),
$this->subject->getTestimonials()
);
}
/**
* @test
*/
public function setTestimonialsSetsTestimonials() {
$items = new ObjectStorage();
$this->subject->setTestimonials($items);
/**
* @test
*/
public function setTestimonialsSetsTestimonials()
{
$items = new ObjectStorage();
$this->subject->setTestimonials($items);
self::assertSame(
$items,
$this->subject->getTestimonials()
);
}
self::assertSame(
$items,
$this->subject->getTestimonials()
);
}
/**
* @test
*/
public function addTestimonialAddsTestimonial() {
$items = new ObjectStorage();
$this->subject->setTestimonials($items);
/**
* @test
*/
public function addTestimonialAddsTestimonial()
{
$items = new ObjectStorage();
$this->subject->setTestimonials($items);
$newItem = new \OliverKlee\Tea\Domain\Model\Testimonial();
$this->subject->addTestimonial($newItem);
$newItem = new \OliverKlee\Tea\Domain\Model\Testimonial();
$this->subject->addTestimonial($newItem);
self::assertTrue(
$this->subject->getTestimonials()->contains($newItem)
);
}
self::assertTrue(
$this->subject->getTestimonials()->contains($newItem)
);
}
/**
* @test
*/
public function removeTestimonialRemovesTestimonial() {
$items = new ObjectStorage();
$this->subject->setTestimonials($items);
/**
* @test
*/
public function removeTestimonialRemovesTestimonial()
{
$items = new ObjectStorage();
$this->subject->setTestimonials($items);
$newItem = new \OliverKlee\Tea\Domain\Model\Testimonial();
$this->subject->addTestimonial($newItem);
$this->subject->removeTestimonial($newItem);
$newItem = new \OliverKlee\Tea\Domain\Model\Testimonial();
$this->subject->addTestimonial($newItem);
$this->subject->removeTestimonial($newItem);
self::assertFalse(
$this->subject->getTestimonials()->contains($newItem)
);
}
self::assertFalse(
$this->subject->getTestimonials()->contains($newItem)
);
}
}

View file

@ -19,56 +19,62 @@ namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaTypeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @var \OliverKlee\Tea\Domain\Model\TeaType
*/
protected $subject = null;
class TeaTypeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
/**
* @var \OliverKlee\Tea\Domain\Model\TeaType
*/
protected $subject = null;
protected function setUp() {
$this->subject = new \OliverKlee\Tea\Domain\Model\TeaType();
}
protected function setUp()
{
$this->subject = new \OliverKlee\Tea\Domain\Model\TeaType();
}
/**
* @test
*/
public function getTitleInitiallyReturnsEmptyString() {
self::assertSame(
'',
$this->subject->getTitle()
);
}
/**
* @test
*/
public function getTitleInitiallyReturnsEmptyString()
{
self::assertSame(
'',
$this->subject->getTitle()
);
}
/**
* @test
*/
public function setTitleSetsTitle() {
$this->subject->setTitle('foo bar');
/**
* @test
*/
public function setTitleSetsTitle()
{
$this->subject->setTitle('foo bar');
self::assertSame(
'foo bar',
$this->subject->getTitle()
);
}
self::assertSame(
'foo bar',
$this->subject->getTitle()
);
}
/**
* @test
*/
public function getCaffeinatedInitiallyReturnsFalse() {
self::assertSame(
false,
$this->subject->getCaffeinated()
);
}
/**
* @test
*/
public function getCaffeinatedInitiallyReturnsFalse()
{
self::assertSame(
false,
$this->subject->getCaffeinated()
);
}
/**
* @test
*/
public function setCaffeinatedSetsCaffeinated() {
$this->subject->setCaffeinated(true);
self::assertSame(
true,
$this->subject->getCaffeinated()
);
}
/**
* @test
*/
public function setCaffeinatedSetsCaffeinated()
{
$this->subject->setCaffeinated(true);
self::assertSame(
true,
$this->subject->getCaffeinated()
);
}
}

View file

@ -19,79 +19,87 @@ namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TestimonialTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @var \OliverKlee\Tea\Domain\Model\Testimonial
*/
protected $subject = null;
class TestimonialTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
/**
* @var \OliverKlee\Tea\Domain\Model\Testimonial
*/
protected $subject = null;
protected function setUp() {
$this->subject = new \OliverKlee\Tea\Domain\Model\Testimonial();
}
protected function setUp()
{
$this->subject = new \OliverKlee\Tea\Domain\Model\Testimonial();
}
/**
* @test
*/
public function getDateOfPostingInitiallyReturnsNull() {
self::assertNull(
$this->subject->getDateOfPosting()
);
}
/**
* @test
*/
public function getDateOfPostingInitiallyReturnsNull()
{
self::assertNull(
$this->subject->getDateOfPosting()
);
}
/**
* @test
*/
public function setDateOfPostingSetsDateOfPosting() {
$date = new \DateTime();
$this->subject->setDateOfPosting($date);
/**
* @test
*/
public function setDateOfPostingSetsDateOfPosting()
{
$date = new \DateTime();
$this->subject->setDateOfPosting($date);
self::assertSame(
$date,
$this->subject->getDateOfPosting()
);
}
self::assertSame(
$date,
$this->subject->getDateOfPosting()
);
}
/**
* @test
*/
public function getNumberOfConsumedCupsInitiallyReturnsZero() {
self::assertSame(
0,
$this->subject->getNumberOfConsumedCups()
);
}
/**
* @test
*/
public function getNumberOfConsumedCupsInitiallyReturnsZero()
{
self::assertSame(
0,
$this->subject->getNumberOfConsumedCups()
);
}
/**
* @test
*/
public function setNumberOfConsumedCupsSetsNumberOfConsumedCups() {
$this->subject->setNumberOfConsumedCups(123456);
/**
* @test
*/
public function setNumberOfConsumedCupsSetsNumberOfConsumedCups()
{
$this->subject->setNumberOfConsumedCups(123456);
self::assertSame(
123456,
$this->subject->getNumberOfConsumedCups()
);
}
self::assertSame(
123456,
$this->subject->getNumberOfConsumedCups()
);
}
/**
* @test
*/
public function getTextInitiallyReturnsEmptyString() {
self::assertSame(
'',
$this->subject->getText()
);
}
/**
* @test
*/
public function getTextInitiallyReturnsEmptyString()
{
self::assertSame(
'',
$this->subject->getText()
);
}
/**
* @test
*/
public function setTextSetsText() {
$this->subject->setText('foo bar');
/**
* @test
*/
public function setTextSetsText()
{
$this->subject->setText('foo bar');
self::assertSame(
'foo bar',
$this->subject->getText()
);
}
self::assertSame(
'foo bar',
$this->subject->getText()
);
}
}

View file

@ -22,28 +22,31 @@ use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaBeverageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @var TeaBeverageRepository
*/
protected $subject;
class TeaBeverageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
/**
* @var TeaBeverageRepository
*/
protected $subject;
/**
* @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $objectManager = null;
/**
* @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $objectManager = null;
protected function setUp() {
$this->objectManager = $this->getMock(ObjectManagerInterface::class);
$this->subject = new TeaBeverageRepository($this->objectManager);
}
protected function setUp()
{
$this->objectManager = $this->getMock(ObjectManagerInterface::class);
$this->subject = new TeaBeverageRepository($this->objectManager);
}
/**
* @test
*/
public function canBeInstantiated() {
self::assertNotNull(
$this->subject
);
}
/**
* @test
*/
public function canBeInstantiated()
{
self::assertNotNull(
$this->subject
);
}
}

View file

@ -14,36 +14,39 @@ namespace OliverKlee\Tea\Tests\Unit\Domain\Repository;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
use OliverKlee\Tea\Domain\Repository\TestimonialRepository;
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
/**
* Test case.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @var TestimonialRepository
*/
protected $subject;
class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
/**
* @var TestimonialRepository
*/
protected $subject;
/**
* @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $objectManager = null;
/**
* @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $objectManager = null;
protected function setUp() {
$this->objectManager = $this->getMock(ObjectManagerInterface::class);
$this->subject = new TestimonialRepository($this->objectManager);
}
protected function setUp()
{
$this->objectManager = $this->getMock(ObjectManagerInterface::class);
$this->subject = new TestimonialRepository($this->objectManager);
}
/**
* @test
*/
public function canBeInstantiated() {
self::assertNotNull(
$this->subject
);
}
/**
* @test
*/
public function canBeInstantiated()
{
self::assertNotNull(
$this->subject
);
}
}

View file

@ -11,34 +11,34 @@
***************************************************************/
$EM_CONF[$_EXTKEY] = array(
'title' => 'Tea example',
'description' => 'This extension serves as an example on how to unit-test different data types and relation types in TYPO3 extensions.',
'category' => 'plugin',
'author' => 'Oliver Klee',
'author_email' => 'typo3-coding@oliverklee.de',
'author_company' => 'oliverklee.de',
'shy' => '',
'priority' => '',
'module' => '',
'state' => 'experimental',
'internal' => '',
'uploadfolder' => '0',
'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'lockType' => '',
'version' => '0.0.1',
'constraints' => array(
'depends' => array(
'php' => '5.5.0-7.0.99',
'typo3' => '6.2.0-7.0.99',
'extbase' => '6.2.0-7.0.99',
'fluid' => '6.2.0-7.0.99',
'phpunit' => '4.0.0-5.9.99',
),
'conflicts' => array(
),
'suggests' => array(
),
),
'title' => 'Tea example',
'description' => 'This extension serves as an example on how to unit-test different data types and relation types in TYPO3 extensions.',
'category' => 'plugin',
'author' => 'Oliver Klee',
'author_email' => 'typo3-coding@oliverklee.de',
'author_company' => 'oliverklee.de',
'shy' => '',
'priority' => '',
'module' => '',
'state' => 'experimental',
'internal' => '',
'uploadfolder' => '0',
'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'lockType' => '',
'version' => '0.0.1',
'constraints' => array(
'depends' => array(
'php' => '5.5.0-7.0.99',
'typo3' => '6.2.0-7.0.99',
'extbase' => '6.2.0-7.0.99',
'fluid' => '6.2.0-7.0.99',
'phpunit' => '4.0.0-5.9.99',
),
'conflicts' => array(
),
'suggests' => array(
),
),
);

View file

@ -2,14 +2,14 @@
defined('TYPO3_MODE') or die('Access denied.');
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'OliverKlee.' . $_EXTKEY,
'Tea',
// all actions
array(
'Testimonial' => 'index',
),
// non-cacheable actions
array(
'Testimonial' => 'index',
)
'OliverKlee.' . $_EXTKEY,
'Tea',
// all actions
array(
'Testimonial' => 'index',
),
// non-cacheable actions
array(
'Testimonial' => 'index',
)
);

View file

@ -2,9 +2,9 @@
defined('TYPO3_MODE') or die('Access denied.');
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'OliverKlee.' . $_EXTKEY,
'Tea',
'Tea'
'OliverKlee.' . $_EXTKEY,
'Tea',
'Tea'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'Tea example');
@ -12,123 +12,123 @@ defined('TYPO3_MODE') or die('Access denied.');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_tea_domain_model_teabeverage', 'EXT:tea/Resources/Private/Language/locallang_csh_tx_tea_domain_model_teabeverage.xlf');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_tea_domain_model_teabeverage');
$GLOBALS['TCA']['tx_tea_domain_model_teabeverage'] = array(
'ctrl' => array(
'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage',
'label' => 'size',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'ctrl' => array(
'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage',
'label' => 'size',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => true,
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'versioningWS' => 2,
'versioning_followPages' => true,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => array(
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
),
'searchFields' => 'size,type,additions,testimonials,',
'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/TeaBeverage.php',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_tea_domain_model_teabeverage.gif'
),
'delete' => 'deleted',
'enablecolumns' => array(
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
),
'searchFields' => 'size,type,additions,testimonials,',
'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/TeaBeverage.php',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_tea_domain_model_teabeverage.gif'
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_tea_domain_model_teatype', 'EXT:tea/Resources/Private/Language/locallang_csh_tx_tea_domain_model_teatype.xlf');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_tea_domain_model_teatype');
$GLOBALS['TCA']['tx_tea_domain_model_teatype'] = array(
'ctrl' => array(
'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teatype',
'label' => 'title',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'ctrl' => array(
'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teatype',
'label' => 'title',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => true,
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'versioningWS' => 2,
'versioning_followPages' => true,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => array(
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
),
'searchFields' => 'title,caffeinated,',
'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/TeaType.php',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_tea_domain_model_teatype.gif'
),
'delete' => 'deleted',
'enablecolumns' => array(
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
),
'searchFields' => 'title,caffeinated,',
'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/TeaType.php',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_tea_domain_model_teatype.gif'
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_tea_domain_model_addition', 'EXT:tea/Resources/Private/Language/locallang_csh_tx_tea_domain_model_addition.xlf');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_tea_domain_model_addition');
$GLOBALS['TCA']['tx_tea_domain_model_addition'] = array(
'ctrl' => array(
'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_addition',
'label' => 'title',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'ctrl' => array(
'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_addition',
'label' => 'title',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => true,
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'versioningWS' => 2,
'versioning_followPages' => true,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => array(
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
),
'searchFields' => 'title,',
'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/Addition.php',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_tea_domain_model_addition.gif'
),
'delete' => 'deleted',
'enablecolumns' => array(
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
),
'searchFields' => 'title,',
'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/Addition.php',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_tea_domain_model_addition.gif'
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_tea_domain_model_testimonial', 'EXT:tea/Resources/Private/Language/locallang_csh_tx_tea_domain_model_testimonial.xlf');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_tea_domain_model_testimonial');
$GLOBALS['TCA']['tx_tea_domain_model_testimonial'] = array(
'ctrl' => array(
'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_testimonial',
'label' => 'date_of_posting',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'ctrl' => array(
'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_testimonial',
'label' => 'date_of_posting',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => true,
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'versioningWS' => 2,
'versioning_followPages' => true,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => array(
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
),
'searchFields' => 'date_of_posting,number_of_consumed_cups,text,',
'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/Testimonial.php',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_tea_domain_model_testimonial.gif'
),
'delete' => 'deleted',
'enablecolumns' => array(
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
),
'searchFields' => 'date_of_posting,number_of_consumed_cups,text,',
'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/Testimonial.php',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_tea_domain_model_testimonial.gif'
),
);