Skip to content

Commit 8781b5d

Browse files
committed
Fix JobsCollector tests
1 parent 146a204 commit 8781b5d

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

tests/DataCollector/JobsCollectorTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,29 @@ public function testItCollectsDispatchedJobs()
3434
/** @var \DebugBar\DataCollector\ObjectCountCollector $collector */
3535
$collector = debugbar()->getCollector('jobs');
3636
$collector->setXdebugLinkTemplate('');
37+
$keyMap = ['value' => 'Count'];
38+
$data = [];
3739

3840
$this->assertEquals(
39-
['data' => [], 'count' => 0, 'is_counter' => true],
41+
['data' => $data, 'count' => 0, 'key_map' => $keyMap, 'is_counter' => true],
4042
$collector->collect()
4143
);
4244

4345
OrderShipped::dispatch(1);
4446

47+
$data[OrderShipped::class] = ['value' => 1];
4548
$this->assertEquals(
46-
['data' => [OrderShipped::class => 1], 'count' => 1, 'is_counter' => true],
49+
['data' => $data, 'count' => 1, 'key_map' => $keyMap, 'is_counter' => true],
4750
$collector->collect()
4851
);
4952

5053
dispatch(new SendNotification());
5154
dispatch(new SendNotification());
5255
dispatch(new SendNotification());
5356

57+
$data[SendNotification::class] = ['value' => 3];
5458
$this->assertEquals(
55-
['data' => [OrderShipped::class => 1, SendNotification::class => 3], 'count' => 4, 'is_counter' => true],
59+
['data' => $data, 'count' => 4, 'key_map' => $keyMap, 'is_counter' => true],
5660
$collector->collect()
5761
);
5862
}

tests/DataCollector/ModelsCollectorTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@ class ModelsCollectorTest extends TestCase
1414

1515
public function testItCollectsRetrievedModels()
1616
{
17-
$eventList = ['retrieved', 'created', 'updated', 'deleted', 'restored'];
18-
$keyMap = array_combine($eventList, array_map('ucfirst', $eventList));
19-
$data = [];
20-
2117
$this->loadLaravelMigrations();
22-
2318
debugbar()->boot();
2419

2520
/** @var \DebugBar\DataCollector\ObjectCountCollector $collector */
2621
$collector = debugbar()->getCollector('models');
2722
$collector->setXdebugLinkTemplate('');
23+
$eventList = ['retrieved', 'created', 'updated', 'deleted', 'restored'];
24+
$keyMap = array_combine($eventList, array_map('ucfirst', $eventList));
25+
$data = [];
2826

2927
$this->assertEquals(
3028
['data' => $data, 'count' => 0, 'key_map' => $keyMap, 'is_counter' => true],

0 commit comments

Comments
 (0)