Upgrade tests to PhpUnit 10 (#5252)
This commit is contained in:
@@ -12,7 +12,7 @@ namespace App\Tests\Model;
|
||||
use App\Model\TimesheetCountedStatistic;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
abstract class AbstractTimesheetCountedStatisticTest extends TestCase
|
||||
abstract class AbstractTimesheetCountedStatisticTestCase extends TestCase
|
||||
{
|
||||
public function assertDefaultValues(TimesheetCountedStatistic $sut): void
|
||||
{
|
||||
@@ -34,7 +34,7 @@ abstract class AbstractTimesheetCountedStatisticTest extends TestCase
|
||||
self::assertSame(0, $sut->getCounterExported());
|
||||
|
||||
$json = $sut->jsonSerialize();
|
||||
$this->assertIsArray($json);
|
||||
self::assertIsArray($json);
|
||||
|
||||
$expected = [
|
||||
'duration' => 0,
|
||||
@@ -122,7 +122,7 @@ abstract class AbstractTimesheetCountedStatisticTest extends TestCase
|
||||
$sut->setInternalRateExported(27.15);
|
||||
|
||||
$json = $sut->jsonSerialize();
|
||||
$this->assertIsArray($json);
|
||||
self::assertIsArray($json);
|
||||
foreach (['duration', 'duration_billable', 'duration_exported', 'rate', 'rate_billable', 'rate_billable_exported', 'rate_exported', 'rate_internal', 'amount', 'amount_billable', 'amount_exported'] as $key) {
|
||||
self::assertArrayHasKey($key, $json);
|
||||
}
|
||||
@@ -15,7 +15,7 @@ use App\Model\ActivityStatistic;
|
||||
/**
|
||||
* @covers \App\Model\ActivityStatistic
|
||||
*/
|
||||
class ActivityStatisticTest extends AbstractTimesheetCountedStatisticTest
|
||||
class ActivityStatisticTest extends AbstractTimesheetCountedStatisticTestCase
|
||||
{
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
@@ -41,7 +41,7 @@ class ActivityStatisticTest extends AbstractTimesheetCountedStatisticTest
|
||||
|
||||
$activity = new Activity();
|
||||
$sut->setActivity($activity);
|
||||
$this->assertEquals($activity, $sut->getActivity());
|
||||
self::assertEquals($activity, $sut->getActivity());
|
||||
|
||||
self::assertNull($sut->getColor());
|
||||
self::assertNull($sut->getName());
|
||||
|
||||
@@ -14,7 +14,7 @@ use App\Model\CustomerStatistic;
|
||||
/**
|
||||
* @covers \App\Model\CustomerStatistic
|
||||
*/
|
||||
class CustomerStatisticTest extends AbstractTimesheetCountedStatisticTest
|
||||
class CustomerStatisticTest extends AbstractTimesheetCountedStatisticTestCase
|
||||
{
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ use App\Model\CustomerStatistic;
|
||||
/**
|
||||
* @covers \App\Model\ProjectStatistic
|
||||
*/
|
||||
class ProjectStatisticTest extends AbstractTimesheetCountedStatisticTest
|
||||
class ProjectStatisticTest extends AbstractTimesheetCountedStatisticTestCase
|
||||
{
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace App\Tests\Model\Statistic;
|
||||
use App\Model\Statistic\Timesheet;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
abstract class AbstractTimesheetTest extends TestCase
|
||||
abstract class AbstractTimesheetTestCase extends TestCase
|
||||
{
|
||||
public function assertDefaultValues(Timesheet $sut): void
|
||||
{
|
||||
@@ -10,12 +10,12 @@
|
||||
namespace App\Tests\Model\Statistic;
|
||||
|
||||
use App\Model\Statistic\BudgetStatistic;
|
||||
use App\Tests\Model\AbstractTimesheetCountedStatisticTest;
|
||||
use App\Tests\Model\AbstractTimesheetCountedStatisticTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Model\Statistic\BudgetStatistic
|
||||
*/
|
||||
class BudgetStatisticTest extends AbstractTimesheetCountedStatisticTest
|
||||
class BudgetStatisticTest extends AbstractTimesheetCountedStatisticTestCase
|
||||
{
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ use DateTime;
|
||||
/**
|
||||
* @covers \App\Model\Statistic\Day
|
||||
*/
|
||||
class DayTest extends AbstractTimesheetTest
|
||||
class DayTest extends AbstractTimesheetTestCase
|
||||
{
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ use InvalidArgumentException;
|
||||
/**
|
||||
* @covers \App\Model\Statistic\Month
|
||||
*/
|
||||
class MonthTest extends AbstractTimesheetTest
|
||||
class MonthTest extends AbstractTimesheetTestCase
|
||||
{
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
@@ -29,7 +29,7 @@ class MonthTest extends AbstractTimesheetTest
|
||||
self::assertSame(0.0, $sut->getBillableRate());
|
||||
}
|
||||
|
||||
public function getTestData()
|
||||
public static function getTestData()
|
||||
{
|
||||
yield ['01', '01', 1];
|
||||
yield ['02', '02', 2];
|
||||
@@ -67,7 +67,7 @@ class MonthTest extends AbstractTimesheetTest
|
||||
self::assertEquals($number, $sut->getMonthNumber());
|
||||
}
|
||||
|
||||
public function getInvalidTestData()
|
||||
public static function getInvalidTestData()
|
||||
{
|
||||
yield ['00'];
|
||||
yield ['13'];
|
||||
|
||||
@@ -15,7 +15,7 @@ use DateTime;
|
||||
/**
|
||||
* @covers \App\Model\Statistic\StatisticDate
|
||||
*/
|
||||
class StatisticDateTest extends AbstractTimesheetTest
|
||||
class StatisticDateTest extends AbstractTimesheetTestCase
|
||||
{
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ use App\Model\Statistic\Timesheet;
|
||||
/**
|
||||
* @covers \App\Model\Statistic\Timesheet
|
||||
*/
|
||||
class TimesheetTest extends AbstractTimesheetTest
|
||||
class TimesheetTest extends AbstractTimesheetTestCase
|
||||
{
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ use App\Model\TimesheetCountedStatistic;
|
||||
/**
|
||||
* @covers \App\Model\TimesheetCountedStatistic
|
||||
*/
|
||||
class TimesheetCountedStatisticTest extends AbstractTimesheetCountedStatisticTest
|
||||
class TimesheetCountedStatisticTest extends AbstractTimesheetCountedStatisticTestCase
|
||||
{
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
|
||||
@@ -20,11 +20,11 @@ class TimesheetStatisticTest extends TestCase
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
$sut = new TimesheetStatistic();
|
||||
$this->assertEquals(0, $sut->getRecordsTotal());
|
||||
$this->assertEquals(0, $sut->getAmountTotal());
|
||||
$this->assertEquals(0, $sut->getAmountThisMonth());
|
||||
$this->assertEquals(0, $sut->getDurationTotal());
|
||||
$this->assertEquals(0, $sut->getDurationThisMonth());
|
||||
self::assertEquals(0, $sut->getRecordsTotal());
|
||||
self::assertEquals(0, $sut->getAmountTotal());
|
||||
self::assertEquals(0, $sut->getAmountThisMonth());
|
||||
self::assertEquals(0, $sut->getDurationTotal());
|
||||
self::assertEquals(0, $sut->getDurationThisMonth());
|
||||
}
|
||||
|
||||
public function testSetter(): void
|
||||
@@ -36,10 +36,10 @@ class TimesheetStatisticTest extends TestCase
|
||||
$sut->setDurationTotal(13);
|
||||
$sut->setDurationThisMonth(200);
|
||||
|
||||
$this->assertEquals(2, $sut->getRecordsTotal());
|
||||
$this->assertEquals(7654.298, $sut->getAmountTotal());
|
||||
$this->assertEquals(826.10, $sut->getAmountThisMonth());
|
||||
$this->assertEquals(13, $sut->getDurationTotal());
|
||||
$this->assertEquals(200, $sut->getDurationThisMonth());
|
||||
self::assertEquals(2, $sut->getRecordsTotal());
|
||||
self::assertEquals(7654.298, $sut->getAmountTotal());
|
||||
self::assertEquals(826.10, $sut->getAmountThisMonth());
|
||||
self::assertEquals(13, $sut->getDurationTotal());
|
||||
self::assertEquals(200, $sut->getDurationThisMonth());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ use App\Model\UserStatistic;
|
||||
/**
|
||||
* @covers \App\Model\UserStatistic
|
||||
*/
|
||||
class UserStatisticTest extends AbstractTimesheetCountedStatisticTest
|
||||
class UserStatisticTest extends AbstractTimesheetCountedStatisticTestCase
|
||||
{
|
||||
private function getSut(): UserStatistic
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user