Skip to content

Commit 59a2cdf

Browse files
committed
Fix tests
1 parent e72afac commit 59a2cdf

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ parameters:
8484
count: 1
8585
path: src/Command/LoadDataFixturesDoctrineODMCommand.php
8686

87-
-
88-
message: '#^Method Psr\\Log\\AbstractLogger@anonymous/src/Command/LoadDataFixturesDoctrineODMCommand\.php\:109\:\:log\(\) has parameter \$message with no type specified\.$#'
89-
identifier: missingType.parameter
90-
count: 1
91-
path: src/Command/LoadDataFixturesDoctrineODMCommand.php
92-
9387
-
9488
message: '#^Parameter \#1 \$application of static method Doctrine\\Bundle\\MongoDBBundle\\Command\\DoctrineODMCommand\:\:setApplicationDocumentManager\(\) expects Symfony\\Bundle\\FrameworkBundle\\Console\\Application, Symfony\\Component\\Console\\Application\|null given\.$#'
9589
identifier: argument.type

src/Command/LoadDataFixturesDoctrineODMCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
101101
return self::INVALID;
102102
}
103103

104+
// @phpstan-ignore method.notFound
104105
$purger->setPurgeMode(MongoDBPurgeMode::Delete);
105106
}
106107

@@ -110,7 +111,10 @@ public function __construct(private OutputInterface $output)
110111
{
111112
}
112113

113-
/** {@inheritDoc} */
114+
/**
115+
* @inheritdoc
116+
* @phpstan-ignore missingType.parameter
117+
*/
114118
public function log($level, $message, array $context = []): void
115119
{
116120
$this->output->writeln(sprintf(' <comment>></comment> <info>%s</info>', $message));

tests/Command/LoadDataFixturesDoctrineODMCommandTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
namespace Doctrine\Bundle\MongoDBBundle\Tests\Command;
66

77
use Doctrine\Bundle\MongoDBBundle\Command\LoadDataFixturesDoctrineODMCommand;
8+
use Doctrine\Common\DataFixtures\Purger\MongoDBPurgeMode;
89
use Symfony\Bundle\FrameworkBundle\Console\Application;
910
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1011
use Symfony\Component\Console\Tester\CommandTester;
1112

13+
use function class_exists;
14+
1215
class LoadDataFixturesDoctrineODMCommandTest extends KernelTestCase
1316
{
1417
private LoadDataFixturesDoctrineODMCommand $command;
@@ -67,8 +70,12 @@ public function testExecute(): void
6770

6871
public function testExecutePurgeWithDelete(): void
6972
{
73+
if (! class_exists(MongoDBPurgeMode::class)) {
74+
$this->markTestSkipped('The --purge-with-delete option requires doctrine/data-fixtures >= 2.1.0.');
75+
}
76+
7077
$commandTester = new CommandTester($this->command);
71-
$commandTester->execute(['--purge-with-delete'], ['interactive' => false]);
78+
$commandTester->execute(['--purge-with-delete' => true], ['interactive' => false]);
7279

7380
$output = $commandTester->getDisplay();
7481
$this->assertStringContainsString('purging database', $output);

0 commit comments

Comments
 (0)