form(); $this->clickOn($form, 'navOverview'); $alerts = implode("\n", $this->items($form, 'alerts')); foreach (['growth', 'static_cache', 'orphans', 'memory_log', 'listeners'] as $kind) { self::assertStringContainsString($kind, $alerts); } self::assertStringStartsWith('100 growth — objects allocated at shop_worker.php:17', $this->items($form, 'alerts')[0]); self::assertStringContainsString('shop_worker.php:17 SqlLogger::log', $this->items($form, 'alerts')[0]); $this->game->shot('overview'); } public function testClickingAnAlertShowsThePathThatKeepsItsMemory(): void { $form = $this->form(); $this->clickOn($form, 'navOverview'); $this->clickRow($form, 'alerts', $this->rowWith($form, 'alerts', 'static_cache')); $detail = $this->text($form, 'alertDetail'); self::assertMatchesRegularExpression('/SqlLogger::\$log retains \d+% of the reachable heap/', $detail); self::assertStringContainsString('Path: SqlLogger::$log (static_prop)', $detail); $this->clickRow($form, 'alerts', $this->rowWith($form, 'alerts', 'memory_log')); self::assertStringContainsString('array of 400 strings', $this->text($form, 'alertDetail')); self::assertStringContainsString('audit (global)', $this->text($form, 'alertDetail')); $this->game->shot('overview-alert'); } public function testTheTopClassesAndARootThatOpensTheInspector(): void { $form = $this->form(); $this->clickOn($form, 'navOverview'); $rows = implode("\n", $this->items($form, 'overviewRows')); self::assertStringContainsString('Query 400', $rows); self::assertStringContainsString('shop_worker.php:17 SqlLogger::log 400', $rows); $this->clickRow($form, 'overviewRows', $this->rowWith($form, 'overviewRows', 'static_prop SqlLogger::$log')); self::assertSame('inspector', $form->view()); self::assertStringContainsString('Root: static_prop SqlLogger::$log', $this->text($form, 'nodeInfo')); } }