public function testAnalysisAllPluginsPrivate11() { $config = new \CodeReview\Config(array(), array($this, 'getLatestVersion')); $config->parseInput(array('subpath' => '', 'version' => '1.1', 'include_disabled_plugins' => true, 'find_deprecated_functions' => true, 'find_private_functions' => true, 'fix_problems' => false)); $analyzer = new \CodeReview\Analyzer($config); $analyzer->analyze(); $stringOutput = $analyzer->outputReport(); $this->assertContains("Subpath selected <strong>/</strong>", $stringOutput); $this->assertContains("Max version: 1.1", $stringOutput); $this->assertContains("Skipped inactive plugins: no", $stringOutput); $this->assertContains("Search for deprecated functions usage: yes", $stringOutput); $this->assertContains("Search for private functions usage: yes", $stringOutput); $this->assertContains("Attempt to fix problems: no", $stringOutput); $this->assertContains("Found 1 problems in 1 files", $stringOutput); $this->assertContains("Found 0 fixes in 1 files", $stringOutput); $this->assertContains("Processed 13 files total", $stringOutput); $this->assertNotContains("Time taken: ", $stringOutput); $ds = DIRECTORY_SEPARATOR; $errorMessage2 = 'Function call: foobar_private_api (use of function marked private is unsafe)'; $instance2Path = 'test_files/fake_elgg/' . $ds . 'mod' . $ds . 'ugly_plugin' . $ds . 'classes' . $ds . 'ugly_plugin.php'; $this->assertContains($instance2Path . "\n Line 13:\t" . $errorMessage2, $stringOutput); }
<?php admin_gatekeeper(); ini_set('max_execution_time', 0); $options = new \CodeReview\Config(); $options->parseInput($vars); /* * Produce output */ echo '<pre>'; $body = ''; $mt = microtime(true); try { $analyzer = new \CodeReview\Analyzer($options); $analyzer->analyze(); $body .= $analyzer->outputReport(); } catch (\CodeReview\IOException $e) { echo "*** Error: " . $e->getMessage() . " ***\n"; } $body .= sprintf("Time taken: %.4fs\n", microtime(true) - $mt); echo $body; echo '</pre>';