mirror of
https://github.com/werkraum-media/events.git
synced 2024-11-22 18:36:09 +01:00
Setup unit testing
* Add dependency. * Remove empty tearDown() methods. * Fix signature of setUp() to be compatible with recent phpunit. * Temporary fix syntax issues in test files Relates: #8092
This commit is contained in:
parent
0c58be43ff
commit
cb50981a2b
9 changed files with 29 additions and 67 deletions
|
@ -14,7 +14,7 @@ class DateControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
protected $subject = null;
|
protected $subject = null;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->subject = $this->getMockBuilder(\Wrm\Events\Controller\DateController::class)
|
$this->subject = $this->getMockBuilder(\Wrm\Events\Controller\DateController::class)
|
||||||
|
@ -23,11 +23,6 @@ class DateControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
->getMock();
|
->getMock();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
@ -38,10 +33,10 @@ class DateControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$dateRepository = $this->getMockBuilder(\::class)
|
// $dateRepository = $this->getMockBuilder(\::class)
|
||||||
->setMethods(['findAll'])
|
// ->setMethods(['findAll'])
|
||||||
->disableOriginalConstructor()
|
// ->disableOriginalConstructor()
|
||||||
->getMock();
|
// ->getMock();
|
||||||
$dateRepository->expects(self::once())->method('findAll')->will(self::returnValue($allDates));
|
$dateRepository->expects(self::once())->method('findAll')->will(self::returnValue($allDates));
|
||||||
$this->inject($this->subject, 'dateRepository', $dateRepository);
|
$this->inject($this->subject, 'dateRepository', $dateRepository);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class EventControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
protected $subject = null;
|
protected $subject = null;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->subject = $this->getMockBuilder(\Wrm\Events\Controller\EventController::class)
|
$this->subject = $this->getMockBuilder(\Wrm\Events\Controller\EventController::class)
|
||||||
|
@ -23,11 +23,6 @@ class EventControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
->getMock();
|
->getMock();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
@ -38,10 +33,10 @@ class EventControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$eventRepository = $this->getMockBuilder(\::class)
|
// $eventRepository = $this->getMockBuilder(\::class)
|
||||||
->setMethods(['findAll'])
|
// ->setMethods(['findAll'])
|
||||||
->disableOriginalConstructor()
|
// ->disableOriginalConstructor()
|
||||||
->getMock();
|
// ->getMock();
|
||||||
$eventRepository->expects(self::once())->method('findAll')->will(self::returnValue($allEvents));
|
$eventRepository->expects(self::once())->method('findAll')->will(self::returnValue($allEvents));
|
||||||
$this->inject($this->subject, 'eventRepository', $eventRepository);
|
$this->inject($this->subject, 'eventRepository', $eventRepository);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class EventsControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
|
||||||
*/
|
*/
|
||||||
protected $subject = null;
|
protected $subject = null;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->subject = $this->getMockBuilder(\Wrm\Events\Controller\EventsController::class)
|
$this->subject = $this->getMockBuilder(\Wrm\Events\Controller\EventsController::class)
|
||||||
|
@ -23,11 +23,6 @@ class EventsControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
|
||||||
->getMock();
|
->getMock();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
@ -38,10 +33,10 @@ class EventsControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$eventsRepository = $this->getMockBuilder(\::class)
|
// $eventsRepository = $this->getMockBuilder(\::class)
|
||||||
->setMethods(['findAll'])
|
// ->setMethods(['findAll'])
|
||||||
->disableOriginalConstructor()
|
// ->disableOriginalConstructor()
|
||||||
->getMock();
|
// ->getMock();
|
||||||
$eventsRepository->expects(self::once())->method('findAll')->will(self::returnValue($allEventss));
|
$eventsRepository->expects(self::once())->method('findAll')->will(self::returnValue($allEventss));
|
||||||
$this->inject($this->subject, 'eventsRepository', $eventsRepository);
|
$this->inject($this->subject, 'eventsRepository', $eventsRepository);
|
||||||
|
|
||||||
|
|
|
@ -14,17 +14,12 @@ class DateTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
protected $subject = null;
|
protected $subject = null;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->subject = new \Wrm\Events\Domain\Model\Date();
|
$this->subject = new \Wrm\Events\Domain\Model\Date();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,17 +14,12 @@ class EventTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
protected $subject = null;
|
protected $subject = null;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->subject = new \Wrm\Events\Domain\Model\Event();
|
$this->subject = new \Wrm\Events\Domain\Model\Event();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,17 +14,12 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
protected $subject = null;
|
protected $subject = null;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->subject = new \Wrm\Events\Domain\Model\Events();
|
$this->subject = new \Wrm\Events\Domain\Model\Events();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
@ -507,7 +502,7 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
public function setDateForObjectStorageContainingSetsDate()
|
public function setDateForObjectStorageContainingSetsDate()
|
||||||
{
|
{
|
||||||
$date = new ();
|
// $date = new ();
|
||||||
$objectStorageHoldingExactlyOneDate = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
|
$objectStorageHoldingExactlyOneDate = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
|
||||||
$objectStorageHoldingExactlyOneDate->attach($date);
|
$objectStorageHoldingExactlyOneDate->attach($date);
|
||||||
$this->subject->setDate($objectStorageHoldingExactlyOneDate);
|
$this->subject->setDate($objectStorageHoldingExactlyOneDate);
|
||||||
|
@ -524,7 +519,7 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
public function addDateToObjectStorageHoldingDate()
|
public function addDateToObjectStorageHoldingDate()
|
||||||
{
|
{
|
||||||
$date = new ();
|
// $date = new ();
|
||||||
$dateObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
|
$dateObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
|
||||||
->setMethods(['attach'])
|
->setMethods(['attach'])
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
@ -541,7 +536,7 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
public function removeDateFromObjectStorageHoldingDate()
|
public function removeDateFromObjectStorageHoldingDate()
|
||||||
{
|
{
|
||||||
$date = new ();
|
// $date = new ();
|
||||||
$dateObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
|
$dateObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
|
||||||
->setMethods(['detach'])
|
->setMethods(['detach'])
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
@ -570,7 +565,7 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
public function setRegionForObjectStorageContainingSetsRegion()
|
public function setRegionForObjectStorageContainingSetsRegion()
|
||||||
{
|
{
|
||||||
$region = new ();
|
// $region = new ();
|
||||||
$objectStorageHoldingExactlyOneRegion = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
|
$objectStorageHoldingExactlyOneRegion = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
|
||||||
$objectStorageHoldingExactlyOneRegion->attach($region);
|
$objectStorageHoldingExactlyOneRegion->attach($region);
|
||||||
$this->subject->setRegion($objectStorageHoldingExactlyOneRegion);
|
$this->subject->setRegion($objectStorageHoldingExactlyOneRegion);
|
||||||
|
@ -587,7 +582,7 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
public function addRegionToObjectStorageHoldingRegion()
|
public function addRegionToObjectStorageHoldingRegion()
|
||||||
{
|
{
|
||||||
$region = new ();
|
// $region = new ();
|
||||||
$regionObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
|
$regionObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
|
||||||
->setMethods(['attach'])
|
->setMethods(['attach'])
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
@ -604,7 +599,7 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
public function removeRegionFromObjectStorageHoldingRegion()
|
public function removeRegionFromObjectStorageHoldingRegion()
|
||||||
{
|
{
|
||||||
$region = new ();
|
// $region = new ();
|
||||||
$regionObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
|
$regionObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
|
||||||
->setMethods(['detach'])
|
->setMethods(['detach'])
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
|
|
@ -14,17 +14,12 @@ class OrganizerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
protected $subject = null;
|
protected $subject = null;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->subject = new \Wrm\Events\Domain\Model\Organizer();
|
$this->subject = new \Wrm\Events\Domain\Model\Organizer();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,17 +14,12 @@ class RegionTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
|
||||||
*/
|
*/
|
||||||
protected $subject = null;
|
protected $subject = null;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->subject = new \Wrm\Events\Domain\Model\Region();
|
$this->subject = new \Wrm\Events\Domain\Model\Region();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"squizlabs/php_codesniffer": "^3.5"
|
"squizlabs/php_codesniffer": "^3.5",
|
||||||
|
"phpunit/phpunit": "^9.0",
|
||||||
|
"typo3/testing-framework": "^6.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue