diff --git a/typo3/sysext/belog/Classes/Domain/Model/Constraint.php b/typo3/sysext/belog/Classes/Domain/Model/Constraint.php index bdea85f1744ca5551e318df767d9e25efb91896c..0385673df5b0beb40b461dea682ab1cdd211a39b 100644 --- a/typo3/sysext/belog/Classes/Domain/Model/Constraint.php +++ b/typo3/sysext/belog/Classes/Domain/Model/Constraint.php @@ -251,7 +251,7 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { * @param \DateTime $manualDateStart * @return void */ - public function setManualDateStart(\DateTime $manualDateStart) { + public function setManualDateStart(\DateTime $manualDateStart = NULL) { $this->manualDateStart = $manualDateStart; } @@ -270,7 +270,7 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { * @param \DateTime $manualDateStop * @return void */ - public function setManualDateStop(\DateTime $manualDateStop) { + public function setManualDateStop(\DateTime $manualDateStop = NULL) { $this->manualDateStop = $manualDateStop; } diff --git a/typo3/sysext/belog/Tests/Unit/Domain/Model/ConstraintTest.php b/typo3/sysext/belog/Tests/Unit/Domain/Model/ConstraintTest.php new file mode 100644 index 0000000000000000000000000000000000000000..07a6573c3a2c113879bb89da9c4750028d1ee742 --- /dev/null +++ b/typo3/sysext/belog/Tests/Unit/Domain/Model/ConstraintTest.php @@ -0,0 +1,84 @@ +<?php +namespace TYPO3\CMS\Belog\Tests\Unit\Domain\Model; + +/*************************************************************** + * Copyright notice + * + * (c) 2014 Steffen Müller <typo3@t3node.com> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * Testcase for \TYPO3\CMS\Belog\Domain\Model\Constraint + * + * @author Steffen Müller <typo3@t3node.com> + */ +class ConstraintTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { + + /** + * @var \TYPO3\CMS\Belog\Domain\Model\Constraint + */ + protected $subject = NULL; + + public function setUp() { + $this->subject = new \TYPO3\CMS\Belog\Domain\Model\Constraint(); + } + + public function tearDown() { + unset($this->subject); + } + + /** + * @test + */ + public function setManualDateStartForDateTimeSetsManualDateStart() { + $date = new \DateTime(); + $this->subject->setManualDateStart($date); + + $this->assertAttributeEquals($date, 'manualDateStart', $this->subject); + } + + /** + * @test + */ + public function setManualDateStartForNoArgumentSetsManualDateStart() { + $this->subject->setManualDateStart(); + + $this->assertAttributeEquals(NULL, 'manualDateStart', $this->subject); + } + + /** + * @test + */ + public function setManualDateStopForDateTimeSetsManualDateStop() { + $date = new \DateTime(); + $this->subject->setManualDateStop($date); + + $this->assertAttributeEquals($date, 'manualDateStop', $this->subject); + } + + /** + * @test + */ + public function setManualDateStopForNoArgumentSetsManualDateStop() { + $this->subject->setManualDateStop(); + + $this->assertAttributeEquals(NULL, 'manualDateStop', $this->subject); + } +}