This file is indexed.

/usr/share/phpgacl/test_suite/run.php is in phpgacl 3.3.7-7.3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
	// require gacl & phpunit
	require_once(dirname(__FILE__).'/../admin/gacl_admin.inc.php');
	require_once(dirname(__FILE__).'/phpunit/phpunit.php');
	
	/*! class
	 custom test result class for pretty results
	 !*/
	class gacl_test_result extends TestResult {
		
		var $output = '';
		var $class_name;
		
		function report() {
			/* results table */
			echo '<h2>Test Results</h2>' . "\n";
			echo '<table cellspacing="1" cellpadding="1" border="1" class="details">'."\n";
			echo '<tr><th>Function</th><th width="10%">Success?</th></tr>'."\n";
			echo $this->output;
			echo '</table>'."\n";
			
			/* summary */
			$nRun = $this->countTests();
			$nFailures = $this->countFailures();
			echo '<h2>Summary</h2>'."\n";
			printf('<div class="indent"><p>%s test%s run<br />', $nRun, ($nRun == 1) ? '' : 's');
			printf("%s failure%s.</p></div>\n", $nFailures, ($nFailures == 1) ? '' : 's');
		}
		
		function _startTest($test) {
		}
		
		function _endTest($test) {
			if ( $test->classname() != $this->class_name ) {
				$this->class_name = $test->classname();
				$this->output .= '<tr><td colspan="2" class="class_name">'. $test->classname() .'</td></tr>'."\n";
			}
			
			$this->output .= '<tr><td class="function">'. $test->name();
			if ($test->failed()) {
				$this->output .= "<ul>\n";
				foreach ($test->getExceptions() as $exception) {
					$this->output .= '<li>'. $exception->getMessage() ."</li>\n";
				}
				$this->output .= "</ul>\n";
				
				$outcome = ' class="fail">FAIL';
			} else {
				$outcome = ' class="pass">OK';
			}
			
			$this->output .= '</td><td'. $outcome .'</td></tr>'."\n";
		}
	}
	
	/*! class
	 custom TestCase class to allow control of error formatting
	 
	 can also be used for custom assert functions
	 !*/
	class gacl_test_case extends TestCase {
		
		var $gacl_api;
		
		function gacl_test_case($name) {
			$this->TestCase($name);
			$this->gacl_api = &$GLOBALS['gacl_api'];
		}
		
		function setUp() {
		}
		
		function tearDown() {
		}
		
		function _formatValue($value, $class='') {
			if (phpversion() < '4.0.0') {
				return '<code class="'. $class .'">'. htmlentities((string)$value) .'</code>';
			}
			
			switch (TRUE)
			{
				case is_object($value):
					if (method_exists($value, 'toString')) {
						$translateValue = $value->toString();
					} else {
						$translateValue = serialize($value);
					}
					
					$htmlValue = htmlentities($translateValue);
					break;
				case is_array($value):
					ob_start();
						print_r($value);
						$translateValue = ob_get_contents();
					ob_end_clean();
					
					$htmlValue = nl2br(str_replace('    ', '&nbsp; &nbsp; ', htmlentities(rtrim($translateValue))));
					break;
				case is_bool($value):
					$htmlValue = $value ? '<i>true</i>' : '<i>false</i>';
					break;
				case phpversion() >= '4.0.4' && is_null($value):
					$htmlValue = '<i>null</i>';
					break;
				default:
					$htmlValue = htmlentities(strval($value));
			}
			
			$htmlValue = '<code class="'. $class . '">' . $htmlValue . '</code>';
			$htmlValue .= '&nbsp;&nbsp;<span class="typeinfo">';
			$htmlValue .= 'type:' . gettype($value);
			
			if (is_object($value)) {
				$htmlValue .= ', class:' . get_class($value);
			}
			
			$htmlValue .= '</span>';
			
			return $htmlValue;
		}
	}
	
	/*! class
	 custom TestSuite class for future expansion
	 !*/
	class gacl_test_suite extends TestSuite {
		
	}
	
	$title = 'phpGACL Test Suite';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title><?php echo $title; ?></title>
    <link rel="stylesheet" href="styles.css" type="text/css" title="GACL Test Suite Styles"/>
  </head>
  <body>
    <h1><?php echo $title; ?></h1>
    <h2>Running Tests</h2>
    <div class="indent">
<?php
	// initialise result
	$result = new gacl_test_result;
	
	// run api tests
	include('unit_tests.php');
	
	// run acl tests
	include('acl_tests.php');
	
	echo '
    </div>
    ';
	
	// show report
	$result->report();
?>
  </body>
</html>