toBeTrue("$rel must exist"); expect(filesize($path))->toBeGreaterThanOrEqual(1); } }); test('every touched file passes a syntactic shebang/PHP-tag check', function () use ($repoRoot, $touched) { foreach ($touched as $rel) { $head = file_get_contents("$repoRoot/$rel", false, null, 0, 16); expect($head)->toContain(' ['$graph_template_item_id = null;', '$graph_template_item_id === null'], 'color_templates.php' => ['$color_template_item_id = null;', '$color_template_item_id === null'], 'graph_templates.php' => ['$graph_template_item_id = null;', '$graph_template_item_id === null'], 'graphs.php' => ['$graph_template_item_id = null;', '$graph_template_item_id === null'], ]; foreach ($cases as $rel => [$init, $consumer]) { $src = file_get_contents("$repoRoot/$rel"); $initPos = strpos($src, $init); $consumePos = strpos($src, $consumer); expect($initPos)->not->toBeFalse("$rel must contain init: $init"); expect($consumePos)->not->toBeFalse("$rel must contain consumer: $consumer"); expect($initPos < $consumePos)->toBeTrue("$rel: init must precede consumer"); } }); test('lib/html.php right-tab block dropped the redundant isset guard', function () use ($repoRoot) { $src = file_get_contents("$repoRoot/lib/html.php"); $start = strpos($src, 'foreach ($tabs_right as $tab)'); $slice = substr($src, $start, 4000); expect($slice)->not->toBe(''); expect(strpos($slice, "isset(\$tab['image'])"))->toBeFalse(); expect(substr_count($slice, "\$tab['image'] != ''"))->toBeGreaterThanOrEqual(3); });