Skip to content

Commit

Permalink
Remove legacy test case that psalm *really* does not like
Browse files Browse the repository at this point in the history
  • Loading branch information
ostrolucky committed Feb 10, 2024
1 parent 5a5be76 commit ea8789b
Showing 1 changed file with 0 additions and 51 deletions.
51 changes: 0 additions & 51 deletions Tests/DataCollector/DoctrineDataCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Doctrine\Bundle\DoctrineBundle\Tests\DataCollector;

use Doctrine\Bundle\DoctrineBundle\DataCollector\DoctrineDataCollector;
use Doctrine\DBAL\Logging\DebugStack;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
Expand All @@ -17,7 +16,6 @@
use Symfony\Component\HttpFoundation\Response;

use function interface_exists;
use function method_exists;

class DoctrineDataCollectorTest extends TestCase
{
Expand Down Expand Up @@ -130,55 +128,6 @@ public function testGetGroupedQueries(): void
$this->assertSame(1, $groupedQueries['default'][1]['count']);
}

/** @group legacy */
public function testGetGroupedQueriesWithDeprecatedDebugStackLogger(): void
{
if (! method_exists(DoctrineDataCollector::class, 'addLogger')) {
$this->markTestSkipped('This test requires symfony < 7.0');
}

/** @psalm-suppress UndefinedClass Symfony < 7 specific */
$logger = $this->getMockBuilder(DebugStack::class)->getMock();
/** @psalm-suppress NoInterfaceProperties */
$logger->queries = [];
/**
* @psalm-suppress NoInterfaceProperties
* @psalm-suppress UndefinedDocblockClass
*/
$logger->queries[] = [
'sql' => 'SELECT * FROM foo WHERE bar = :bar',
'params' => [':bar' => 1],
'types' => null,
'executionMS' => 32,
];
/** @psalm-suppress NoInterfaceProperties */
$logger->queries[] = [
'sql' => 'SELECT * FROM foo WHERE bar = :bar',
'params' => [':bar' => 2],
'types' => null,
'executionMS' => 25,
];
$collector = $this->createCollector([]);
$collector->addLogger('default', $logger);
$collector->collect(new Request(), new Response());
$groupedQueries = $collector->getGroupedQueries();
$this->assertCount(1, $groupedQueries['default']);
$this->assertSame('SELECT * FROM foo WHERE bar = :bar', $groupedQueries['default'][0]['sql']);
$this->assertSame(2, $groupedQueries['default'][0]['count']);
/** @psalm-suppress NoInterfaceProperties */
$logger->queries[] = [
'sql' => 'SELECT * FROM bar',
'params' => [],
'types' => null,
'executionMS' => 25,
];
$collector->collect(new Request(), new Response());
$groupedQueries = $collector->getGroupedQueries();
$this->assertCount(2, $groupedQueries['default']);
$this->assertSame('SELECT * FROM bar', $groupedQueries['default'][1]['sql']);
$this->assertSame(1, $groupedQueries['default'][1]['count']);
}

private function createEntityMetadata(string $entityFQCN): ClassMetadata
{
$metadata = new ClassMetadata($entityFQCN);
Expand Down

0 comments on commit ea8789b

Please sign in to comment.