mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-11-22 18:16:13 +01:00
[CLEANUP] Reformat the code as PSR-2
This commit is contained in:
parent
39db663279
commit
b6bb92d0da
25 changed files with 1591 additions and 1493 deletions
|
@ -21,7 +21,8 @@ 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
|
* @inject
|
||||||
* @var \OliverKlee\Tea\Domain\Repository\TestimonialRepository
|
* @var \OliverKlee\Tea\Domain\Repository\TestimonialRepository
|
||||||
|
@ -33,7 +34,8 @@ class TestimonialController extends ActionController {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function indexAction() {
|
public function indexAction()
|
||||||
|
{
|
||||||
$this->view->assign('testimonials', $this->testimonialRepository->findAll());
|
$this->view->assign('testimonials', $this->testimonialRepository->findAll());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,7 +19,8 @@ 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
|
* @var string
|
||||||
* @validate NotEmpty
|
* @validate NotEmpty
|
||||||
|
@ -29,7 +30,8 @@ class Addition extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject {
|
||||||
/**
|
/**
|
||||||
* @return string $title
|
* @return string $title
|
||||||
*/
|
*/
|
||||||
public function getTitle() {
|
public function getTitle()
|
||||||
|
{
|
||||||
return $this->title;
|
return $this->title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +40,8 @@ class Addition extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setTitle($title) {
|
public function setTitle($title)
|
||||||
|
{
|
||||||
$this->title = $title;
|
$this->title = $title;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,7 +19,8 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -48,7 +49,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @return TeaBeverage
|
* @return TeaBeverage
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
|
{
|
||||||
$this->initializeStorageObjects();
|
$this->initializeStorageObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +59,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function initializeStorageObjects() {
|
protected function initializeStorageObjects()
|
||||||
|
{
|
||||||
$this->additions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
|
$this->additions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
|
||||||
$this->testimonials = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
|
$this->testimonials = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
|
||||||
}
|
}
|
||||||
|
@ -65,7 +68,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
/**
|
/**
|
||||||
* @return float $size
|
* @return float $size
|
||||||
*/
|
*/
|
||||||
public function getSize() {
|
public function getSize()
|
||||||
|
{
|
||||||
return $this->size;
|
return $this->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,14 +78,16 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,14 +96,16 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +114,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +126,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,14 +138,16 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +156,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +168,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +180,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @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);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,7 +19,8 @@ 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
|
* @var string
|
||||||
* @validate NotEmpty
|
* @validate NotEmpty
|
||||||
|
@ -34,7 +35,8 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
/**
|
/**
|
||||||
* @return string $title
|
* @return string $title
|
||||||
*/
|
*/
|
||||||
public function getTitle() {
|
public function getTitle()
|
||||||
|
{
|
||||||
return $this->title;
|
return $this->title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,14 +45,16 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,14 +63,16 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @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();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,7 +19,8 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -38,7 +39,8 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
/**
|
/**
|
||||||
* @return \DateTime $dateOfPosting
|
* @return \DateTime $dateOfPosting
|
||||||
*/
|
*/
|
||||||
public function getDateOfPosting() {
|
public function getDateOfPosting()
|
||||||
|
{
|
||||||
return $this->dateOfPosting;
|
return $this->dateOfPosting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,14 +49,16 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,14 +67,16 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +85,8 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setText($text) {
|
public function setText($text)
|
||||||
|
{
|
||||||
$this->text = $text;
|
$this->text = $text;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
{
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
{
|
||||||
}
|
}
|
|
@ -19,7 +19,8 @@ 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.
|
||||||
*
|
*
|
||||||
|
@ -30,7 +31,8 @@ class FileUtility {
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function concatenate($targetFilePath, array $sourceFilePaths) {
|
public function concatenate($targetFilePath, array $sourceFilePaths)
|
||||||
|
{
|
||||||
if ($targetFilePath === '') {
|
if ($targetFilePath === '') {
|
||||||
throw new \InvalidArgumentException('$targetFileName must not be empty.', 1445631384);
|
throw new \InvalidArgumentException('$targetFileName must not be empty.', 1445631384);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,13 +24,15 @@ 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()) {
|
if (!$this->createDatabase()) {
|
||||||
self::markTestSkipped('Test database could not be created.');
|
self::markTestSkipped('Test database could not be created.');
|
||||||
}
|
}
|
||||||
|
@ -43,7 +45,8 @@ class TeaBeverageRepositoryTest extends \Tx_Phpunit_Database_TestCase {
|
||||||
$this->subject = $objectManager->get(TeaBeverageRepository::class);
|
$this->subject = $objectManager->get(TeaBeverageRepository::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown() {
|
protected function tearDown()
|
||||||
|
{
|
||||||
$this->dropDatabase();
|
$this->dropDatabase();
|
||||||
$this->switchToTypo3Database();
|
$this->switchToTypo3Database();
|
||||||
}
|
}
|
||||||
|
@ -51,7 +54,8 @@ class TeaBeverageRepositoryTest extends \Tx_Phpunit_Database_TestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function findAllForNoRecordsReturnsEmptyContainer() {
|
public function findAllForNoRecordsReturnsEmptyContainer()
|
||||||
|
{
|
||||||
$container = $this->subject->findAll();
|
$container = $this->subject->findAll();
|
||||||
|
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
|
@ -63,7 +67,8 @@ class TeaBeverageRepositoryTest extends \Tx_Phpunit_Database_TestCase {
|
||||||
/**
|
/**
|
||||||
* @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();
|
||||||
|
@ -83,7 +88,8 @@ class TeaBeverageRepositoryTest extends \Tx_Phpunit_Database_TestCase {
|
||||||
/**
|
/**
|
||||||
* @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 */
|
||||||
|
|
|
@ -24,7 +24,8 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -35,7 +36,8 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
*/
|
*/
|
||||||
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 */
|
||||||
|
@ -45,14 +47,16 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
$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(
|
||||||
|
@ -64,7 +68,8 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @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();
|
||||||
|
@ -84,7 +89,8 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function findByUidForExistingRecordReturnsModelWithData() {
|
public function findByUidForExistingRecordReturnsModelWithData()
|
||||||
|
{
|
||||||
$text = 'A very good Early Grey!';
|
$text = 'A very good Early Grey!';
|
||||||
$uid = $this->testingFramework->createRecord(
|
$uid = $this->testingFramework->createRecord(
|
||||||
'tx_tea_domain_model_testimonial', array('text' => $text)
|
'tx_tea_domain_model_testimonial', array('text' => $text)
|
||||||
|
|
|
@ -22,7 +22,8 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -41,7 +42,8 @@ class FileUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
*/
|
*/
|
||||||
protected $targetFilePath = '';
|
protected $targetFilePath = '';
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp()
|
||||||
|
{
|
||||||
$this->root = vfsStream::setup('home');
|
$this->root = vfsStream::setup('home');
|
||||||
$this->targetFilePath = vfsStream::url('home/target.txt');
|
$this->targetFilePath = vfsStream::url('home/target.txt');
|
||||||
|
|
||||||
|
@ -52,14 +54,16 @@ class FileUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
* @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(
|
||||||
|
@ -71,7 +75,8 @@ class FileUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function concatenateWithOneEmptySourceFileCreatesEmptyTargetFile() {
|
public function concatenateWithOneEmptySourceFileCreatesEmptyTargetFile()
|
||||||
|
{
|
||||||
// This is one way to create a file with contents, using PHP's file functions.
|
// This is one way to create a file with contents, using PHP's file functions.
|
||||||
$sourceFileName = vfsStream::url('home/source.txt');
|
$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.
|
// Just calling vfsStream::url does not create the file yet. We need to write into it to create it.
|
||||||
|
@ -88,7 +93,8 @@ class FileUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function concatenateWithOneFileCopiesContentsFromSourceFileToTargetFile() {
|
public function concatenateWithOneFileCopiesContentsFromSourceFileToTargetFile()
|
||||||
|
{
|
||||||
// This is vfsStream's way of creating a file with contents.
|
// This is vfsStream's way of creating a file with contents.
|
||||||
$contents = 'Hello world!';
|
$contents = 'Hello world!';
|
||||||
$sourceFileName = vfsStream::url('home/source.txt');
|
$sourceFileName = vfsStream::url('home/source.txt');
|
||||||
|
@ -105,7 +111,8 @@ class FileUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function concatenateWithTwoFileCopiesContentsFromBothFilesInOrderToTargetFile() {
|
public function concatenateWithTwoFileCopiesContentsFromBothFilesInOrderToTargetFile()
|
||||||
|
{
|
||||||
$contents1 = 'Hello ';
|
$contents1 = 'Hello ';
|
||||||
$sourceFileName1 = vfsStream::url('home/source1.txt');
|
$sourceFileName1 = vfsStream::url('home/source1.txt');
|
||||||
file_put_contents($sourceFileName1, $contents1);
|
file_put_contents($sourceFileName1, $contents1);
|
||||||
|
|
|
@ -14,17 +14,18 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -40,7 +41,8 @@ class TestimonialControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
|
@ -53,14 +55,16 @@ class TestimonialControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @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();
|
$allTestimonials = new ObjectStorage();
|
||||||
$this->testimonialRepository->expects(self::any())->method('findAll')
|
$this->testimonialRepository->expects(self::any())->method('findAll')
|
||||||
->will(self::returnValue($allTestimonials));
|
->will(self::returnValue($allTestimonials));
|
||||||
|
|
|
@ -19,20 +19,23 @@ 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()
|
||||||
|
@ -42,7 +45,8 @@ class AdditionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function setTitleSetsTitle() {
|
public function setTitleSetsTitle()
|
||||||
|
{
|
||||||
$this->subject->setTitle('foo bar');
|
$this->subject->setTitle('foo bar');
|
||||||
|
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
|
|
|
@ -21,20 +21,23 @@ 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(
|
self::assertSame(
|
||||||
0.0,
|
0.0,
|
||||||
$this->subject->getSize()
|
$this->subject->getSize()
|
||||||
|
@ -44,7 +47,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function setSizeSetsSize() {
|
public function setSizeSetsSize()
|
||||||
|
{
|
||||||
$this->subject->setSize(1234.56);
|
$this->subject->setSize(1234.56);
|
||||||
|
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
|
@ -56,7 +60,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function getTypeInitiallyReturnsNull() {
|
public function getTypeInitiallyReturnsNull()
|
||||||
|
{
|
||||||
self::assertNull(
|
self::assertNull(
|
||||||
$this->subject->getType()
|
$this->subject->getType()
|
||||||
);
|
);
|
||||||
|
@ -65,7 +70,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function setTypeSetsType() {
|
public function setTypeSetsType()
|
||||||
|
{
|
||||||
$type = new \OliverKlee\Tea\Domain\Model\TeaType();
|
$type = new \OliverKlee\Tea\Domain\Model\TeaType();
|
||||||
$this->subject->setType($type);
|
$this->subject->setType($type);
|
||||||
|
|
||||||
|
@ -78,7 +84,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function getAdditionsInitiallyReturnsEmptyStorage() {
|
public function getAdditionsInitiallyReturnsEmptyStorage()
|
||||||
|
{
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
new ObjectStorage(),
|
new ObjectStorage(),
|
||||||
$this->subject->getAdditions()
|
$this->subject->getAdditions()
|
||||||
|
@ -88,7 +95,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function setAdditionsSetsAdditions() {
|
public function setAdditionsSetsAdditions()
|
||||||
|
{
|
||||||
$items = new ObjectStorage();
|
$items = new ObjectStorage();
|
||||||
$this->subject->setAdditions($items);
|
$this->subject->setAdditions($items);
|
||||||
|
|
||||||
|
@ -101,7 +109,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function addAdditionAddsAddition() {
|
public function addAdditionAddsAddition()
|
||||||
|
{
|
||||||
$items = new ObjectStorage();
|
$items = new ObjectStorage();
|
||||||
$this->subject->setAdditions($items);
|
$this->subject->setAdditions($items);
|
||||||
|
|
||||||
|
@ -116,7 +125,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function removeAdditionRemovesAddition() {
|
public function removeAdditionRemovesAddition()
|
||||||
|
{
|
||||||
$items = new ObjectStorage();
|
$items = new ObjectStorage();
|
||||||
$this->subject->setAdditions($items);
|
$this->subject->setAdditions($items);
|
||||||
|
|
||||||
|
@ -132,7 +142,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function getTestimonialsInitiallyReturnsEmptyStorage() {
|
public function getTestimonialsInitiallyReturnsEmptyStorage()
|
||||||
|
{
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
new ObjectStorage(),
|
new ObjectStorage(),
|
||||||
$this->subject->getTestimonials()
|
$this->subject->getTestimonials()
|
||||||
|
@ -142,7 +153,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function setTestimonialsSetsTestimonials() {
|
public function setTestimonialsSetsTestimonials()
|
||||||
|
{
|
||||||
$items = new ObjectStorage();
|
$items = new ObjectStorage();
|
||||||
$this->subject->setTestimonials($items);
|
$this->subject->setTestimonials($items);
|
||||||
|
|
||||||
|
@ -155,7 +167,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function addTestimonialAddsTestimonial() {
|
public function addTestimonialAddsTestimonial()
|
||||||
|
{
|
||||||
$items = new ObjectStorage();
|
$items = new ObjectStorage();
|
||||||
$this->subject->setTestimonials($items);
|
$this->subject->setTestimonials($items);
|
||||||
|
|
||||||
|
@ -170,7 +183,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function removeTestimonialRemovesTestimonial() {
|
public function removeTestimonialRemovesTestimonial()
|
||||||
|
{
|
||||||
$items = new ObjectStorage();
|
$items = new ObjectStorage();
|
||||||
$this->subject->setTestimonials($items);
|
$this->subject->setTestimonials($items);
|
||||||
|
|
||||||
|
|
|
@ -19,20 +19,23 @@ 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()
|
||||||
|
@ -42,7 +45,8 @@ class TeaTypeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function setTitleSetsTitle() {
|
public function setTitleSetsTitle()
|
||||||
|
{
|
||||||
$this->subject->setTitle('foo bar');
|
$this->subject->setTitle('foo bar');
|
||||||
|
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
|
@ -54,7 +58,8 @@ class TeaTypeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function getCaffeinatedInitiallyReturnsFalse() {
|
public function getCaffeinatedInitiallyReturnsFalse()
|
||||||
|
{
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
false,
|
false,
|
||||||
$this->subject->getCaffeinated()
|
$this->subject->getCaffeinated()
|
||||||
|
@ -64,7 +69,8 @@ class TeaTypeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function setCaffeinatedSetsCaffeinated() {
|
public function setCaffeinatedSetsCaffeinated()
|
||||||
|
{
|
||||||
$this->subject->setCaffeinated(true);
|
$this->subject->setCaffeinated(true);
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
true,
|
true,
|
||||||
|
|
|
@ -19,20 +19,23 @@ 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(
|
self::assertNull(
|
||||||
$this->subject->getDateOfPosting()
|
$this->subject->getDateOfPosting()
|
||||||
);
|
);
|
||||||
|
@ -41,7 +44,8 @@ class TestimonialTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function setDateOfPostingSetsDateOfPosting() {
|
public function setDateOfPostingSetsDateOfPosting()
|
||||||
|
{
|
||||||
$date = new \DateTime();
|
$date = new \DateTime();
|
||||||
$this->subject->setDateOfPosting($date);
|
$this->subject->setDateOfPosting($date);
|
||||||
|
|
||||||
|
@ -54,7 +58,8 @@ class TestimonialTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function getNumberOfConsumedCupsInitiallyReturnsZero() {
|
public function getNumberOfConsumedCupsInitiallyReturnsZero()
|
||||||
|
{
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
0,
|
0,
|
||||||
$this->subject->getNumberOfConsumedCups()
|
$this->subject->getNumberOfConsumedCups()
|
||||||
|
@ -64,7 +69,8 @@ class TestimonialTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function setNumberOfConsumedCupsSetsNumberOfConsumedCups() {
|
public function setNumberOfConsumedCupsSetsNumberOfConsumedCups()
|
||||||
|
{
|
||||||
$this->subject->setNumberOfConsumedCups(123456);
|
$this->subject->setNumberOfConsumedCups(123456);
|
||||||
|
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
|
@ -76,7 +82,8 @@ class TestimonialTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function getTextInitiallyReturnsEmptyString() {
|
public function getTextInitiallyReturnsEmptyString()
|
||||||
|
{
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
'',
|
'',
|
||||||
$this->subject->getText()
|
$this->subject->getText()
|
||||||
|
@ -86,7 +93,8 @@ class TestimonialTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function setTextSetsText() {
|
public function setTextSetsText()
|
||||||
|
{
|
||||||
$this->subject->setText('foo bar');
|
$this->subject->setText('foo bar');
|
||||||
|
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
|
|
|
@ -22,7 +22,8 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -33,7 +34,8 @@ class TeaBeverageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
*/
|
*/
|
||||||
protected $objectManager = null;
|
protected $objectManager = null;
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp()
|
||||||
|
{
|
||||||
$this->objectManager = $this->getMock(ObjectManagerInterface::class);
|
$this->objectManager = $this->getMock(ObjectManagerInterface::class);
|
||||||
$this->subject = new TeaBeverageRepository($this->objectManager);
|
$this->subject = new TeaBeverageRepository($this->objectManager);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +43,8 @@ class TeaBeverageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function canBeInstantiated() {
|
public function canBeInstantiated()
|
||||||
|
{
|
||||||
self::assertNotNull(
|
self::assertNotNull(
|
||||||
$this->subject
|
$this->subject
|
||||||
);
|
);
|
||||||
|
|
|
@ -14,15 +14,16 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -33,7 +34,8 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
*/
|
*/
|
||||||
protected $objectManager = null;
|
protected $objectManager = null;
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp()
|
||||||
|
{
|
||||||
$this->objectManager = $this->getMock(ObjectManagerInterface::class);
|
$this->objectManager = $this->getMock(ObjectManagerInterface::class);
|
||||||
$this->subject = new TestimonialRepository($this->objectManager);
|
$this->subject = new TestimonialRepository($this->objectManager);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +43,8 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function canBeInstantiated() {
|
public function canBeInstantiated()
|
||||||
|
{
|
||||||
self::assertNotNull(
|
self::assertNotNull(
|
||||||
$this->subject
|
$this->subject
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,10 +18,10 @@ $GLOBALS['TCA']['tx_tea_domain_model_teabeverage'] = array(
|
||||||
'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',
|
||||||
|
@ -49,10 +49,10 @@ $GLOBALS['TCA']['tx_tea_domain_model_teatype'] = array(
|
||||||
'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',
|
||||||
|
@ -80,10 +80,10 @@ $GLOBALS['TCA']['tx_tea_domain_model_addition'] = array(
|
||||||
'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',
|
||||||
|
@ -111,10 +111,10 @@ $GLOBALS['TCA']['tx_tea_domain_model_testimonial'] = array(
|
||||||
'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',
|
||||||
|
|
Loading…
Reference in a new issue