Skip to content

Commit

Permalink
upgrade phpunit
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Eichhorn committed Mar 20, 2024
1 parent b345505 commit 40a5ad1
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 307 deletions.
43 changes: 10 additions & 33 deletions tests/Controller/ApiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
/**
* @internal
*/
final class ControllerTest extends \PHPUnit\Framework\TestCase
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tasks\Controller\ApiController::class)]
final class ApiControllerTest extends \PHPUnit\Framework\TestCase
{
protected $app = null;

Expand Down Expand Up @@ -86,10 +87,7 @@ protected function setUp() : void
TestUtils::setMember($this->module, 'app', $this->app);
}

/**
* @covers \Modules\Tasks\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCreateTask() : void
{
$response = new HttpResponse();
Expand Down Expand Up @@ -123,10 +121,7 @@ public function testCreateTask() : void
self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
}

/**
* @covers \Modules\Tasks\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiTaskGet() : void
{
$response = new HttpResponse();
Expand All @@ -140,10 +135,7 @@ public function testApiTaskGet() : void
self::assertEquals(1, $response->getDataArray('')['response']->id);
}

/**
* @covers \Modules\Tasks\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiTaskSet() : void
{
$response = new HttpResponse();
Expand All @@ -160,10 +152,7 @@ public function testApiTaskSet() : void
self::assertEquals('New Title', $response->getDataArray('')['response']->title);
}

/**
* @covers \Modules\Tasks\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCreateTaskElement() : void
{
$response = new HttpResponse();
Expand Down Expand Up @@ -198,10 +187,7 @@ public function testCreateTaskElement() : void
self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
}

/**
* @covers \Modules\Tasks\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiTaskElementGet() : void
{
$response = new HttpResponse();
Expand All @@ -215,10 +201,7 @@ public function testApiTaskElementGet() : void
self::assertEquals(1, $response->getDataArray('')['response']->id);
}

/**
* @covers \Modules\Tasks\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testApiTaskElementSet() : void
{
$response = new HttpResponse();
Expand All @@ -234,10 +217,7 @@ public function testApiTaskElementSet() : void
self::assertEquals('This is a changed description', $response->getDataArray('')['response']->descriptionRaw);
}

/**
* @covers \Modules\Tasks\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testInvalidTaskCreate() : void
{
$response = new HttpResponse();
Expand All @@ -251,10 +231,7 @@ public function testInvalidTaskCreate() : void
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
}

/**
* @covers \Modules\Tasks\Controller\ApiController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testInvalidTaskElementCreate() : void
{
$response = new HttpResponse();
Expand Down
6 changes: 2 additions & 4 deletions tests/Controller/BackendControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tasks\Controller\BackendController::class)]
final class BackendControllerTest extends \PHPUnit\Framework\TestCase
{
protected $app = null;
Expand Down Expand Up @@ -78,10 +79,7 @@ protected function setUp() : void
TestUtils::setMember($this->module, 'app', $this->app);
}

/**
* @covers \Modules\Tasks\Controller\BackendController
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNavigation() : void
{
self::assertEquals(0, $this->module->openNav(999));
Expand Down
11 changes: 3 additions & 8 deletions tests/Models/AccountRelationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tasks\Models\AccountRelation::class)]
final class AccountRelationTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Tasks\Models\AccountRelation
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
$obj = new AccountRelation();
Expand All @@ -35,10 +33,7 @@ public function testDefault() : void
self::assertEquals(DutyType::TO, $obj->getDuty());
}

/**
* @covers \Modules\Tasks\Models\AccountRelation
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSetGet() : void
{
$obj = new AccountRelation($a = new NullAccount(1), DutyType::CC);
Expand Down
11 changes: 3 additions & 8 deletions tests/Models/GroupRelationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tasks\Models\GroupRelation::class)]
final class GroupRelationTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Tasks\Models\GroupRelation
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
$obj = new GroupRelation();
Expand All @@ -35,10 +33,7 @@ public function testDefault() : void
self::assertEquals(DutyType::TO, $obj->getDuty());
}

/**
* @covers \Modules\Tasks\Models\GroupRelation
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSetGet() : void
{
$obj = new GroupRelation($g = new NullGroup(1), DutyType::CC);
Expand Down
16 changes: 4 additions & 12 deletions tests/Models/NullAccountRelationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,23 @@
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tasks\Models\NullAccountRelation::class)]
final class NullAccountRelationTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Tasks\Models\NullAccountRelation
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\Tasks\Models\AccountRelation', new NullAccountRelation());
}

/**
* @covers \Modules\Tasks\Models\NullAccountRelation
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullAccountRelation(2);
self::assertEquals(2, $null->id);
}

/**
* @covers \Modules\Tasks\Models\NullAccountRelation
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullAccountRelation(2);
Expand Down
16 changes: 4 additions & 12 deletions tests/Models/NullGroupRelationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,23 @@
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tasks\Models\NullGroupRelation::class)]
final class NullGroupRelationTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Tasks\Models\NullGroupRelation
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\Tasks\Models\GroupRelation', new NullGroupRelation());
}

/**
* @covers \Modules\Tasks\Models\NullGroupRelation
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullGroupRelation(2);
self::assertEquals(2, $null->id);
}

/**
* @covers \Modules\Tasks\Models\NullGroupRelation
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullGroupRelation(2);
Expand Down
16 changes: 4 additions & 12 deletions tests/Models/NullTaskElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,23 @@
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tasks\Models\NullTaskElement::class)]
final class NullTaskElementTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Tasks\Models\NullTaskElement
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\Tasks\Models\TaskElement', new NullTaskElement());
}

/**
* @covers \Modules\Tasks\Models\NullTaskElement
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullTaskElement(2);
self::assertEquals(2, $null->id);
}

/**
* @covers \Modules\Tasks\Models\NullTaskElement
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullTaskElement(2);
Expand Down
16 changes: 4 additions & 12 deletions tests/Models/NullTaskSeenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,23 @@
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tasks\Models\NullTaskSeen::class)]
final class NullTaskSeenTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Tasks\Models\NullTaskSeen
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\Tasks\Models\TaskSeen', new NullTaskSeen());
}

/**
* @covers \Modules\Tasks\Models\NullTaskSeen
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullTaskSeen(2);
self::assertEquals(2, $null->id);
}

/**
* @covers \Modules\Tasks\Models\NullTaskSeen
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullTaskSeen(2);
Expand Down
16 changes: 4 additions & 12 deletions tests/Models/NullTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,23 @@
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tasks\Models\NullTask::class)]
final class NullTaskTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \Modules\Tasks\Models\NullTask
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testNull() : void
{
self::assertInstanceOf('\Modules\Tasks\Models\Task', new NullTask());
}

/**
* @covers \Modules\Tasks\Models\NullTask
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testId() : void
{
$null = new NullTask(2);
self::assertEquals(2, $null->id);
}

/**
* @covers \Modules\Tasks\Models\NullTask
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testJsonSerialize() : void
{
$null = new NullTask(2);
Expand Down
11 changes: 3 additions & 8 deletions tests/Models/RelationAbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Tasks\Models\RelationAbstract::class)]
final class RelationAbstractTest extends \PHPUnit\Framework\TestCase
{
private RelationAbstract $rel;
Expand All @@ -37,20 +38,14 @@ public function jsonSerialize() : mixed { return []; }
};
}

/**
* @covers \Modules\Tasks\Models\RelationAbstract
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->rel->id);
self::assertEquals(DutyType::TO, $this->rel->getDuty());
}

/**
* @covers \Modules\Tasks\Models\RelationAbstract
* @group module
*/
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDutyInputOutput() : void
{
$this->rel->setDuty(DutyType::CC);
Expand Down
Loading

0 comments on commit 40a5ad1

Please sign in to comment.