test_class.declarator: logTester = new LogTester()
test_class.modifier: @org.junit.Rule
    public
test_class.original_string: @org.junit.Rule
    public LogTester logTester = new LogTester();
test_class.type: LogTester
test_class.var_name: logTester
test_class.declarator: checkContext
test_class.modifier: private
test_class.original_string: private CheckContext checkContext;
test_class.type: CheckContext
test_class.var_name: checkContext
test_class.file: php-frontend/src/test/java/org/sonar/plugins/php/api/cfg/ControlFlowGraphTest.java
test_class.identifier: ControlFlowGraphTest
test_class.superclass: extends PHPTreeModelTest
test_case.body: @Test
    public void test_cfg_failure_logs() {
      CompilationUnitTree tree = parse("<?php\n" +
          "function foo() {\n" +
          "     break;\n" +
          "}\n",
        PHPLexicalGrammar.COMPILATION_UNIT);
      FunctionDeclarationTree func = (FunctionDeclarationTree) tree.script().statements().get(0);
      logTester.setLevel(LoggerLevel.DEBUG);
      ControlFlowGraph cfg = ControlFlowGraph.build(func, checkContext);
      assertThat(cfg).isNull();
      assertThat(logTester.logs(LoggerLevel.WARN)).contains("Failed to build control flow graph for file [mock.php] at line 2 (activate debug logs for more details)");
      assertThat(logTester.logs(LoggerLevel.DEBUG)).hasOnlyOneElementSatisfying(s -> assertThat(s).contains("com.sonar.sslr.api.RecognitionException: Failed to build CFG"));
      logTester.clear();
      logTester.setLevel(LoggerLevel.INFO);
  
      // testing mechanism avoiding reporting failure multiple times for the same tree
      cfg = ControlFlowGraph.build(func, checkContext);
      assertThat(cfg).isNull();
      assertThat(logTester.logs()).isEmpty();
    }
test_case.class_method_signature: ControlFlowGraphTest.test_cfg_failure_logs()
test_case.full_signature: @Test public void test_cfg_failure_logs()
test_case.identifier: test_cfg_failure_logs
test_case.invocations: parse get statements script setLevel build isNull assertThat contains assertThat logs hasOnlyOneElementSatisfying assertThat logs contains assertThat clear setLevel build isNull assertThat isEmpty assertThat logs
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test_cfg_failure_logs()
focal_class.declarator: LOG = Loggers.get(ControlFlowGraph.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = Loggers.get(ControlFlowGraph.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: KINDS_WITH_CONTROL_FLOW = Sets.immutableEnumSet(
      Tree.Kind.FUNCTION_DECLARATION,
      Tree.Kind.FUNCTION_EXPRESSION,
      Tree.Kind.METHOD_DECLARATION,
      Tree.Kind.SCRIPT)
focal_class.modifier: public static final
focal_class.original_string: public static final Set<Tree.Kind> KINDS_WITH_CONTROL_FLOW = Sets.immutableEnumSet(
      Tree.Kind.FUNCTION_DECLARATION,
      Tree.Kind.FUNCTION_EXPRESSION,
      Tree.Kind.METHOD_DECLARATION,
      Tree.Kind.SCRIPT);
focal_class.type: Set<Tree.Kind>
focal_class.var_name: KINDS_WITH_CONTROL_FLOW
focal_class.declarator: start
focal_class.modifier: private final
focal_class.original_string: private final CfgBlock start;
focal_class.type: CfgBlock
focal_class.var_name: start
focal_class.declarator: end
focal_class.modifier: private final
focal_class.original_string: private final PhpCfgEndBlock end;
focal_class.type: PhpCfgEndBlock
focal_class.var_name: end
focal_class.declarator: blocks
focal_class.modifier: private final
focal_class.original_string: private final Set<CfgBlock> blocks;
focal_class.type: Set<CfgBlock>
focal_class.var_name: blocks
focal_class.declarator: failedTrees = Collections.newSetFromMap(new WeakHashMap<>())
focal_class.modifier: private static
focal_class.original_string: private static Set<Tree> failedTrees = Collections.newSetFromMap(new WeakHashMap<>());
focal_class.type: Set<Tree>
focal_class.var_name: failedTrees
focal_class.file: php-frontend/src/main/java/org/sonar/plugins/php/api/cfg/ControlFlowGraph.java
focal_class.identifier: ControlFlowGraph
focal_class.class_method_signature: ControlFlowGraph.ControlFlowGraph(ImmutableSet<CfgBlock> blocks, CfgBlock start, PhpCfgEndBlock end)
focal_class.full_signature:   ControlFlowGraph(ImmutableSet<CfgBlock> blocks, CfgBlock start, PhpCfgEndBlock end)
focal_class.identifier: ControlFlowGraph
focal_class.parameters: (ImmutableSet<CfgBlock> blocks, CfgBlock start, PhpCfgEndBlock end)
focal_class.signature:  ControlFlowGraph(ImmutableSet<CfgBlock> blocks, CfgBlock start, PhpCfgEndBlock end)
focal_class.class_method_signature: ControlFlowGraph.build(BlockTree body)
focal_class.full_signature: @VisibleForTesting public static ControlFlowGraph build(BlockTree body)
focal_class.identifier: build
focal_class.modifiers: @VisibleForTesting public static
focal_class.parameters: (BlockTree body)
focal_class.return: ControlFlowGraph
focal_class.signature: ControlFlowGraph build(BlockTree body)
focal_class.class_method_signature: ControlFlowGraph.build(ScriptTree scriptTree)
focal_class.full_signature: @VisibleForTesting static ControlFlowGraph build(ScriptTree scriptTree)
focal_class.identifier: build
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (ScriptTree scriptTree)
focal_class.return: ControlFlowGraph
focal_class.signature: ControlFlowGraph build(ScriptTree scriptTree)
focal_class.class_method_signature: ControlFlowGraph.build(ForEachStatementTree statementTree)
focal_class.full_signature: @VisibleForTesting static ControlFlowGraph build(ForEachStatementTree statementTree)
focal_class.identifier: build
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (ForEachStatementTree statementTree)
focal_class.return: ControlFlowGraph
focal_class.signature: ControlFlowGraph build(ForEachStatementTree statementTree)
focal_class.class_method_signature: ControlFlowGraph.build(Tree tree, CheckContext context)
focal_class.full_signature: @CheckForNull public static ControlFlowGraph build(Tree tree, CheckContext context)
focal_class.identifier: build
focal_class.modifiers: @CheckForNull public static
focal_class.parameters: (Tree tree, CheckContext context)
focal_class.return: ControlFlowGraph
focal_class.signature: ControlFlowGraph build(Tree tree, CheckContext context)
focal_class.class_method_signature: ControlFlowGraph.start()
focal_class.full_signature: public CfgBlock start()
focal_class.identifier: start
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: CfgBlock
focal_class.signature: CfgBlock start()
focal_class.class_method_signature: ControlFlowGraph.end()
focal_class.full_signature: public CfgBlock end()
focal_class.identifier: end
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: CfgBlock
focal_class.signature: CfgBlock end()
focal_class.class_method_signature: ControlFlowGraph.blocks()
focal_class.full_signature: public Set<CfgBlock> blocks()
focal_class.identifier: blocks
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Set<CfgBlock>
focal_class.signature: Set<CfgBlock> blocks()
focal_method.body: @VisibleForTesting
    public static ControlFlowGraph build(BlockTree body) {
      return new ControlFlowGraphBuilder(body.statements()).getGraph();
    }
focal_method.class_method_signature: ControlFlowGraph.build(BlockTree body)
focal_method.full_signature: @VisibleForTesting public static ControlFlowGraph build(BlockTree body)
focal_method.identifier: build
focal_method.invocations: getGraph statements
focal_method.modifiers: @VisibleForTesting public static
focal_method.parameters: (BlockTree body)
focal_method.return: ControlFlowGraph
focal_method.signature: ControlFlowGraph build(BlockTree body)