Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixing after CR
  • Loading branch information
MateuszKolankowski committed Mar 26, 2025
commit f8b33f5db724367873d8920577c27f67f53553d0
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
}
}

usort($collectors, static fn ($a, $b) => $b['priority'] <=> $a['priority']);
/** @var array<int, mixed> $collectors */
usort($collectors, static fn (array $a, array $b): int => $b['priority'] <=> $a['priority']);

Check failure on line 38 in src/bundle/Debug/DependencyInjection/Compiler/DataCollectorPass.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (7.4)

PHPDoc tag @var with type array<int, mixed> is not subtype of native type list<array{id: mixed, priority: mixed, panelTemplate: mixed, toolbarTemplate: mixed}>.

Check failure on line 38 in src/bundle/Debug/DependencyInjection/Compiler/DataCollectorPass.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.0)

PHPDoc tag @var with type array<int, mixed> is not subtype of native type list<array{id: mixed, priority: mixed, panelTemplate: mixed, toolbarTemplate: mixed}>.

Check failure on line 38 in src/bundle/Debug/DependencyInjection/Compiler/DataCollectorPass.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.1)

PHPDoc tag @var with type array<int, mixed> is not subtype of native type list<array{id: mixed, priority: mixed, panelTemplate: mixed, toolbarTemplate: mixed}>.

foreach ($collectors as $collector) {
$dataCollectorDef->addMethodCall('addCollector', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,44 @@ protected function registerCompilerPass(ContainerBuilder $container): void

public function testAddCollector()
{
$panelTemplate = 'panel.html.twig';
$toolbarTemplate = 'toolbar.html.twig';
$definition = new Definition();
$definition->addTag(
'ibexa.debug.data_collector',
['panelTemplate' => $panelTemplate, 'toolbarTemplate' => $toolbarTemplate]
);
$defA = new Definition();
$defA->addTag('ibexa.debug.data_collector', [
'panelTemplate' => 'panel_a.html.twig',
'toolbarTemplate' => 'toolbar_a.html.twig',
'priority' => 5,
]);
$this->setDefinition('collector_a', $defA);

$defB = new Definition();
$defB->addTag('ibexa.debug.data_collector', [
'panelTemplate' => 'panel_b.html.twig',
'toolbarTemplate' => 'toolbar_b.html.twig',
'priority' => 10,
]);
$this->setDefinition('collector_b', $defB);

$serviceId = 'service_id';
$this->setDefinition($serviceId, $definition);
$this->compile();

$this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
IbexaCoreCollector::class,
'addCollector',
[new Reference($serviceId), $panelTemplate, $toolbarTemplate]
[new Reference('collector_b'), 'panel_b.html.twig', 'toolbar_b.html.twig']
);

$this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
IbexaCoreCollector::class,
'addCollector',
[new Reference('collector_a'), 'panel_a.html.twig', 'toolbar_a.html.twig']
);

$calls = $this->container->getDefinition(IbexaCoreCollector::class)->getMethodCalls();

$this->assertCount(2, $calls);
$this->assertSame('addCollector', $calls[0][0]);
$this->assertEquals(new Reference('collector_b'), $calls[0][1][0]);

$this->assertSame('addCollector', $calls[1][0]);
$this->assertEquals(new Reference('collector_a'), $calls[1][1][0]);
}
}

Expand Down
Loading