mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-12-22 13:06:11 +01:00

[CLEANUP] Empty out the extensions

This commit is contained in:
Oliver Klee 2017-12-22 22:18:55 +01:00
parent 5335064e80
commit 4b7ffe0546
59 changed files with 0 additions and 2596 deletions

View file

View file

@ -1,64 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Controller;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use OliverKlee\Tea\Domain\Model\Testimonial;
use OliverKlee\Tea\Domain\Repository\TestimonialRepository;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
/**
* This controller takes care of displaying testimonials.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TestimonialController extends ActionController
{
/**
* @var \OliverKlee\Tea\Domain\Repository\TestimonialRepository
*/
protected $testimonialRepository = null;
/**
* @param TestimonialRepository $repository
*
* @return void
*/
public function injectTestimonialRepository(TestimonialRepository $repository)
{
$this->testimonialRepository = $repository;
}
/**
* Lists all testimonials.
*
* @return void
*/
public function indexAction()
{
$this->view->assign('testimonials', $this->testimonialRepository->findAll());
}
/**
* @param Testimonial $testimonial
*
* @return void
*/
public function showAction(Testimonial $testimonial)
{
$this->view->assign('testimonial', $testimonial);
}
}

View file

View file

@ -1,49 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Model;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* This model represents an addition for tea like sugar or milk.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class Addition extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
{
/**
* @var string
* @validate NotEmpty
*/
protected $title = '';
/**
* @return string $title
*/
public function getTitle(): string
{
return $this->title;
}
/**
* @param string $title
*
* @return void
*/
public function setTitle(string $title)
{
$this->title = $title;
}
}

View file

@ -1,191 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Model;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* This model represents a good cup of tea.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
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 \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;
/**
* 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();
}
/**
* @return float $size
*/
public function getSize(): float
{
return $this->size;
}
/**
* @param float $size
*
* @return void
*/
public function setSize(float $size)
{
$this->size = $size;
}
/**
* @return TeaType|null $type
*/
public function getType()
{
return $this->type;
}
/**
* @param TeaType $type
*
* @return void
*/
public function setType(TeaType $type)
{
$this->type = $type;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Addition> $additions
*/
public function getAdditions(): ObjectStorage
{
return $this->additions;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $additions
*
* @return void
*/
public function setAdditions(ObjectStorage $additions)
{
$this->additions = $additions;
}
/**
* Adds an Addition.
*
* @param \OliverKlee\Tea\Domain\Model\Addition $addition
*
* @return void
*/
public function addAddition(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(Addition $additionToRemove)
{
$this->additions->detach($additionToRemove);
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Testimonial> $testimonials
*/
public function getTestimonials(): ObjectStorage
{
return $this->testimonials;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $testimonials
*
* @return void
*/
public function setTestimonials(ObjectStorage $testimonials)
{
$this->testimonials = $testimonials;
}
/**
* Adds an Testimonial.
*
* @param \OliverKlee\Tea\Domain\Model\Testimonial $testimonial
*
* @return void
*/
public function addTestimonial(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(Testimonial $testimonialToRemove)
{
$this->testimonials->detach($testimonialToRemove);
}
}

View file

@ -1,80 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Model;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* This model represents a tea type like "Earl Grey", "Gunpowder" or "Chamomile".
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var string
* @validate NotEmpty
*/
protected $title = '';
/**
* @var bool
*/
protected $caffeinated = false;
/**
* @return string
*/
public function getTitle(): string
{
return $this->title;
}
/**
* @param string $title
*
* @return void
*/
public function setTitle(string $title)
{
$this->title = $title;
}
/**
* @return bool
*/
public function getCaffeinated(): bool
{
return $this->caffeinated;
}
/**
* @param bool $caffeinated
*
* @return void
*/
public function setCaffeinated(bool $caffeinated)
{
$this->caffeinated = $caffeinated;
}
/**
* @return bool
*/
public function isCaffeinated(): bool
{
return $this->getCaffeinated();
}
}

View file

@ -1,94 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Model;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* This model represents a testimonial for a TeaBeverage.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var \DateTime
*/
protected $dateOfPosting = null;
/**
* @var int
*/
protected $numberOfConsumedCups = 0;
/**
* @var string
*/
protected $text = '';
/**
* @return \DateTime|null
*/
public function getDateOfPosting()
{
return $this->dateOfPosting;
}
/**
* @param \DateTime $dateOfPosting
*
* @return void
*/
public function setDateOfPosting(\DateTime $dateOfPosting)
{
$this->dateOfPosting = $dateOfPosting;
}
/**
* @return int $numberOfConsumedCups
*/
public function getNumberOfConsumedCups(): int
{
return $this->numberOfConsumedCups;
}
/**
* @param int $numberOfConsumedCups
*
* @return void
*/
public function setNumberOfConsumedCups(int $numberOfConsumedCups)
{
$this->numberOfConsumedCups = $numberOfConsumedCups;
}
/**
* @return string
*/
public function getText(): string
{
return $this->text;
}
/**
* @param string $text
*
* @return void
*/
public function setText(string $text)
{
$this->text = $text;
}
}

View file

View file

@ -1,26 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Repository;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* This is the repository for TeaBeverage models.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaBeverageRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
}

View file

@ -1,26 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Repository;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* This is the repository for Testimonial models.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TestimonialRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
}

View file

@ -1,49 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Utility;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* This class provides functions concerning files.
*
* @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(string $targetFilePath, array $sourceFilePaths)
{
if ($targetFilePath === '') {
throw new \InvalidArgumentException('$targetFileName must not be empty.', 1445631384);
}
$concatenatedContents = '';
foreach ($sourceFilePaths as $sourceFilePath) {
$concatenatedContents .= file_get_contents($sourceFilePath);
}
file_put_contents($targetFilePath, $concatenatedContents);
}
}

View file

View file

@ -1,130 +0,0 @@
<?php
defined('TYPO3_MODE') or die();
return [
'ctrl' => [
'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,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
'searchFields' => 'title,',
'iconfile' => 'EXT:tea/Resources/Public/Icons/tx_tea_domain_model_addition.gif',
],
'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title',
],
'types' => [
'1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'],
],
'palettes' => [
'1' => ['showitem' => ''],
],
'columns' => [
'sys_language_uid' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => [
['LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1],
['LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0],
],
],
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['', 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' => [
'config' => [
'type' => 'passthrough',
],
],
't3ver_label' => [
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => [
'type' => 'input',
'size' => 30,
'max' => 255,
],
],
'hidden' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => [
'type' => 'check',
],
],
'starttime' => [
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => [
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => [
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
],
],
],
'endtime' => [
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => [
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => [
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
],
],
],
'title' => [
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_addition.title',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim,required',
],
],
],
];

View file

@ -1,172 +0,0 @@
<?php
defined('TYPO3_MODE') or die();
return [
'ctrl' => [
'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,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
'searchFields' => 'size,type,additions,testimonials,',
'iconfile' => 'EXT:tea/Resources/Public/Icons/tx_tea_domain_model_teabeverage.gif',
],
'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, size, type, additions, testimonials',
],
'types' => [
'1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, size, type, additions, testimonials, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'],
],
'palettes' => [
'1' => ['showitem' => ''],
],
'columns' => [
'sys_language_uid' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => [
['LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1],
['LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0],
],
],
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['', 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' => [
'config' => [
'type' => 'passthrough',
],
],
't3ver_label' => [
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => [
'type' => 'input',
'size' => 30,
'max' => 255,
],
],
'hidden' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => [
'type' => 'check',
],
],
'starttime' => [
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => [
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => [
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
],
],
],
'endtime' => [
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => [
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => [
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
],
],
],
'size' => [
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage.size',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'double2',
],
],
'type' => [
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage.type',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'tx_tea_domain_model_teatype',
'minitems' => 0,
'maxitems' => 1,
],
],
'additions' => [
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage.additions',
'config' => [
'type' => 'select',
'renderType' => 'selectSingleBox',
'foreign_table' => 'tx_tea_domain_model_addition',
'MM' => 'tx_tea_teabeverage_addition_mm',
'size' => 10,
'autoSizeMax' => 30,
'maxitems' => 9999,
'multiple' => 0,
],
],
'testimonials' => [
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teabeverage.testimonials',
'config' => [
'type' => 'inline',
'foreign_table' => 'tx_tea_domain_model_testimonial',
'foreign_field' => 'teabeverage',
'maxitems' => 9999,
'appearance' => [
'collapseAll' => 0,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showAllLocalizationLink' => 1,
],
],
],
],
];

View file

@ -1,138 +0,0 @@
<?php
defined('TYPO3_MODE') or die();
return [
'ctrl' => [
'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,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
'searchFields' => 'title,caffeinated,',
'iconfile' => 'EXT:tea/Resources/Public/Icons/tx_tea_domain_model_teatype.gif',
],
'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, caffeinated',
],
'types' => [
'1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden title, caffeinated, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'],
],
'palettes' => [
'1' => ['showitem' => ''],
],
'columns' => [
'sys_language_uid' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => [
['LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1],
['LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0],
],
],
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['', 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' => [
'config' => [
'type' => 'passthrough',
],
],
't3ver_label' => [
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => [
'type' => 'input',
'size' => 30,
'max' => 255,
],
],
'hidden' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => [
'type' => 'check',
],
],
'starttime' => [
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => [
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => [
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
],
],
],
'endtime' => [
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => [
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => [
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
],
],
],
'title' => [
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teatype.title',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim,required',
],
],
'caffeinated' => [
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_teatype.caffeinated',
'config' => [
'type' => 'check',
'default' => 0,
],
],
],
];

View file

@ -1,156 +0,0 @@
<?php
defined('TYPO3_MODE') or die();
$GLOBALS['TCA']['tx_tea_domain_model_testimonial'] = [
'ctrl' => [
'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,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
'searchFields' => 'date_of_posting,number_of_consumed_cups,text,',
'iconfile' => 'EXT:tea/Resources/Public/Icons/tx_tea_domain_model_testimonial.gif',
],
'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, date_of_posting, number_of_consumed_cups, text',
],
'types' => [
'1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, date_of_posting, number_of_consumed_cups, text, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'],
],
'palettes' => [
'1' => ['showitem' => ''],
],
'columns' => [
'sys_language_uid' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => [
['LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1],
['LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0],
],
],
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['', 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' => [
'config' => [
'type' => 'passthrough',
],
],
't3ver_label' => [
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => [
'type' => 'input',
'size' => 30,
'max' => 255,
],
],
'hidden' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => [
'type' => 'check',
],
],
'starttime' => [
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => [
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => [
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
],
],
],
'endtime' => [
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => [
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => [
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')),
],
],
],
'date_of_posting' => [
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_testimonial.date_of_posting',
'config' => [
'type' => 'input',
'size' => 12,
'eval' => 'datetime',
'checkbox' => '0',
'default' => '0',
],
],
'number_of_consumed_cups' => [
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_testimonial.number_of_consumed_cups',
'config' => [
'type' => 'input',
'size' => 4,
'eval' => 'int',
],
],
'text' => [
'exclude' => 0,
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_testimonial.text',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 15,
'eval' => 'trim',
],
],
'teabeverage' => [
'config' => [
'type' => 'passthrough',
],
],
],
];

View file

View file

@ -1,21 +0,0 @@
plugin.tx_tea {
view {
# cat=plugin.tx_tea/file; type=string; label=Path to template root (FE)
templateRootPath = EXT:tea/Resources/Private/Templates/
# cat=plugin.tx_tea/file; type=string; label=Path to template partials (FE)
partialRootPath = EXT:tea/Resources/Private/Partials/
# cat=plugin.tx_tea/file; type=string; label=Path to template layouts (FE)
layoutRootPath = EXT:tea/Resources/Private/Layouts/
}
persistence {
# cat=plugin.tx_tea//a; type=string; label=Default storage PID
storagePid =
# cat=plugin.tx_tea//a; type=int; label=UID of the page/folder where all new records will be created
newRecordStoragePid =
}
settings {
}
}

View file

@ -1,15 +0,0 @@
plugin.tx_tea {
view {
templateRootPath = {$plugin.tx_tea.view.templateRootPath}
partialRootPath = {$plugin.tx_tea.view.partialRootPath}
layoutRootPath = {$plugin.tx_tea.view.layoutRootPath}
}
persistence {
storagePid = {$plugin.tx_tea.persistence.storagePid}
}
features {
rewrittenPropertyMapper = 1
}
}

View file

View file

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2013-11-05T11:24:27Z" product-name="tea">
<header/>
<body>
<trans-unit id="heading.testimonials">
<source>This is what our satisfied customers have to say:</source>
<target>Das sagen unsere zufriedenen Kunden:</target>
</trans-unit>
<trans-unit id="testimonials.cups.and.date">
<source>%1$u cups on</source>
<target>%1$u Tassen am</target>
</trans-unit>
<trans-unit id="date-and-time-format">
<source>Y-m-d H:i</source>
<target>d.m.Y H:i</target>
</trans-unit>
</body>
</file>
</xliff>

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2013-11-05T11:24:27Z" product-name="tea">
<header/>
<body>
<trans-unit id="heading.testimonials">
<source>This is what our satisfied customers have to say:</source>
</trans-unit>
<trans-unit id="testimonials.cups.and.date">
<source>%1$u cups on</source>
</trans-unit>
<trans-unit id="date-and-time-format">
<source>Y-m-d H:i</source>
</trans-unit>
</body>
</file>
</xliff>

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2013-11-01T20:56:40Z" product-name="tea">
<header/>
<body>
<trans-unit id="title.description">
<source>title</source>
</trans-unit>
</body>
</file>
</xliff>

View file

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2013-11-01T21:35:43Z" product-name="tea">
<header/>
<body>
<trans-unit id="size.description">
<source>size</source>
</trans-unit>
<trans-unit id="type.description">
<source>type</source>
</trans-unit>
<trans-unit id="additions.description">
<source>additions</source>
</trans-unit>
<trans-unit id="testimonials.description">
<source>testimonials</source>
</trans-unit>
</body>
</file>
</xliff>

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2013-11-01T20:56:40Z" product-name="tea">
<header/>
<body>
<trans-unit id="title.description">
<source>title</source>
</trans-unit>
<trans-unit id="caffeinated.description">
<source>caffeinated</source>
</trans-unit>
</body>
</file>
</xliff>

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2013-11-01T21:35:43Z" product-name="tea">
<header/>
<body>
<trans-unit id="date_of_posting.description">
<source>date of posting</source>
</trans-unit>
<trans-unit id="number_of_consumed_cups.description">
<source>number of consumed cups</source>
</trans-unit>
<trans-unit id="text.description">
<source>text</source>
</trans-unit>
</body>
</file>
</xliff>

View file

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2013-11-01T21:35:43Z" product-name="tea">
<header/>
<body>
<trans-unit id="tx_tea_domain_model_teabeverage">
<source>Tea Beverage</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_teabeverage.size">
<source>Size</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_teabeverage.type">
<source>Type</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_teabeverage.additions">
<source>Additions</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_teabeverage.testimonials">
<source>Testimonials</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_teatype">
<source>Tea Type</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_teatype.title">
<source>Title</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_teatype.caffeinated">
<source>Caffeinated</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_addition">
<source>Addition</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_addition.title">
<source>Title</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_testimonial">
<source>Testimonial</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_testimonial.date_of_posting">
<source>Date Of Posting</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_testimonial.number_of_consumed_cups">
<source>Number Of Consumed Cups</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_testimonial.text">
<source>Text</source>
</trans-unit>
</body>
</file>
</xliff>

View file

View file

@ -1,3 +0,0 @@
<div class="tx-tea">
<f:render section="main" />
</div>

View file

View file

View file

@ -1,15 +0,0 @@
<f:layout name="Default"/>
<f:section name="main">
<h2><f:translate key="heading.testimonials"/></h2>
<f:for each="{testimonials}" as="testimonial">
<h3>
<f:link.action action="show" arguments="{testimonial: testimonial}">
<f:format.printf arguments="{cups: testimonial.numberOfConsumedCups}">
<f:translate key="testimonials.cups.and.date"/>
</f:format.printf>
<f:format.date format="{f:translate(key: 'date-and-time-format')}">{testimonial.dateOfPosting}</f:format.date>
</f:link.action>
</h3>
</f:for>
</f:section>

View file

@ -1,13 +0,0 @@
<f:layout name="Default"/>
<f:section name="main">
<h3>
<f:format.printf arguments="{cups: testimonial.numberOfConsumedCups}">
<f:translate key="testimonials.cups.and.date"/>
</f:format.printf>
<f:format.date format="{f:translate(key: 'date-and-time-format')}">{testimonial.dateOfPosting}</f:format.date>
</h3>
<f:format.html>
{testimonial.text}
</f:format.html>
</f:section>

View file

View file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

View file

View file

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<tx_tea_domain_model_teabeverage>
<uid>1</uid>
<size>3.141</size>
</tx_tea_domain_model_teabeverage>
</dataset>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<tx_tea_domain_model_testimonial>
<uid>1</uid>
<text>A very good Early Grey!</text>
</tx_tea_domain_model_testimonial>
</dataset>

View file

@ -1,95 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Functional\Domain\Repository;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use OliverKlee\Tea\Domain\Model\TeaBeverage;
use OliverKlee\Tea\Domain\Repository\TeaBeverageRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
/**
* Test case.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaBeverageRepositoryTest extends \Nimut\TestingFramework\TestCase\FunctionalTestCase
{
/**
* @var string[]
*/
protected $testExtensionsToLoad = ['typo3conf/ext/tea'];
/**
* @var TeaBeverageRepository|\PHPUnit_Framework_MockObject_MockObject
*/
protected $subject = null;
protected function setUp()
{
parent::setUp();
/** @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);
}
/**
* @test
*/
public function findAllForNoRecordsReturnsEmptyContainer()
{
$container = $this->subject->findAll();
self::assertCount(0, $container);
}
/**
* @test
*/
public function findAllWithOneRecordFindsThisRecord()
{
$this->importDataSet(__DIR__ . '/Fixtures/TeaBeverages.xml');
$container = $this->subject->findAll();
/** @var TeaBeverage $first */
$first = $container->getFirst();
self::assertCount(1, $container);
self::assertSame(1, $first->getUid());
}
/**
* @test
*/
public function findByUidForExistingRecordReturnsModelWithData()
{
$this->importDataSet(__DIR__ . '/Fixtures/TeaBeverages.xml');
/** @var TeaBeverage $model */
$model = $this->subject->findByUid(1);
self::assertNotNull($model);
self::assertEquals(
3.141,
$model->getSize(),
'',
0.001
);
}
}

View file

@ -1,93 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Functional\Domain\Repository;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use OliverKlee\Tea\Domain\Model\Testimonial;
use OliverKlee\Tea\Domain\Repository\TestimonialRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
/**
* Test case.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TestimonialRepositoryTest extends \Nimut\TestingFramework\TestCase\FunctionalTestCase
{
/**
* @var string[]
*/
protected $testExtensionsToLoad = ['typo3conf/ext/tea'];
/**
* @var TestimonialRepository
*/
protected $subject = null;
protected function setUp()
{
parent::setUp();
/** @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);
}
/**
* @test
*/
public function findAllForNoRecordsReturnsEmptyContainer()
{
$container = $this->subject->findAll();
self::assertCount(0, $container);
}
/**
* @test
*/
public function findAllWithOneRecordFindsThisRecord()
{
$this->importDataSet(__DIR__ . '/Fixtures/Testimonials.xml');
$uid = 1;
$container = $this->subject->findAll();
/** @var Testimonial $first */
$first = $container->getFirst();
self::assertCount(1, $container);
self::assertSame($uid, $first->getUid());
}
/**
* @test
*/
public function findByUidForExistingRecordReturnsModelWithData()
{
$this->importDataSet(__DIR__ . '/Fixtures/Testimonials.xml');
$uid = 1;
/** @var Testimonial $model */
$model = $this->subject->findByUid($uid);
self::assertNotNull($model);
$text = 'A very good Early Grey!';
self::assertSame($text, $model->getText());
}
}

View file

@ -1,133 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Functional\Utility;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;
/**
* Test case.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class FileUtilityTest extends \Nimut\TestingFramework\TestCase\FunctionalTestCase
{
/**
* @var string[]
*/
protected $testExtensionsToLoad = ['typo3conf/ext/tea'];
/**
* @var \OliverKlee\Tea\Utility\FileUtility
*/
protected $subject = null;
/**
* @var vfsStreamDirectory
*/
protected $root = null;
/** @var string */
protected $rootDirectoryName = 'home';
/**
* @var string
*/
protected $targetFilePath = '';
protected function setUp()
{
parent::setUp();
$this->root = vfsStream::setup('home');
$this->targetFilePath = vfsStream::url('home/target.txt');
$this->subject = new \OliverKlee\Tea\Utility\FileUtility();
}
/**
* @test
*/
public function concatenateWithEmptyTargetFileNameThrowsException()
{
$this->expectException(\InvalidArgumentException::class);
$this->subject->concatenate('', ['foo.txt']);
}
/**
* @test
*/
public function concatenateWithNoSourceFilesCreatesEmptyTargetFile()
{
$this->subject->concatenate($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, '');
$this->subject->concatenate($this->targetFilePath, [$sourceFileName]);
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);
$this->subject->concatenate($this->targetFilePath, [$sourceFileName]);
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);
$this->subject->concatenate(
$this->targetFilePath,
[$sourceFileName1, $sourceFileName2]
);
self::assertStringEqualsFile(
$this->targetFilePath, $contents1 . $contents2
);
}
}

0
Tests/Unit/.gitkeep Normal file
View file

View file

@ -1,96 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Controller;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use OliverKlee\Tea\Controller\TestimonialController;
use OliverKlee\Tea\Domain\Repository\TestimonialRepository;
use Prophecy\Prophecy\ObjectProphecy;
use Prophecy\Prophecy\ProphecySubjectInterface;
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 bool
*/
protected $backupGlobals = false;
/**
* @var TestimonialController
*/
protected $subject = null;
/**
* @var ViewInterface|ObjectProphecy
*/
protected $viewProphecy = null;
/**
* @var ViewInterface|ProphecySubjectInterface
*/
protected $view = null;
/**
* @var TestimonialRepository|ObjectProphecy
*/
protected $testimonialRepositoryProphecy = null;
/**
* @var TestimonialRepository|ProphecySubjectInterface
*/
protected $testimonialRepository = null;
protected function setUp()
{
$this->subject = new TestimonialController();
$this->viewProphecy = $this->prophesize(ViewInterface::class);
$this->view = $this->viewProphecy->reveal();
$this->inject($this->subject, 'view', $this->view);
$this->testimonialRepositoryProphecy = $this->prophesize(TestimonialRepository::class);
$this->testimonialRepository = $this->testimonialRepositoryProphecy->reveal();
$this->subject->injectTestimonialRepository($this->testimonialRepository);
}
/**
* @test
*/
public function indexActionCanBeCalled()
{
$this->subject->indexAction();
}
/**
* @test
*/
public function indexActionPassesAllTestimonialsAsTestimonialsToView()
{
$allTestimonials = new ObjectStorage();
$this->testimonialRepositoryProphecy->findAll()->willReturn($allTestimonials);
$this->viewProphecy->assign('testimonials', $allTestimonials)->shouldBeCalled();
$this->subject->indexAction();
}
}

View file

@ -1,60 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Test case.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class AdditionTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
{
/**
* @var bool
*/
protected $backupGlobals = false;
/**
* @var \OliverKlee\Tea\Domain\Model\Addition
*/
protected $subject = null;
protected function setUp()
{
$this->subject = new \OliverKlee\Tea\Domain\Model\Addition();
}
/**
* @test
*/
public function getTitleInitiallyReturnsEmptyString()
{
self::assertSame('', $this->subject->getTitle());
}
/**
* @test
*/
public function setTitleSetsTitle()
{
$title = 'foo bar';
$this->subject->setTitle($title);
self::assertSame($title, $this->subject->getTitle());
}
}

View file

@ -1,205 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* Test case.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaBeverageTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
{
/**
* @var bool
*/
protected $backupGlobals = false;
/**
* @var \OliverKlee\Tea\Domain\Model\TeaBeverage
*/
protected $subject = null;
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 setSizeSetsSize()
{
$size = 1234.56;
$this->subject->setSize($size);
self::assertSame($size, $this->subject->getSize());
}
/**
* @test
*/
public function getTypeInitiallyReturnsNull()
{
self::assertNull(
$this->subject->getType()
);
}
/**
* @test
*/
public function setTypeSetsType()
{
$type = new \OliverKlee\Tea\Domain\Model\TeaType();
$this->subject->setType($type);
self::assertSame(
$type,
$this->subject->getType()
);
}
/**
* @test
*/
public function getAdditionsInitiallyReturnsEmptyStorage()
{
self::assertEquals(
new ObjectStorage(),
$this->subject->getAdditions()
);
}
/**
* @test
*/
public function setAdditionsSetsAdditions()
{
$items = new ObjectStorage();
$this->subject->setAdditions($items);
self::assertSame(
$items,
$this->subject->getAdditions()
);
}
/**
* @test
*/
public function addAdditionAddsAddition()
{
$items = new ObjectStorage();
$this->subject->setAdditions($items);
$newItem = new \OliverKlee\Tea\Domain\Model\Addition();
$this->subject->addAddition($newItem);
self::assertTrue(
$this->subject->getAdditions()->contains($newItem)
);
}
/**
* @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);
self::assertFalse(
$this->subject->getAdditions()->contains($newItem)
);
}
/**
* @test
*/
public function getTestimonialsInitiallyReturnsEmptyStorage()
{
self::assertEquals(
new ObjectStorage(),
$this->subject->getTestimonials()
);
}
/**
* @test
*/
public function setTestimonialsSetsTestimonials()
{
$items = new ObjectStorage();
$this->subject->setTestimonials($items);
self::assertSame(
$items,
$this->subject->getTestimonials()
);
}
/**
* @test
*/
public function addTestimonialAddsTestimonial()
{
$items = new ObjectStorage();
$this->subject->setTestimonials($items);
$newItem = new \OliverKlee\Tea\Domain\Model\Testimonial();
$this->subject->addTestimonial($newItem);
self::assertTrue(
$this->subject->getTestimonials()->contains($newItem)
);
}
/**
* @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);
self::assertFalse(
$this->subject->getTestimonials()->contains($newItem)
);
}
}

View file

@ -1,78 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Test case.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaTypeTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
{
/**
* @var bool
*/
protected $backupGlobals = false;
/**
* @var \OliverKlee\Tea\Domain\Model\TeaType
*/
protected $subject = null;
protected function setUp()
{
$this->subject = new \OliverKlee\Tea\Domain\Model\TeaType();
}
/**
* @test
*/
public function getTitleInitiallyReturnsEmptyString()
{
self::assertSame('', $this->subject->getTitle());
}
/**
* @test
*/
public function setTitleSetsTitle()
{
$title = 'foo bar';
$this->subject->setTitle($title);
self::assertSame($title, $this->subject->getTitle());
}
/**
* @test
*/
public function getCaffeinatedInitiallyReturnsFalse()
{
self::assertFalse($this->subject->getCaffeinated());
}
/**
* @test
*/
public function setCaffeinatedSetsCaffeinated()
{
$this->subject->setCaffeinated(true);
self::assertTrue($this->subject->getCaffeinated());
}
}

View file

@ -1,102 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Test case.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TestimonialTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
{
/**
* @var bool
*/
protected $backupGlobals = false;
/**
* @var \OliverKlee\Tea\Domain\Model\Testimonial
*/
protected $subject = null;
protected function setUp()
{
$this->subject = new \OliverKlee\Tea\Domain\Model\Testimonial();
}
/**
* @test
*/
public function getDateOfPostingInitiallyReturnsNull()
{
self::assertNull($this->subject->getDateOfPosting());
}
/**
* @test
*/
public function setDateOfPostingSetsDateOfPosting()
{
$date = new \DateTime();
$this->subject->setDateOfPosting($date);
self::assertSame(
$date,
$this->subject->getDateOfPosting()
);
}
/**
* @test
*/
public function getNumberOfConsumedCupsInitiallyReturnsZero()
{
self::assertSame(0, $this->subject->getNumberOfConsumedCups());
}
/**
* @test
*/
public function setNumberOfConsumedCupsSetsNumberOfConsumedCups()
{
$number = 123456;
$this->subject->setNumberOfConsumedCups($number);
self::assertSame($number, $this->subject->getNumberOfConsumedCups());
}
/**
* @test
*/
public function getTextInitiallyReturnsEmptyString()
{
self::assertSame('', $this->subject->getText());
}
/**
* @test
*/
public function setTextSetsText()
{
$text = 'foo bar';
$this->subject->setText($text);
self::assertSame($text, $this->subject->getText());
}
}

View file

@ -1,60 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Domain\Repository;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use OliverKlee\Tea\Domain\Repository\TeaBeverageRepository;
use Prophecy\Prophecy\ProphecySubjectInterface;
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
use TYPO3\CMS\Extbase\Persistence\Repository;
/**
* Test case.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaBeverageRepositoryTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
{
/**
* @var bool
*/
protected $backupGlobals = false;
/**
* @var TeaBeverageRepository
*/
protected $subject;
/**
* @var ObjectManagerInterface|ProphecySubjectInterface
*/
protected $objectManager = null;
protected function setUp()
{
$objectManagerProphecy = $this->prophesize(ObjectManagerInterface::class);
$this->objectManager = $objectManagerProphecy->reveal();
$this->subject = new TeaBeverageRepository($this->objectManager);
}
/**
* @test
*/
public function isRepository()
{
self::assertInstanceOf(Repository::class, $this->subject);
}
}

View file

@ -1,60 +0,0 @@
<?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Domain\Repository;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use OliverKlee\Tea\Domain\Repository\TestimonialRepository;
use Prophecy\Prophecy\ProphecySubjectInterface;
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
use TYPO3\CMS\Extbase\Persistence\Repository;
/**
* Test case.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TestimonialRepositoryTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
{
/**
* @var bool
*/
protected $backupGlobals = false;
/**
* @var TestimonialRepository
*/
protected $subject;
/**
* @var ObjectManagerInterface|ProphecySubjectInterface
*/
protected $objectManager = null;
protected function setUp()
{
$objectManagerProphecy = $this->prophesize(ObjectManagerInterface::class);
$this->objectManager = $objectManagerProphecy->reveal();
$this->subject = new TestimonialRepository($this->objectManager);
}
/**
* @test
*/
public function isRepository()
{
self::assertInstanceOf(Repository::class, $this->subject);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

View file

@ -1,15 +0,0 @@
<?php
defined('TYPO3_MODE') or die('Access denied.');
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'OliverKlee.' . $_EXTKEY,
'Tea',
// all actions
[
'Testimonial' => 'index,show',
],
// non-cacheable actions
[
'Testimonial' => '',
]
);

View file

@ -1,22 +0,0 @@
<?php
defined('TYPO3_MODE') or die('Access denied.');
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'OliverKlee.' . $_EXTKEY,
'Tea',
'Tea'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'Tea example');
\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::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::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::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');

View file

@ -1,172 +0,0 @@
#
# Table structure for table 'tx_tea_domain_model_teabeverage'
#
CREATE TABLE tx_tea_domain_model_teabeverage (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
size double(11,2) DEFAULT '0.00' NOT NULL,
type int(11) unsigned DEFAULT '0',
additions int(11) unsigned DEFAULT '0' NOT NULL,
testimonials int(11) unsigned DEFAULT '0' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
starttime int(11) unsigned DEFAULT '0' NOT NULL,
endtime int(11) unsigned DEFAULT '0' NOT NULL,
t3ver_oid int(11) DEFAULT '0' NOT NULL,
t3ver_id int(11) DEFAULT '0' NOT NULL,
t3ver_wsid int(11) DEFAULT '0' NOT NULL,
t3ver_label varchar(255) DEFAULT '' NOT NULL,
t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
t3ver_stage int(11) DEFAULT '0' NOT NULL,
t3ver_count int(11) DEFAULT '0' NOT NULL,
t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
t3ver_move_id int(11) DEFAULT '0' NOT NULL,
t3_origuid int(11) DEFAULT '0' NOT NULL,
sys_language_uid int(11) DEFAULT '0' NOT NULL,
l10n_parent int(11) DEFAULT '0' NOT NULL,
l10n_diffsource mediumblob,
PRIMARY KEY (uid),
KEY parent (pid),
KEY t3ver_oid (t3ver_oid,t3ver_wsid),
KEY language (l10n_parent,sys_language_uid)
);
#
# Table structure for table 'tx_tea_domain_model_teatype'
#
CREATE TABLE tx_tea_domain_model_teatype (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
title varchar(255) DEFAULT '' NOT NULL,
caffeinated tinyint(1) unsigned DEFAULT '0' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
starttime int(11) unsigned DEFAULT '0' NOT NULL,
endtime int(11) unsigned DEFAULT '0' NOT NULL,
t3ver_oid int(11) DEFAULT '0' NOT NULL,
t3ver_id int(11) DEFAULT '0' NOT NULL,
t3ver_wsid int(11) DEFAULT '0' NOT NULL,
t3ver_label varchar(255) DEFAULT '' NOT NULL,
t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
t3ver_stage int(11) DEFAULT '0' NOT NULL,
t3ver_count int(11) DEFAULT '0' NOT NULL,
t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
t3ver_move_id int(11) DEFAULT '0' NOT NULL,
t3_origuid int(11) DEFAULT '0' NOT NULL,
sys_language_uid int(11) DEFAULT '0' NOT NULL,
l10n_parent int(11) DEFAULT '0' NOT NULL,
l10n_diffsource mediumblob,
PRIMARY KEY (uid),
KEY parent (pid),
KEY t3ver_oid (t3ver_oid,t3ver_wsid),
KEY language (l10n_parent,sys_language_uid)
);
#
# Table structure for table 'tx_tea_domain_model_addition'
#
CREATE TABLE tx_tea_domain_model_addition (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
title varchar(255) DEFAULT '' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
starttime int(11) unsigned DEFAULT '0' NOT NULL,
endtime int(11) unsigned DEFAULT '0' NOT NULL,
t3ver_oid int(11) DEFAULT '0' NOT NULL,
t3ver_id int(11) DEFAULT '0' NOT NULL,
t3ver_wsid int(11) DEFAULT '0' NOT NULL,
t3ver_label varchar(255) DEFAULT '' NOT NULL,
t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
t3ver_stage int(11) DEFAULT '0' NOT NULL,
t3ver_count int(11) DEFAULT '0' NOT NULL,
t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
t3ver_move_id int(11) DEFAULT '0' NOT NULL,
t3_origuid int(11) DEFAULT '0' NOT NULL,
sys_language_uid int(11) DEFAULT '0' NOT NULL,
l10n_parent int(11) DEFAULT '0' NOT NULL,
l10n_diffsource mediumblob,
PRIMARY KEY (uid),
KEY parent (pid),
KEY t3ver_oid (t3ver_oid,t3ver_wsid),
KEY language (l10n_parent,sys_language_uid)
);
#
# Table structure for table 'tx_tea_domain_model_testimonial'
#
CREATE TABLE tx_tea_domain_model_testimonial (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
teabeverage int(11) unsigned DEFAULT '0' NOT NULL,
date_of_posting int(11) unsigned DEFAULT '0' NOT NULL,
number_of_consumed_cups int(11) DEFAULT '0' NOT NULL,
text text NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
starttime int(11) unsigned DEFAULT '0' NOT NULL,
endtime int(11) unsigned DEFAULT '0' NOT NULL,
t3ver_oid int(11) DEFAULT '0' NOT NULL,
t3ver_id int(11) DEFAULT '0' NOT NULL,
t3ver_wsid int(11) DEFAULT '0' NOT NULL,
t3ver_label varchar(255) DEFAULT '' NOT NULL,
t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
t3ver_stage int(11) DEFAULT '0' NOT NULL,
t3ver_count int(11) DEFAULT '0' NOT NULL,
t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
t3ver_move_id int(11) DEFAULT '0' NOT NULL,
t3_origuid int(11) DEFAULT '0' NOT NULL,
sys_language_uid int(11) DEFAULT '0' NOT NULL,
l10n_parent int(11) DEFAULT '0' NOT NULL,
l10n_diffsource mediumblob,
PRIMARY KEY (uid),
KEY parent (pid),
KEY t3ver_oid (t3ver_oid,t3ver_wsid),
KEY language (l10n_parent,sys_language_uid)
);
#
# Table structure for table 'tx_tea_teabeverage_addition_mm'
#
CREATE TABLE tx_tea_teabeverage_addition_mm (
uid_local int(11) unsigned DEFAULT '0' NOT NULL,
uid_foreign int(11) unsigned DEFAULT '0' NOT NULL,
sorting int(11) unsigned DEFAULT '0' NOT NULL,
sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,
KEY uid_local (uid_local),
KEY uid_foreign (uid_foreign)
);