mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-10 03:36:12 +01: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> * @author Oliver Klee <typo3-coding@oliverklee.de>
*/ */
class TestimonialController extends ActionController { class TestimonialController extends ActionController
/** {
* @inject /**
* @var \OliverKlee\Tea\Domain\Repository\TestimonialRepository * @inject
*/ * @var \OliverKlee\Tea\Domain\Repository\TestimonialRepository
protected $testimonialRepository = null; */
protected $testimonialRepository = null;
/** /**
* Lists all testimonials. * Lists all testimonials.
* *
* @return void * @return void
*/ */
public function indexAction() { public function indexAction()
$this->view->assign('testimonials', $this->testimonialRepository->findAll()); {
} $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> * @author Oliver Klee <typo3-coding@oliverklee.de>
*/ */
class Addition extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject { class Addition extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
/** {
* @var string /**
* @validate NotEmpty * @var string
*/ * @validate NotEmpty
protected $title = ''; */
protected $title = '';
/** /**
* @return string $title * @return string $title
*/ */
public function getTitle() { public function getTitle()
return $this->title; {
} return $this->title;
}
/** /**
* @param string $title * @param string $title
* *
* @return void * @return void
*/ */
public function setTitle($title) { public function setTitle($title)
$this->title = $title; {
} $this->title = $title;
}
} }

View file

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

View file

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

View file

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

View file

@ -19,5 +19,6 @@ namespace OliverKlee\Tea\Domain\Repository;
* *
* @author Oliver Klee <typo3-coding@oliverklee.de> * @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> * @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> * @author Oliver Klee <typo3-coding@oliverklee.de>
*/ */
class FileUtility { class FileUtility
/** {
* Concatenates the files given as $sourceFilePaths and writes their contents into $targetFilePath. /**
* * Concatenates the files given as $sourceFilePaths and writes their contents into $targetFilePath.
* @param string $targetFilePath *
* @param string[] $sourceFilePaths * @param string $targetFilePath
* * @param string[] $sourceFilePaths
* @return void *
* * @return void
* @throws \InvalidArgumentException *
*/ * @throws \InvalidArgumentException
public function concatenate($targetFilePath, array $sourceFilePaths) { */
if ($targetFilePath === '') { public function concatenate($targetFilePath, array $sourceFilePaths)
throw new \InvalidArgumentException('$targetFileName must not be empty.', 1445631384); {
} if ($targetFilePath === '') {
throw new \InvalidArgumentException('$targetFileName must not be empty.', 1445631384);
}
$concatenatedContents = ''; $concatenatedContents = '';
foreach ($sourceFilePaths as $sourceFilePath) { foreach ($sourceFilePaths as $sourceFilePath) {
$concatenatedContents .= file_get_contents($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.'); defined('TYPO3_MODE') or die('Access denied.');
$GLOBALS['TCA']['tx_tea_domain_model_addition'] = array( $GLOBALS['TCA']['tx_tea_domain_model_addition'] = array(
'ctrl' => $GLOBALS['TCA']['tx_tea_domain_model_addition']['ctrl'], 'ctrl' => $GLOBALS['TCA']['tx_tea_domain_model_addition']['ctrl'],
'interface' => array( 'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title', 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title',
), ),
'types' => array( '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'), '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( 'palettes' => array(
'1' => array('showitem' => ''), '1' => array('showitem' => ''),
), ),
'columns' => array( 'columns' => array(
'sys_language_uid' => array( 'sys_language_uid' => array(
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language', 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => array( 'config' => array(
'type' => 'select', 'type' => 'select',
'foreign_table' => 'sys_language', 'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title', 'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array( 'items' => array(
array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1), array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0), array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0),
), ),
), ),
), ),
'l10n_parent' => array( 'l10n_parent' => array(
'displayCond' => 'FIELD:sys_language_uid:>:0', 'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent', 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => array( 'config' => array(
'type' => 'select', 'type' => 'select',
'items' => array( 'items' => array(
array('', 0), array('', 0),
), ),
'foreign_table' => 'tx_tea_domain_model_addition', '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)', '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( 'l10n_diffsource' => array(
'config' => array( 'config' => array(
'type' => 'passthrough', 'type' => 'passthrough',
), ),
), ),
't3ver_label' => array( 't3ver_label' => array(
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel', 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => array( 'config' => array(
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
) )
), ),
'hidden' => array( 'hidden' => array(
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden', 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => array( 'config' => array(
'type' => 'check', 'type' => 'check',
), ),
), ),
'starttime' => array( 'starttime' => array(
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank', 'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime', 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => array( 'config' => array(
'type' => 'input', 'type' => 'input',
'size' => 13, 'size' => 13,
'max' => 20, 'max' => 20,
'eval' => 'datetime', 'eval' => 'datetime',
'checkbox' => 0, 'checkbox' => 0,
'default' => 0, 'default' => 0,
'range' => array( 'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')), 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
), ),
), ),
), ),
'endtime' => array( 'endtime' => array(
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank', 'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime', 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => array( 'config' => array(
'type' => 'input', 'type' => 'input',
'size' => 13, 'size' => 13,
'max' => 20, 'max' => 20,
'eval' => 'datetime', 'eval' => 'datetime',
'checkbox' => 0, 'checkbox' => 0,
'default' => 0, 'default' => 0,
'range' => array( 'range' => array(
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')), 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
), ),
), ),
), ),
'title' => array( 'title' => array(
'exclude' => 0, 'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_addition.title', 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_addition.title',
'config' => array( 'config' => array(
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'eval' => 'trim,required', 'eval' => 'trim,required',
), ),
), ),
), ),
); );

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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