Skip to content

Commit

Permalink
fix tests #3610
Browse files Browse the repository at this point in the history
  • Loading branch information
emilschn committed Jan 30, 2025
1 parent 1849e8e commit 1f5f0d9
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/DataFixtures/Loader/LoadSuiviData.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function load(ObjectManager $manager): void

$second = 1;
foreach ($signalements as $signalement) {
$createdAtUpdated = $signalement->getCreatedAt()->modify('+'.$second.' second');
$suivi = $this->suiviManager->createSuivi(
user: $this->userRepository->findOneBy(['email' => $this->parameterBag->get('user_system_email')]),
signalement: $signalement,
Expand All @@ -44,6 +43,7 @@ public function load(ObjectManager $manager): void
isPublic: true,
flush: false,
);
$createdAtUpdated = $signalement->getCreatedAt()->modify('+'.$second.' second');
$suivi->setCreatedAt($createdAtUpdated);
$manager->persist($suivi);
++$second;
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Notification
#[ORM\ManyToOne(targetEntity: Signalement::class)]
private ?Signalement $signalement;

#[ORM\ManyToOne(targetEntity: Suivi::class)]
#[ORM\ManyToOne(targetEntity: Suivi::class, cascade: ['persist'])]
#[ORM\JoinColumn(onDelete: 'CASCADE')]
private ?Suivi $suivi;

Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Tag implements EntityHistoryInterface
#[Groups(['widget-settings:read'])]
private ?int $id = null;

#[ORM\ManyToMany(targetEntity: Signalement::class, mappedBy: 'tags')]
#[ORM\ManyToMany(targetEntity: Signalement::class, mappedBy: 'tags', cascade: ['persist'])]
private Collection $signalements;

#[ORM\Column(type: 'string', length: 255)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ public function provideNewFilterSearch(): \Generator
yield 'Search by Procédure estimée' => [['procedure' => 'rsd', 'isImported' => 'oui'], 7];
yield 'Search by Partenaires affectés' => [['partenaires' => ['5'], 'isImported' => 'oui'], 2];
yield 'Search by Statut de la visite' => [['visiteStatus' => 'Planifiée', 'isImported' => 'oui'], 5];
yield 'Search by Type de dernier suivi' => [['typeDernierSuivi' => 'automatique', 'isImported' => 'oui'], 34];
yield 'Search by Date de dernier suivi' => [['dateDernierSuiviDebut' => '2023-04-01', 'dateDernierSuiviFin' => '2023-04-18', 'isImported' => 'oui'], 3];
yield 'Search by Type de dernier suivi' => [['typeDernierSuivi' => 'automatique', 'isImported' => 'oui'], 33];
yield 'Search by Date de dernier suivi' => [['dateDernierSuiviDebut' => '2023-04-01', 'dateDernierSuiviFin' => '2023-04-18', 'isImported' => 'oui'], 2];
yield 'Search by Statut de l\'affectation' => [['statusAffectation' => 'refuse', 'isImported' => 'oui'], 1];
yield 'Search by Score criticite' => [['criticiteScoreMin' => 5, 'criticiteScoreMax' => 6, 'isImported' => 'oui'], 9];
yield 'Search by Declarant' => [['typeDeclarant' => 'locataire', 'isImported' => 'oui'], 47];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public function testCountUnseenNotification(): void

$user = $userRepository->findOneBy(['email' => '[email protected]']);
$notificationCount = (new NotificationCounter($notificationRepository))->countUnseenNotification($user);
$this->assertEquals(9, $notificationCount);
$this->assertEquals(7, $notificationCount);
}
}
11 changes: 0 additions & 11 deletions tests/Unit/Command/ImportSignalementCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use App\Service\Import\CsvParser;
use App\Service\Import\Signalement\SignalementImportLoader;
use App\Service\UploadHandlerService;
use Doctrine\Common\EventManager;
use Doctrine\ORM\EntityManager;
use League\Flysystem\FilesystemOperator;
use Symfony\Bundle\FrameworkBundle\Console\Application;
Expand Down Expand Up @@ -40,11 +39,6 @@ public function testDisplaySuccessfullyMessage()
->with(Territory::class)
->willReturn($territoryRepository);

$eventManager = $this->createMock(EventManager::class);
$entityManager->expects($this->atLeast(1))
->method('getEventManager')
->willReturn($eventManager);

$uploadHandlerService = $this->createMock(UploadHandlerService::class);
$uploadHandlerService->expects($this->once())
->method('createTmpFileFromBucket');
Expand Down Expand Up @@ -169,11 +163,6 @@ public function testFileDoesNotExist()
->with(Territory::class)
->willReturn($territoryRepository);

$eventManager = $this->createMock(EventManager::class);
$entityManager->expects($this->atLeast(1))
->method('getEventManager')
->willReturn($eventManager);

$uploadHandlerService = $this->createMock(UploadHandlerService::class);
$signalementImportLoader = $this->createMock(SignalementImportLoader::class);
$csvParser = $this->createMock(CsvParser::class);
Expand Down

0 comments on commit 1f5f0d9

Please sign in to comment.