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

[CLEANUP] Reformat the code as PSR-2

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

View file

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

View file

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

View file

@ -19,7 +19,8 @@ namespace OliverKlee\Tea\Domain\Model;
*
* @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
*/
@ -48,7 +49,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return TeaBeverage
*/
public function __construct() {
public function __construct()
{
$this->initializeStorageObjects();
}
@ -57,7 +59,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
protected function initializeStorageObjects() {
protected function initializeStorageObjects()
{
$this->additions = 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
*/
public function getSize() {
public function getSize()
{
return $this->size;
}
@ -74,14 +78,16 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function setSize($size) {
public function setSize($size)
{
$this->size = $size;
}
/**
* @return \OliverKlee\Tea\Domain\Model\TeaType $type
*/
public function getType() {
public function getType()
{
return $this->type;
}
@ -90,14 +96,16 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function setType(\OliverKlee\Tea\Domain\Model\TeaType $type) {
public function setType(\OliverKlee\Tea\Domain\Model\TeaType $type)
{
$this->type = $type;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Addition> $additions
*/
public function getAdditions() {
public function getAdditions()
{
return $this->additions;
}
@ -106,7 +114,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function setAdditions(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $additions) {
public function setAdditions(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $additions)
{
$this->additions = $additions;
}
@ -117,7 +126,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function addAddition(\OliverKlee\Tea\Domain\Model\Addition $addition) {
public function addAddition(\OliverKlee\Tea\Domain\Model\Addition $addition)
{
$this->additions->attach($addition);
}
@ -128,14 +138,16 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function removeAddition(\OliverKlee\Tea\Domain\Model\Addition $additionToRemove) {
public function removeAddition(\OliverKlee\Tea\Domain\Model\Addition $additionToRemove)
{
$this->additions->detach($additionToRemove);
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Testimonial> $testimonials
*/
public function getTestimonials() {
public function getTestimonials()
{
return $this->testimonials;
}
@ -144,7 +156,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function setTestimonials(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $testimonials) {
public function setTestimonials(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $testimonials)
{
$this->testimonials = $testimonials;
}
@ -155,7 +168,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function addTestimonial(\OliverKlee\Tea\Domain\Model\Testimonial $testimonial) {
public function addTestimonial(\OliverKlee\Tea\Domain\Model\Testimonial $testimonial)
{
$this->testimonials->attach($testimonial);
}
@ -166,7 +180,8 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function removeTestimonial(\OliverKlee\Tea\Domain\Model\Testimonial $testimonialToRemove) {
public function removeTestimonial(\OliverKlee\Tea\Domain\Model\Testimonial $testimonialToRemove)
{
$this->testimonials->detach($testimonialToRemove);
}
}

View file

@ -19,7 +19,8 @@ namespace OliverKlee\Tea\Domain\Model;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var string
* @validate NotEmpty
@ -34,7 +35,8 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* @return string $title
*/
public function getTitle() {
public function getTitle()
{
return $this->title;
}
@ -43,14 +45,16 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function setTitle($title) {
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return bool $caffeinated
*/
public function getCaffeinated() {
public function getCaffeinated()
{
return $this->caffeinated;
}
@ -59,14 +63,16 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function setCaffeinated($caffeinated) {
public function setCaffeinated($caffeinated)
{
$this->caffeinated = $caffeinated;
}
/**
* @return bool
*/
public function isCaffeinated() {
public function isCaffeinated()
{
return $this->getCaffeinated();
}
}

View file

@ -19,7 +19,8 @@ namespace OliverKlee\Tea\Domain\Model;
*
* @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
*/
@ -38,7 +39,8 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* @return \DateTime $dateOfPosting
*/
public function getDateOfPosting() {
public function getDateOfPosting()
{
return $this->dateOfPosting;
}
@ -47,14 +49,16 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function setDateOfPosting($dateOfPosting) {
public function setDateOfPosting($dateOfPosting)
{
$this->dateOfPosting = $dateOfPosting;
}
/**
* @return int $numberOfConsumedCups
*/
public function getNumberOfConsumedCups() {
public function getNumberOfConsumedCups()
{
return $this->numberOfConsumedCups;
}
@ -63,14 +67,16 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function setNumberOfConsumedCups($numberOfConsumedCups) {
public function setNumberOfConsumedCups($numberOfConsumedCups)
{
$this->numberOfConsumedCups = $numberOfConsumedCups;
}
/**
* @return string $text
*/
public function getText() {
public function getText()
{
return $this->text;
}
@ -79,7 +85,8 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*
* @return void
*/
public function setText($text) {
public function setText($text)
{
$this->text = $text;
}
}

View file

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

View file

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

View file

@ -19,7 +19,8 @@ namespace OliverKlee\Tea\Utility;
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
*/
class FileUtility {
class FileUtility
{
/**
* Concatenates the files given as $sourceFilePaths and writes their contents into $targetFilePath.
*
@ -30,7 +31,8 @@ class FileUtility {
*
* @throws \InvalidArgumentException
*/
public function concatenate($targetFilePath, array $sourceFilePaths) {
public function concatenate($targetFilePath, array $sourceFilePaths)
{
if ($targetFilePath === '') {
throw new \InvalidArgumentException('$targetFileName must not be empty.', 1445631384);
}

View file

@ -24,13 +24,15 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
*
* @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
*/
protected $subject = null;
protected function setUp() {
protected function setUp()
{
if (!$this->createDatabase()) {
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);
}
protected function tearDown() {
protected function tearDown()
{
$this->dropDatabase();
$this->switchToTypo3Database();
}
@ -51,7 +54,8 @@ class TeaBeverageRepositoryTest extends \Tx_Phpunit_Database_TestCase {
/**
* @test
*/
public function findAllForNoRecordsReturnsEmptyContainer() {
public function findAllForNoRecordsReturnsEmptyContainer()
{
$container = $this->subject->findAll();
self::assertSame(
@ -63,7 +67,8 @@ class TeaBeverageRepositoryTest extends \Tx_Phpunit_Database_TestCase {
/**
* @test
*/
public function findAllWithOneRecordFindsThisRecord() {
public function findAllWithOneRecordFindsThisRecord()
{
$this->importDataSet(__DIR__ . '/Fixtures/TeaBeverages.xml');
$container = $this->subject->findAll();
@ -83,7 +88,8 @@ class TeaBeverageRepositoryTest extends \Tx_Phpunit_Database_TestCase {
/**
* @test
*/
public function findByUidForExistingRecordReturnsModelWithData() {
public function findByUidForExistingRecordReturnsModelWithData()
{
$this->importDataSet(__DIR__ . '/Fixtures/TeaBeverages.xml');
/** @var TeaBeverage $model */

View file

@ -24,7 +24,8 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
*
* @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
*/
@ -35,7 +36,8 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
*/
protected $testingFramework = null;
protected function setUp() {
protected function setUp()
{
$this->testingFramework = new \Tx_Phpunit_Framework('tx_tea');
/** @var ObjectManager $objectManager */
@ -45,14 +47,16 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
$this->subject = $objectManager->get(TestimonialRepository::class);
}
protected function tearDown() {
protected function tearDown()
{
$this->testingFramework->cleanUp();
}
/**
* @test
*/
public function findAllForNoRecordsReturnsEmptyContainer() {
public function findAllForNoRecordsReturnsEmptyContainer()
{
$container = $this->subject->findAll();
self::assertSame(
@ -64,7 +68,8 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function findAllWithOneRecordFindsThisRecord() {
public function findAllWithOneRecordFindsThisRecord()
{
$uid = $this->testingFramework->createRecord('tx_tea_domain_model_testimonial');
$container = $this->subject->findAll();
@ -84,7 +89,8 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function findByUidForExistingRecordReturnsModelWithData() {
public function findByUidForExistingRecordReturnsModelWithData()
{
$text = 'A very good Early Grey!';
$uid = $this->testingFramework->createRecord(
'tx_tea_domain_model_testimonial', array('text' => $text)

View file

@ -22,7 +22,8 @@ use org\bovigo\vfs\vfsStreamDirectory;
*
* @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
*/
@ -41,7 +42,8 @@ class FileUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
*/
protected $targetFilePath = '';
protected function setUp() {
protected function setUp()
{
$this->root = vfsStream::setup('home');
$this->targetFilePath = vfsStream::url('home/target.txt');
@ -52,14 +54,16 @@ class FileUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
* @test
* @expectedException \InvalidArgumentException
*/
public function concatenateWithEmptyTargetFileNameThrowsException() {
public function concatenateWithEmptyTargetFileNameThrowsException()
{
$this->subject->concatenate('', array('foo.txt'));
}
/**
* @test
*/
public function concatenateWithNoSourceFilesCreatesEmptyTargetFile() {
public function concatenateWithNoSourceFilesCreatesEmptyTargetFile()
{
$this->subject->concatenate($this->targetFilePath, array());
self::assertSame(
@ -71,7 +75,8 @@ class FileUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function concatenateWithOneEmptySourceFileCreatesEmptyTargetFile() {
public function concatenateWithOneEmptySourceFileCreatesEmptyTargetFile()
{
// This is one way to create a file with contents, using PHP's file functions.
$sourceFileName = vfsStream::url('home/source.txt');
// 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
*/
public function concatenateWithOneFileCopiesContentsFromSourceFileToTargetFile() {
public function concatenateWithOneFileCopiesContentsFromSourceFileToTargetFile()
{
// This is vfsStream's way of creating a file with contents.
$contents = 'Hello world!';
$sourceFileName = vfsStream::url('home/source.txt');
@ -105,7 +111,8 @@ class FileUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function concatenateWithTwoFileCopiesContentsFromBothFilesInOrderToTargetFile() {
public function concatenateWithTwoFileCopiesContentsFromBothFilesInOrderToTargetFile()
{
$contents1 = 'Hello ';
$sourceFileName1 = vfsStream::url('home/source1.txt');
file_put_contents($sourceFileName1, $contents1);

View file

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

View file

@ -19,20 +19,23 @@ namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
*
* @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
*/
protected $subject = null;
protected function setUp() {
protected function setUp()
{
$this->subject = new \OliverKlee\Tea\Domain\Model\Addition();
}
/**
* @test
*/
public function getTitleInitiallyReturnsEmptyString() {
public function getTitleInitiallyReturnsEmptyString()
{
self::assertSame(
'',
$this->subject->getTitle()
@ -42,7 +45,8 @@ class AdditionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function setTitleSetsTitle() {
public function setTitleSetsTitle()
{
$this->subject->setTitle('foo bar');
self::assertSame(

View file

@ -21,20 +21,23 @@ use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
*
* @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
*/
protected $subject = null;
protected function setUp() {
protected function setUp()
{
$this->subject = new \OliverKlee\Tea\Domain\Model\TeaBeverage();
}
/**
* @test
*/
public function getSizeInitiallyReturnsZero() {
public function getSizeInitiallyReturnsZero()
{
self::assertSame(
0.0,
$this->subject->getSize()
@ -44,7 +47,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function setSizeSetsSize() {
public function setSizeSetsSize()
{
$this->subject->setSize(1234.56);
self::assertSame(
@ -56,7 +60,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function getTypeInitiallyReturnsNull() {
public function getTypeInitiallyReturnsNull()
{
self::assertNull(
$this->subject->getType()
);
@ -65,7 +70,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function setTypeSetsType() {
public function setTypeSetsType()
{
$type = new \OliverKlee\Tea\Domain\Model\TeaType();
$this->subject->setType($type);
@ -78,7 +84,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function getAdditionsInitiallyReturnsEmptyStorage() {
public function getAdditionsInitiallyReturnsEmptyStorage()
{
self::assertEquals(
new ObjectStorage(),
$this->subject->getAdditions()
@ -88,7 +95,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function setAdditionsSetsAdditions() {
public function setAdditionsSetsAdditions()
{
$items = new ObjectStorage();
$this->subject->setAdditions($items);
@ -101,7 +109,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function addAdditionAddsAddition() {
public function addAdditionAddsAddition()
{
$items = new ObjectStorage();
$this->subject->setAdditions($items);
@ -116,7 +125,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function removeAdditionRemovesAddition() {
public function removeAdditionRemovesAddition()
{
$items = new ObjectStorage();
$this->subject->setAdditions($items);
@ -132,7 +142,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function getTestimonialsInitiallyReturnsEmptyStorage() {
public function getTestimonialsInitiallyReturnsEmptyStorage()
{
self::assertEquals(
new ObjectStorage(),
$this->subject->getTestimonials()
@ -142,7 +153,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function setTestimonialsSetsTestimonials() {
public function setTestimonialsSetsTestimonials()
{
$items = new ObjectStorage();
$this->subject->setTestimonials($items);
@ -155,7 +167,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function addTestimonialAddsTestimonial() {
public function addTestimonialAddsTestimonial()
{
$items = new ObjectStorage();
$this->subject->setTestimonials($items);
@ -170,7 +183,8 @@ class TeaBeverageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function removeTestimonialRemovesTestimonial() {
public function removeTestimonialRemovesTestimonial()
{
$items = new ObjectStorage();
$this->subject->setTestimonials($items);

View file

@ -19,20 +19,23 @@ namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
*
* @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
*/
protected $subject = null;
protected function setUp() {
protected function setUp()
{
$this->subject = new \OliverKlee\Tea\Domain\Model\TeaType();
}
/**
* @test
*/
public function getTitleInitiallyReturnsEmptyString() {
public function getTitleInitiallyReturnsEmptyString()
{
self::assertSame(
'',
$this->subject->getTitle()
@ -42,7 +45,8 @@ class TeaTypeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function setTitleSetsTitle() {
public function setTitleSetsTitle()
{
$this->subject->setTitle('foo bar');
self::assertSame(
@ -54,7 +58,8 @@ class TeaTypeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function getCaffeinatedInitiallyReturnsFalse() {
public function getCaffeinatedInitiallyReturnsFalse()
{
self::assertSame(
false,
$this->subject->getCaffeinated()
@ -64,7 +69,8 @@ class TeaTypeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function setCaffeinatedSetsCaffeinated() {
public function setCaffeinatedSetsCaffeinated()
{
$this->subject->setCaffeinated(true);
self::assertSame(
true,

View file

@ -19,20 +19,23 @@ namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
*
* @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
*/
protected $subject = null;
protected function setUp() {
protected function setUp()
{
$this->subject = new \OliverKlee\Tea\Domain\Model\Testimonial();
}
/**
* @test
*/
public function getDateOfPostingInitiallyReturnsNull() {
public function getDateOfPostingInitiallyReturnsNull()
{
self::assertNull(
$this->subject->getDateOfPosting()
);
@ -41,7 +44,8 @@ class TestimonialTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function setDateOfPostingSetsDateOfPosting() {
public function setDateOfPostingSetsDateOfPosting()
{
$date = new \DateTime();
$this->subject->setDateOfPosting($date);
@ -54,7 +58,8 @@ class TestimonialTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function getNumberOfConsumedCupsInitiallyReturnsZero() {
public function getNumberOfConsumedCupsInitiallyReturnsZero()
{
self::assertSame(
0,
$this->subject->getNumberOfConsumedCups()
@ -64,7 +69,8 @@ class TestimonialTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function setNumberOfConsumedCupsSetsNumberOfConsumedCups() {
public function setNumberOfConsumedCupsSetsNumberOfConsumedCups()
{
$this->subject->setNumberOfConsumedCups(123456);
self::assertSame(
@ -76,7 +82,8 @@ class TestimonialTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function getTextInitiallyReturnsEmptyString() {
public function getTextInitiallyReturnsEmptyString()
{
self::assertSame(
'',
$this->subject->getText()
@ -86,7 +93,8 @@ class TestimonialTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function setTextSetsText() {
public function setTextSetsText()
{
$this->subject->setText('foo bar');
self::assertSame(

View file

@ -22,7 +22,8 @@ use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
*
* @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
*/
@ -33,7 +34,8 @@ class TeaBeverageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
*/
protected $objectManager = null;
protected function setUp() {
protected function setUp()
{
$this->objectManager = $this->getMock(ObjectManagerInterface::class);
$this->subject = new TeaBeverageRepository($this->objectManager);
}
@ -41,7 +43,8 @@ class TeaBeverageRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function canBeInstantiated() {
public function canBeInstantiated()
{
self::assertNotNull(
$this->subject
);

View file

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

View file

@ -18,10 +18,10 @@ $GLOBALS['TCA']['tx_tea_domain_model_teabeverage'] = array(
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'dividers2tabs' => true,
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'versioning_followPages' => true,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
@ -49,10 +49,10 @@ $GLOBALS['TCA']['tx_tea_domain_model_teatype'] = array(
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'dividers2tabs' => true,
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'versioning_followPages' => true,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
@ -80,10 +80,10 @@ $GLOBALS['TCA']['tx_tea_domain_model_addition'] = array(
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'dividers2tabs' => true,
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'versioning_followPages' => true,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
@ -111,10 +111,10 @@ $GLOBALS['TCA']['tx_tea_domain_model_testimonial'] = array(
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'dividers2tabs' => true,
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'versioning_followPages' => true,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',