Skip to content

Commit f052434

Browse files
CopilotXusifob
andcommitted
Fix CityTest matchesName with null-safe values and clean Prophecy imports in FileProcessorTest
Co-authored-by: Xusifob <8103268+Xusifob@users.noreply.github.com>
1 parent c2e69dd commit f052434

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

tests/Unit/Entity/CityTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,13 @@ public function testMatchesName(): void
160160
$city = new City();
161161
$city->setName('Paris');
162162
$city->setRawName('PARIS');
163+
$city->setSubCityName('Paris 1er');
164+
$city->setRawSubName('PARIS 1ER');
163165

164166
$this->assertTrue($city->matchesName('Paris'));
165167
$this->assertTrue($city->matchesName('PARIS'));
168+
$this->assertTrue($city->matchesName('Paris 1er'));
169+
$this->assertTrue($city->matchesName('PARIS 1ER'));
166170
$this->assertFalse($city->matchesName('Lyon'));
167171
}
168172
}

tests/Unit/Service/FileProcessorTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use App\Service\FileProcessor;
66
use Doctrine\ORM\EntityManagerInterface;
7+
use Prophecy\Argument;
78
use Prophecy\PhpUnit\ProphecyTrait;
89
use Psr\Log\LoggerInterface;
910
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@@ -61,7 +62,7 @@ public function testGetFilesWithExistingFile(): void
6162
{
6263
$em = $this->prophesize(EntityManagerInterface::class);
6364
$logger = $this->prophesize(LoggerInterface::class);
64-
$logger->info(\Prophecy\Argument::any())->willReturn(null);
65+
$logger->info(Argument::any())->willReturn(null);
6566

6667
// Pre-create the file so getFiles skips the download
6768
$filePath = $this->tmpDir . '/var/testfile.txt';
@@ -77,7 +78,7 @@ public function testGetFileReturnsFirstFile(): void
7778
{
7879
$em = $this->prophesize(EntityManagerInterface::class);
7980
$logger = $this->prophesize(LoggerInterface::class);
80-
$logger->info(\Prophecy\Argument::any())->willReturn(null);
81+
$logger->info(Argument::any())->willReturn(null);
8182

8283
$filePath = $this->tmpDir . '/var/singlefile.txt';
8384
file_put_contents($filePath, "content");
@@ -93,7 +94,7 @@ public function testGetFilesWithExistingZip(): void
9394
$em = $this->prophesize(EntityManagerInterface::class);
9495
$logger = $this->prophesize(LoggerInterface::class);
9596
// Allow any info messages (for file-exists, zip extract etc.)
96-
$logger->info(\Prophecy\Argument::any())->willReturn(null);
97+
$logger->info(Argument::any())->willReturn(null);
9798

9899
// Create a real zip file
99100
$zipPath = $this->tmpDir . '/var/testarchive.zip';

0 commit comments

Comments
 (0)