Upgrade tests to PhpUnit 10 (#5252)

This commit is contained in:
Kevin Papst
2024-12-22 01:25:30 +01:00
committed by GitHub
parent 9bd37fb695
commit c7f0508707
377 changed files with 3308 additions and 3409 deletions

View File

@@ -10,13 +10,13 @@
namespace App\Tests\Controller\Reporting;
use App\Entity\User;
use App\Tests\Controller\ControllerBaseTest;
use App\Tests\Controller\AbstractControllerBaseTestCase;
use App\Tests\DataFixtures\TimesheetFixtures;
/**
* @group integration
*/
abstract class AbstractUserPeriodControllerTest extends ControllerBaseTest
abstract class AbstractUserPeriodControllerTestCase extends AbstractControllerBaseTestCase
{
protected function importReportingFixture(string $role): void
{
@@ -37,7 +37,7 @@ abstract class AbstractUserPeriodControllerTest extends ControllerBaseTest
$this->assertUrlIsSecured($this->getReportUrl());
}
public function getTestData(): array
public static function getTestData(): array
{
return [
[4, 'duration', 'Working hours total'],

View File

@@ -10,16 +10,16 @@
namespace App\Tests\Controller\Reporting;
use App\Entity\User;
use App\Tests\Controller\ControllerBaseTest;
use App\Tests\Controller\AbstractControllerBaseTestCase;
use App\Tests\DataFixtures\TimesheetFixtures;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
/**
* @group integration
*/
abstract class AbstractUsersPeriodControllerTest extends ControllerBaseTest
abstract class AbstractUsersPeriodControllerTestCase extends AbstractControllerBaseTestCase
{
protected function importReportingFixture(string $role)
protected function importReportingFixture(string $role): void
{
$fixture = new TimesheetFixtures();
$fixture->setAmount(50);
@@ -40,7 +40,7 @@ abstract class AbstractUsersPeriodControllerTest extends ControllerBaseTest
$this->assertUrlIsSecured($this->getReportUrl());
}
public function getTestData(): array
public static function getTestData(): array
{
return [
['duration', 'Working hours total'],
@@ -86,7 +86,7 @@ abstract class AbstractUsersPeriodControllerTest extends ControllerBaseTest
$this->importReportingFixture(User::ROLE_SUPER_ADMIN);
$this->request($client, \sprintf('%s?date=12999119191&sumType=%s', $this->getReportExportUrl(), $dataType));
$response = $client->getResponse();
$this->assertTrue($response->isSuccessful());
self::assertTrue($response->isSuccessful());
self::assertInstanceOf(BinaryFileResponse::class, $response);
self::assertEquals('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', $response->headers->get('Content-Type'));
self::assertStringContainsString('attachment; filename=kimai-export-users-', $response->headers->get('Content-Disposition'));

View File

@@ -11,7 +11,7 @@ namespace App\Tests\Controller\Reporting;
use App\Entity\Project;
use App\Entity\User;
use App\Tests\Controller\ControllerBaseTest;
use App\Tests\Controller\AbstractControllerBaseTestCase;
use App\Tests\DataFixtures\ActivityFixtures;
use App\Tests\DataFixtures\CustomerFixtures;
use App\Tests\DataFixtures\ProjectFixtures;
@@ -22,7 +22,7 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser;
/**
* @group integration
*/
class CustomerMonthlyProjectsControllerTest extends ControllerBaseTest
class CustomerMonthlyProjectsControllerTest extends AbstractControllerBaseTestCase
{
public function testReportIsSecure(): void
{
@@ -90,14 +90,14 @@ class CustomerMonthlyProjectsControllerTest extends ControllerBaseTest
$this->assertAccessIsGranted($client, '/reporting/customer/monthly_projects/export');
$response = $client->getResponse();
$this->assertTrue($response->isSuccessful());
self::assertTrue($response->isSuccessful());
self::assertInstanceOf(BinaryFileResponse::class, $response);
// temporary file!
$file = $response->getFile();
self::assertFileDoesNotExist($response->getFile());
$this->assertEquals('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', $response->headers->get('Content-Type'));
$this->assertStringContainsString('attachment; filename=kimai-export-users-', $response->headers->get('Content-Disposition'));
self::assertEquals('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', $response->headers->get('Content-Type'));
self::assertStringContainsString('attachment; filename=kimai-export-users-', $response->headers->get('Content-Disposition'));
}
}

View File

@@ -11,7 +11,7 @@ namespace App\Tests\Controller\Reporting;
use App\Entity\Project;
use App\Entity\User;
use App\Tests\Controller\ControllerBaseTest;
use App\Tests\Controller\AbstractControllerBaseTestCase;
use App\Tests\DataFixtures\ActivityFixtures;
use App\Tests\DataFixtures\CustomerFixtures;
use App\Tests\DataFixtures\ProjectFixtures;
@@ -21,7 +21,7 @@ use App\Timesheet\DateTimeFactory;
/**
* @group integration
*/
class ProjectDateRangeControllerTest extends ControllerBaseTest
class ProjectDateRangeControllerTest extends AbstractControllerBaseTestCase
{
public function testReportIsSecure(): void
{

View File

@@ -10,7 +10,7 @@
namespace App\Tests\Controller\Reporting;
use App\Entity\User;
use App\Tests\Controller\ControllerBaseTest;
use App\Tests\Controller\AbstractControllerBaseTestCase;
use App\Tests\DataFixtures\ActivityFixtures;
use App\Tests\DataFixtures\CustomerFixtures;
use App\Tests\DataFixtures\ProjectFixtures;
@@ -19,7 +19,7 @@ use App\Tests\DataFixtures\TimesheetFixtures;
/**
* @group integration
*/
class ProjectDetailsControllerTest extends ControllerBaseTest
class ProjectDetailsControllerTest extends AbstractControllerBaseTestCase
{
public function testReportIsSecure(): void
{

View File

@@ -10,7 +10,7 @@
namespace App\Tests\Controller\Reporting;
use App\Entity\User;
use App\Tests\Controller\ControllerBaseTest;
use App\Tests\Controller\AbstractControllerBaseTestCase;
use App\Tests\DataFixtures\ActivityFixtures;
use App\Tests\DataFixtures\CustomerFixtures;
use App\Tests\DataFixtures\ProjectFixtures;
@@ -19,7 +19,7 @@ use App\Tests\DataFixtures\TimesheetFixtures;
/**
* @group integration
*/
class ProjectInactiveControllerTest extends ControllerBaseTest
class ProjectInactiveControllerTest extends AbstractControllerBaseTestCase
{
public function testReportIsSecure(): void
{

View File

@@ -10,7 +10,7 @@
namespace App\Tests\Controller\Reporting;
use App\Entity\User;
use App\Tests\Controller\ControllerBaseTest;
use App\Tests\Controller\AbstractControllerBaseTestCase;
use App\Tests\DataFixtures\ActivityFixtures;
use App\Tests\DataFixtures\CustomerFixtures;
use App\Tests\DataFixtures\ProjectFixtures;
@@ -20,7 +20,7 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse;
/**
* @group integration
*/
class ProjectViewControllerTest extends ControllerBaseTest
class ProjectViewControllerTest extends AbstractControllerBaseTestCase
{
public function testReportIsSecure(): void
{
@@ -87,7 +87,7 @@ class ProjectViewControllerTest extends ControllerBaseTest
$this->assertAccessIsGranted($client, '/reporting/project_view/export');
$response = $client->getResponse();
$this->assertTrue($response->isSuccessful());
self::assertTrue($response->isSuccessful());
self::assertInstanceOf(BinaryFileResponse::class, $response);
self::assertNotNull($response->headers->get('Content-Type'));
self::assertEquals('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', $response->headers->get('Content-Type'));

View File

@@ -12,7 +12,7 @@ namespace App\Tests\Controller\Reporting;
/**
* @group integration
*/
class ReportUsersMonthControllerTest extends AbstractUsersPeriodControllerTest
class ReportUsersMonthControllerTest extends AbstractUsersPeriodControllerTestCase
{
protected function getReportUrl(): string
{

View File

@@ -12,7 +12,7 @@ namespace App\Tests\Controller\Reporting;
/**
* @group integration
*/
class ReportUsersWeekControllerTest extends AbstractUsersPeriodControllerTest
class ReportUsersWeekControllerTest extends AbstractUsersPeriodControllerTestCase
{
protected function getReportUrl(): string
{

View File

@@ -12,7 +12,7 @@ namespace App\Tests\Controller\Reporting;
/**
* @group integration
*/
class ReportUsersYearControllerTest extends AbstractUsersPeriodControllerTest
class ReportUsersYearControllerTest extends AbstractUsersPeriodControllerTestCase
{
protected function getReportUrl(): string
{

View File

@@ -12,7 +12,7 @@ namespace App\Tests\Controller\Reporting;
/**
* @group integration
*/
class UserMonthControllerTest extends AbstractUserPeriodControllerTest
class UserMonthControllerTest extends AbstractUserPeriodControllerTestCase
{
protected function getReportUrl(): string
{

View File

@@ -12,7 +12,7 @@ namespace App\Tests\Controller\Reporting;
/**
* @group integration
*/
class UserWeekControllerTest extends AbstractUserPeriodControllerTest
class UserWeekControllerTest extends AbstractUserPeriodControllerTestCase
{
protected function getReportUrl(): string
{

View File

@@ -12,7 +12,7 @@ namespace App\Tests\Controller\Reporting;
/**
* @group integration
*/
class UserYearControllerTest extends AbstractUserPeriodControllerTest
class UserYearControllerTest extends AbstractUserPeriodControllerTestCase
{
protected function getReportUrl(): string
{