From d934fe3be0cb71097b405a7ce8346508df25f442 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 20 Mar 2024 05:15:59 +0000 Subject: [PATCH] upgrade phpunit --- tests/Models/CalendarMapperTest.php | 6 ++-- tests/Models/CalendarTest.php | 46 ++++++------------------ tests/Models/EventMapperTest.php | 6 ++-- tests/Models/EventTest.php | 41 +++++---------------- tests/Models/NullCalendarTest.php | 16 +++------ tests/Models/NullEventTest.php | 16 +++------ tests/Models/NullScheduleTest.php | 16 +++------ tests/Models/ScheduleTest.php | 11 ++---- tests/phpunit_default.xml | 56 +++++++++++++++-------------- 9 files changed, 67 insertions(+), 147 deletions(-) diff --git a/tests/Models/CalendarMapperTest.php b/tests/Models/CalendarMapperTest.php index b0238c8..e9d8dcc 100755 --- a/tests/Models/CalendarMapperTest.php +++ b/tests/Models/CalendarMapperTest.php @@ -22,12 +22,10 @@ use Modules\Calendar\Models\Event; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Calendar\Models\CalendarMapper::class)] final class CalendarMapperTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Calendar\Models\CalendarMapper - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testCR() : void { $calendar = new Calendar(); diff --git a/tests/Models/CalendarTest.php b/tests/Models/CalendarTest.php index 6b55b6e..b12dd47 100755 --- a/tests/Models/CalendarTest.php +++ b/tests/Models/CalendarTest.php @@ -20,6 +20,7 @@ use Modules\Calendar\Models\Event; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Calendar\Models\Calendar::class)] final class CalendarTest extends \PHPUnit\Framework\TestCase { private Calendar $calendar; @@ -32,10 +33,7 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase $this->calendar = new Calendar(); } - /** - * @covers \Modules\Calendar\Models\Calendar - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->calendar->id); @@ -49,40 +47,28 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase self::assertEquals([], $this->calendar->getEventsOnDate(new \DateTime('now'))); } - /** - * @covers \Modules\Calendar\Models\Calendar - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDateInputOutput() : void { $this->calendar->date = new \DateTime('2000-05-05'); self::assertEquals('2000-05-05', $this->calendar->date->format('Y-m-d')); } - /** - * @covers \Modules\Calendar\Models\Calendar - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testTitleInputOutput() : void { $this->calendar->name = 'Title'; self::assertEquals('Title', $this->calendar->name); } - /** - * @covers \Modules\Calendar\Models\Calendar - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDescriptionInputOutput() : void { $this->calendar->description = 'Description'; self::assertEquals('Description', $this->calendar->description); } - /** - * @covers \Modules\Calendar\Models\Calendar - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testEventInputOutput() : void { $id = []; @@ -93,10 +79,7 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase self::assertInstanceOf('\Modules\Calendar\Models\Event', $this->calendar->getEvent(1)); } - /** - * @covers \Modules\Calendar\Models\Calendar - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testEventRemove() : void { $id = []; @@ -110,10 +93,7 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase self::assertTrue($success); } - /** - * @covers \Modules\Calendar\Models\Calendar - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testHasEventOnDate() : void { $event = new Event(); @@ -124,10 +104,7 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase self::assertTrue($this->calendar->hasEventOnDate(new \DateTime('2005-10-09'))); } - /** - * @covers \Modules\Calendar\Models\Calendar - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testGetEventsOnDate() : void { $event = new Event(); @@ -139,10 +116,7 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase self::assertEquals([$event], $this->calendar->getEventsOnDate(new \DateTime('2005-10-09'))); } - /** - * @covers \Modules\Calendar\Models\Calendar - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $this->calendar->name = 'Name'; diff --git a/tests/Models/EventMapperTest.php b/tests/Models/EventMapperTest.php index 16f308a..7b86db0 100755 --- a/tests/Models/EventMapperTest.php +++ b/tests/Models/EventMapperTest.php @@ -21,12 +21,10 @@ use Modules\Calendar\Models\EventMapper; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Calendar\Models\EventMapper::class)] final class EventMapperTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Calendar\Models\EventMapper - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testCRUD() : void { $calendarEvent1 = new Event(); diff --git a/tests/Models/EventTest.php b/tests/Models/EventTest.php index dd46a40..8eeeaf1 100755 --- a/tests/Models/EventTest.php +++ b/tests/Models/EventTest.php @@ -23,6 +23,7 @@ use Modules\Calendar\Models\EventType; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Calendar\Models\Event::class)] final class EventTest extends \PHPUnit\Framework\TestCase { private Event $event; @@ -35,10 +36,7 @@ final class EventTest extends \PHPUnit\Framework\TestCase $this->event = new Event(); } - /** - * @covers \Modules\Calendar\Models\Event - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->event->id); @@ -51,60 +49,42 @@ final class EventTest extends \PHPUnit\Framework\TestCase self::assertInstanceOf('\phpOMS\Stdlib\Base\Location', $this->event->location); } - /** - * @covers \Modules\Calendar\Models\Event - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testCreatedByInputOutput() : void { $this->event->setCreatedBy(new NullAccount(1)); self::assertEquals(1, $this->event->getCreatedBy()->id); } - /** - * @covers \Modules\Calendar\Models\Event - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testCalendarInputOutput() : void { $this->event->calendar = 99; self::assertEquals(99, $this->event->calendar); } - /** - * @covers \Modules\Calendar\Models\Event - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNameInputOutput() : void { $this->event->name = 'Name'; self::assertEquals('Name', $this->event->name); } - /** - * @covers \Modules\Calendar\Models\Event - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDescriptionInputOutput() : void { $this->event->description = 'Description'; self::assertEquals('Description', $this->event->description); } - /** - * @covers \Modules\Calendar\Models\Event - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testPersonInputOutput() : void { $this->event->addPerson(new Account()); self::assertCount(1, $this->event->getPeople()); } - /** - * @covers \Modules\Calendar\Models\Event - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testPersonRemove() : void { $this->event->addPerson(new Account()); @@ -117,10 +97,7 @@ final class EventTest extends \PHPUnit\Framework\TestCase self::assertTrue($success); } - /** - * @covers \Modules\Calendar\Models\Event - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $this->event->name = 'Name'; diff --git a/tests/Models/NullCalendarTest.php b/tests/Models/NullCalendarTest.php index 98550cd..f7a73ee 100755 --- a/tests/Models/NullCalendarTest.php +++ b/tests/Models/NullCalendarTest.php @@ -19,31 +19,23 @@ use Modules\Calendar\Models\NullCalendar; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Calendar\Models\NullCalendar::class)] final class NullCalendarTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Calendar\Models\NullCalendar - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\Calendar\Models\Calendar', new NullCalendar()); } - /** - * @covers \Modules\Calendar\Models\NullCalendar - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullCalendar(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\Calendar\Models\NullCalendar - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullCalendar(2); diff --git a/tests/Models/NullEventTest.php b/tests/Models/NullEventTest.php index 8b3040b..a9d41d5 100755 --- a/tests/Models/NullEventTest.php +++ b/tests/Models/NullEventTest.php @@ -19,31 +19,23 @@ use Modules\Calendar\Models\NullEvent; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Calendar\Models\NullEvent::class)] final class NullEventTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Calendar\Models\NullEvent - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\Calendar\Models\Event', new NullEvent()); } - /** - * @covers \Modules\Calendar\Models\NullEvent - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullEvent(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\Calendar\Models\NullEvent - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullEvent(2); diff --git a/tests/Models/NullScheduleTest.php b/tests/Models/NullScheduleTest.php index 69874f8..cf4b26a 100755 --- a/tests/Models/NullScheduleTest.php +++ b/tests/Models/NullScheduleTest.php @@ -19,31 +19,23 @@ use Modules\Calendar\Models\NullSchedule; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Calendar\Models\NullSchedule::class)] final class NullScheduleTest extends \PHPUnit\Framework\TestCase { - /** - * @covers \Modules\Calendar\Models\NullSchedule - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testNull() : void { self::assertInstanceOf('\Modules\Calendar\Models\Schedule', new NullSchedule()); } - /** - * @covers \Modules\Calendar\Models\NullSchedule - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testId() : void { $null = new NullSchedule(2); self::assertEquals(2, $null->id); } - /** - * @covers \Modules\Calendar\Models\NullSchedule - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testJsonSerialize() : void { $null = new NullSchedule(2); diff --git a/tests/Models/ScheduleTest.php b/tests/Models/ScheduleTest.php index 8cda7b4..737bfcc 100755 --- a/tests/Models/ScheduleTest.php +++ b/tests/Models/ScheduleTest.php @@ -22,6 +22,7 @@ use Modules\Calendar\Models\ScheduleStatus; /** * @internal */ +#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Calendar\Models\Schedule::class)] final class ScheduleTest extends \PHPUnit\Framework\TestCase { private Schedule $schedule; @@ -34,10 +35,7 @@ final class ScheduleTest extends \PHPUnit\Framework\TestCase $this->schedule = new Schedule(); } - /** - * @covers \Modules\Calendar\Models\Schedule - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->schedule->id); @@ -47,10 +45,7 @@ final class ScheduleTest extends \PHPUnit\Framework\TestCase self::assertInstanceOf('\Modules\Admin\Models\NullAccount', $this->schedule->createdBy); } - /** - * @covers \Modules\Calendar\Models\Schedule - * @group module - */ + #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $this->schedule->status = ScheduleStatus::INACTIVE; diff --git a/tests/phpunit_default.xml b/tests/phpunit_default.xml index d350430..e4a5639 100755 --- a/tests/phpunit_default.xml +++ b/tests/phpunit_default.xml @@ -1,31 +1,6 @@ - - - - ../ - - - ../vendor* - ../MainRepository* - ../Karaka* - ../Admin/Install/Application* - ../phpOMS* - ../tests* - ../*/tests* - ../**/tests* - */tests* - ../* - ../* - ../* - ../* - ../* - ../**/test* - ../**/Theme* - ../**/Admin/Routes* - ../**/Admin/Hooks* - ../**/Admin/Install* - ../Media/Files* - + + @@ -56,4 +31,31 @@ + + + ../ + + + ../vendor* + ../MainRepository* + ../Karaka* + ../Admin/Install/Application* + ../phpOMS* + ../tests* + ../*/tests* + ../**/tests* + */tests* + ../* + ../* + ../* + ../* + ../* + ../**/test* + ../**/Theme* + ../**/Admin/Routes* + ../**/Admin/Hooks* + ../**/Admin/Install* + ../Media/Files* + +