apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -27,10 +27,10 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\Templating\EngineInterface;
/**
* @internal
*
* @coversNothing
*/
final class AddressConverterTest extends TestCase

View File

@@ -22,7 +22,6 @@ use Chill\CalendarBundle\Entity\Calendar;
use Chill\CalendarBundle\Entity\CalendarRange;
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\RemoteToLocalSync\CalendarRangeSyncer;
use Chill\MainBundle\Entity\User;
use DateTimeImmutable;
use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
@@ -33,6 +32,7 @@ use Symfony\Component\HttpClient\Response\MockResponse;
/**
* @internal
*
* @coversNothing
*/
final class CalendarRangeSyncerTest extends TestCase
@@ -228,8 +228,8 @@ final class CalendarRangeSyncerTest extends TestCase
$calendarRange = new CalendarRange();
$calendarRange
->setUser($user = new User())
->setStartDate(new DateTimeImmutable('2020-01-01 15:00:00'))
->setEndDate(new DateTimeImmutable('2020-01-01 15:30:00'))
->setStartDate(new \DateTimeImmutable('2020-01-01 15:00:00'))
->setEndDate(new \DateTimeImmutable('2020-01-01 15:30:00'))
->addRemoteAttributes([
'lastModifiedDateTime' => 0,
'changeKey' => 'abc',
@@ -244,11 +244,11 @@ final class CalendarRangeSyncerTest extends TestCase
$this->assertStringContainsString(
'2022-06-10T15:30:00',
$calendarRange->getStartDate()->format(DateTimeImmutable::ATOM)
$calendarRange->getStartDate()->format(\DateTimeImmutable::ATOM)
);
$this->assertStringContainsString(
'2022-06-10T17:30:00',
$calendarRange->getEndDate()->format(DateTimeImmutable::ATOM)
$calendarRange->getEndDate()->format(\DateTimeImmutable::ATOM)
);
$this->assertTrue($calendarRange->preventEnqueueChanges);
}

View File

@@ -24,8 +24,6 @@ use Chill\CalendarBundle\Entity\Invite;
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\RemoteToLocalSync\CalendarSyncer;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Repository\UserRepositoryInterface;
use DateTimeImmutable;
use DateTimeZone;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
@@ -35,6 +33,7 @@ use Symfony\Component\HttpClient\Response\MockResponse;
/**
* @internal
*
* @coversNothing
*/
final class CalendarSyncerTest extends TestCase
@@ -362,9 +361,9 @@ final class CalendarSyncerTest extends TestCase
parent::setUp();
// all tests should run when timezone = +02:00
$brussels = new DateTimeZone('Europe/Brussels');
$brussels = new \DateTimeZone('Europe/Brussels');
if (7200 === $brussels->getOffset(new DateTimeImmutable())) {
if (7200 === $brussels->getOffset(new \DateTimeImmutable())) {
date_default_timezone_set('Europe/Brussels');
} else {
date_default_timezone_set('Europe/Moscow');
@@ -403,8 +402,8 @@ final class CalendarSyncerTest extends TestCase
$calendar = new Calendar();
$calendar
->setMainUser($user = new User())
->setStartDate(new DateTimeImmutable('2022-06-11 14:30:00'))
->setEndDate(new DateTimeImmutable('2022-06-11 15:30:00'))
->setStartDate(new \DateTimeImmutable('2022-06-11 14:30:00'))
->setEndDate(new \DateTimeImmutable('2022-06-11 15:30:00'))
->addUser($userA)
->addUser($userB)
->setCalendarRange(new CalendarRange())
@@ -480,8 +479,8 @@ final class CalendarSyncerTest extends TestCase
$calendar = new Calendar();
$calendar
->setMainUser($user = new User())
->setStartDate(new DateTimeImmutable('2020-01-01 10:00:00'))
->setEndDate(new DateTimeImmutable('2020-01-01 12:00:00'))
->setStartDate(new \DateTimeImmutable('2020-01-01 10:00:00'))
->setEndDate(new \DateTimeImmutable('2020-01-01 12:00:00'))
->setCalendarRange(new CalendarRange())
->addRemoteAttributes([
'lastModifiedDateTime' => 0,
@@ -498,11 +497,11 @@ final class CalendarSyncerTest extends TestCase
$this->assertStringContainsString(
'2022-06-10T15:30:00',
$calendar->getStartDate()->format(DateTimeImmutable::ATOM)
$calendar->getStartDate()->format(\DateTimeImmutable::ATOM)
);
$this->assertStringContainsString(
'2022-06-10T17:30:00',
$calendar->getEndDate()->format(DateTimeImmutable::ATOM)
$calendar->getEndDate()->format(\DateTimeImmutable::ATOM)
);
$this->assertTrue($calendar->preventEnqueueChanges);
$this->assertGreaterThan($previousVersion, $calendar->getDateTimeVersion());
@@ -524,8 +523,8 @@ final class CalendarSyncerTest extends TestCase
$calendar = new Calendar();
$calendar
->setMainUser($user = new User())
->setStartDate(new DateTimeImmutable('2022-06-10 15:30:00'))
->setEndDate(new DateTimeImmutable('2022-06-10 17:30:00'))
->setStartDate(new \DateTimeImmutable('2022-06-10 15:30:00'))
->setEndDate(new \DateTimeImmutable('2022-06-10 17:30:00'))
->setCalendarRange(new CalendarRange())
->addRemoteAttributes([
'lastModifiedDateTime' => 0,
@@ -541,11 +540,11 @@ final class CalendarSyncerTest extends TestCase
$this->assertStringContainsString(
'2022-06-10T15:30:00',
$calendar->getStartDate()->format(DateTimeImmutable::ATOM)
$calendar->getStartDate()->format(\DateTimeImmutable::ATOM)
);
$this->assertStringContainsString(
'2022-06-10T17:30:00',
$calendar->getEndDate()->format(DateTimeImmutable::ATOM)
$calendar->getEndDate()->format(\DateTimeImmutable::ATOM)
);
$this->assertTrue($calendar->preventEnqueueChanges);
$this->assertEquals(Calendar::STATUS_VALID, $calendar->getStatus());
@@ -568,8 +567,8 @@ final class CalendarSyncerTest extends TestCase
$calendar = new Calendar();
$calendar
->setMainUser($user = new User())
->setStartDate(new DateTimeImmutable('2020-01-01 10:00:00'))
->setEndDate(new DateTimeImmutable('2020-01-01 12:00:00'))
->setStartDate(new \DateTimeImmutable('2020-01-01 10:00:00'))
->setEndDate(new \DateTimeImmutable('2020-01-01 12:00:00'))
->setCalendarRange(new CalendarRange())
->addRemoteAttributes([
'lastModifiedDateTime' => 0,
@@ -585,11 +584,11 @@ final class CalendarSyncerTest extends TestCase
$this->assertStringContainsString(
'2020-01-01T10:00:00',
$calendar->getStartDate()->format(DateTimeImmutable::ATOM)
$calendar->getStartDate()->format(\DateTimeImmutable::ATOM)
);
$this->assertStringContainsString(
'2020-01-01T12:00:00',
$calendar->getEndDate()->format(DateTimeImmutable::ATOM)
$calendar->getEndDate()->format(\DateTimeImmutable::ATOM)
);
$this->assertEquals(Calendar::STATUS_VALID, $calendar->getStatus());

View File

@@ -30,6 +30,7 @@ use Prophecy\PhpUnit\ProphecyTrait;
/**
* @internal
*
* @coversNothing
*/
final class LocationConverterTest extends TestCase

View File

@@ -22,6 +22,7 @@ use Symfony\Component\HttpClient\Response\MockResponse;
/**
* @internal
*
* @coversNothing
*/
class MSUserAbsenceReaderTest extends TestCase
@@ -55,7 +56,7 @@ class MSUserAbsenceReaderTest extends TestCase
$absenceReader = new MSUserAbsenceReader($client, $mapUser->reveal(), $clock);
self::assertNull($absenceReader->isUserAbsent($user), "when no user found, absence should be null");
self::assertNull($absenceReader->isUserAbsent($user), 'when no user found, absence should be null');
}
public function provideDataTestUserAbsence(): iterable
@@ -81,7 +82,7 @@ class MSUserAbsenceReaderTest extends TestCase
}
JSON,
false,
"User is present"
'User is present',
];
yield [
@@ -103,7 +104,7 @@ class MSUserAbsenceReaderTest extends TestCase
}
JSON,
true,
'User is absent with absence scheduled, we are within this period'
'User is absent with absence scheduled, we are within this period',
];
yield [
@@ -125,7 +126,7 @@ class MSUserAbsenceReaderTest extends TestCase
}
JSON,
false,
'User is present: absence is scheduled for later'
'User is present: absence is scheduled for later',
];
yield [
@@ -147,7 +148,7 @@ class MSUserAbsenceReaderTest extends TestCase
}
JSON,
false,
'User is present: absence is past'
'User is present: absence is past',
];
yield [
@@ -169,7 +170,7 @@ class MSUserAbsenceReaderTest extends TestCase
}
JSON,
true,
"User is absent: absence is always enabled"
'User is absent: absence is always enabled',
];
}
}

View File

@@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Chill\CalendarBundle\Tests\RemoteCalendar\Connector\MSGraph;
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\MSUserAbsenceReader;
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\MSUserAbsenceReaderInterface;
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\MSUserAbsenceSync;
use Chill\MainBundle\Entity\User;
@@ -22,6 +21,7 @@ use Symfony\Component\Clock\MockClock;
/**
* @internal
*
* @coversNothing
*/
class MSUserAbsenceSyncTest extends TestCase
@@ -48,21 +48,21 @@ class MSUserAbsenceSyncTest extends TestCase
public function provideDataTestSyncUserAbsence(): iterable
{
yield [new User(), false, false, null, "user present remains present"];
yield [new User(), true, true, new \DateTimeImmutable('2023-07-01T12:00:00'), "user present becomes absent"];
yield [new User(), false, false, null, 'user present remains present'];
yield [new User(), true, true, new \DateTimeImmutable('2023-07-01T12:00:00'), 'user present becomes absent'];
$user = new User();
$user->setAbsenceStart($abs = new \DateTimeImmutable("2023-07-01T12:00:00"));
yield [$user, true, true, $abs, "user absent remains absent"];
$user->setAbsenceStart($abs = new \DateTimeImmutable('2023-07-01T12:00:00'));
yield [$user, true, true, $abs, 'user absent remains absent'];
$user = new User();
$user->setAbsenceStart($abs = new \DateTimeImmutable("2023-07-01T12:00:00"));
yield [$user, false, false, null, "user absent becomes present"];
$user->setAbsenceStart($abs = new \DateTimeImmutable('2023-07-01T12:00:00'));
yield [$user, false, false, null, 'user absent becomes present'];
yield [new User(), null, false, null, "user not syncable: presence do not change"];
yield [new User(), null, false, null, 'user not syncable: presence do not change'];
$user = new User();
$user->setAbsenceStart($abs = new \DateTimeImmutable("2023-07-01T12:00:00"));
yield [$user, null, true, $abs, "user not syncable: absence do not change"];
$user->setAbsenceStart($abs = new \DateTimeImmutable('2023-07-01T12:00:00'));
yield [$user, null, true, $abs, 'user not syncable: absence do not change'];
}
}