<?phpnamespace Tests;/** Dominators, orphans, duplicates: lists of nodes, a click opens one in the inspector. */final class GraphViewsTest extends CryoTestCase{ public function testTheDominatorsStartWithTheLogOfTheLogger(): void { $form = $this->form(); $this->clickOn($form, 'navDominators'); $first = $this->items($form, 'dominators')[0]; self::assertMatchesRegularExpression('/^ *53\.\d KB #\d+ +array \(self 8\.1 KB\)$/', $first); $this->game->shot('dominators'); $this->clickRow($form, 'dominators', 0); self::assertSame('inspector', $form->view()); self::assertStringContainsString('Root: static_prop SqlLogger::$log', $this->text($form, 'nodeInfo')); $this->clickOn($form, 'back'); self::assertSame('dominators', $form->view()); } public function testTheOrphansAreTheConnectionsLeftToTheCollector(): void { $form = $this->form(); $this->clickOn($form, 'navOrphans'); $rows = $this->items($form, 'orphans'); self::assertSame('Connection: 10 objects, 560 B', $rows[0]); self::assertCount(11, $rows); self::assertStringContainsString('Connection 56 B epoch 0 shop_worker.php:47 Connection::pair', $rows[1]); $this->game->shot('orphans'); $this->clickRow($form, 'orphans', 0); // a class line: nothing to open self::assertSame('orphans', $form->view()); $this->clickRow($form, 'orphans', 1); self::assertSame('inspector', $form->view()); self::assertStringStartsWith('peer → #', $this->items($form, 'outEdges')[0]); self::assertStringContainsString('Root: orphan', $this->text($form, 'nodeInfo')); } public function testTheDuplicatesFindTheCopiesOfTheAuditText(): void { $form = $this->form(); $this->clickOn($form, 'navDupes'); $first = $this->items($form, 'dupes')[0]; self::assertStringStartsWith('400 × string of 13 14.8 KB · 14.8 KB wasted', $first); $this->game->shot('dupes'); $this->clickRow($form, 'dupes', 0); self::assertSame('inspector', $form->view()); self::assertStringContainsString('(string)', $this->text($form, 'nodeTitle')); self::assertMatchesRegularExpression('/^#\d+ array → \[\d+\]$/', $this->items($form, 'inEdges')[0]); }}