mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 10:03:49 +00:00
Replaced the deprecated 'self::$container->get' with 'self::getContainer()->get' using rector
This change is made to comply with the new Symfony standards and to avoid deprecation warnings for future versions. The update touches various functionalities, including retrieving EntityManagerInterface instance and various service classes within the test files.
This commit is contained in:
@@ -32,7 +32,7 @@ final class NotificationApiControllerTest extends WebTestCase
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
foreach ($this->toDelete as [$className, $id]) {
|
||||
$object = $em->find($className, $id);
|
||||
@@ -45,8 +45,8 @@ final class NotificationApiControllerTest extends WebTestCase
|
||||
public function generateDataMarkAsRead()
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
$userRepository = self::$container->get(UserRepository::class);
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
$userRepository = self::getContainer()->get(UserRepository::class);
|
||||
$userA = $userRepository->findOneBy(['username' => 'center a_social']);
|
||||
$userB = $userRepository->findOneBy(['username' => 'center b_social']);
|
||||
|
||||
@@ -77,10 +77,10 @@ final class NotificationApiControllerTest extends WebTestCase
|
||||
|
||||
$this->assertResponseIsSuccessful('test marking as read');
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
/** @var Notification $notification */
|
||||
$notification = $em->find(Notification::class, $notificationId);
|
||||
$user = self::$container->get(UserRepository::class)->findOneBy(['username' => 'center a_social']);
|
||||
$user = self::getContainer()->get(UserRepository::class)->findOneBy(['username' => 'center a_social']);
|
||||
|
||||
$this->assertTrue($notification->isReadBy($user));
|
||||
|
||||
|
Reference in New Issue
Block a user