Fixing constructors

Adding method visibility.
Removing reference operators.
This commit is contained in:
Mark Story 2010-04-14 22:56:51 -04:00
parent 4ef899fa54
commit 79eeb33e35
7 changed files with 42 additions and 42 deletions

View file

@ -1302,7 +1302,7 @@ class CakeRoute {
* @param string $params Array of parameters and additional options for the Route
* @return void
*/
public function CakeRoute($template, $defaults = array(), $options = array()) {
public function __construct($template, $defaults = array(), $options = array()) {
$this->template = $template;
$this->defaults = (array)$defaults;
$this->options = (array)$options;

View file

@ -74,7 +74,7 @@ class CakeTestSuiteDispatcher {
*
* @return void
*/
function CakeTestSuiteDispatcher() {
function __construct() {
$this->_baseUrl = $_SERVER['PHP_SELF'];
$dir = rtrim(dirname($this->_baseUrl), '\\');
$this->_baseDir = ($dir === '/') ? $dir : $dir . '/';

View file

@ -80,7 +80,7 @@ class CakeBaseReporter extends SimpleReporter {
* @param string $charset The character set to output with. Defaults to UTF-8
* @param array $params Array of request parameters the reporter should use. See above.
*/
public function CakeBaseReporter($charset = 'utf-8', $params = array()) {
function __construct($charset = 'utf-8', $params = array()) {
$this->SimpleReporter();
if (!$charset) {
$charset = 'utf-8';
@ -97,7 +97,7 @@ class CakeBaseReporter extends SimpleReporter {
* @param integer $size
* @return void
*/
function paintGroupStart($test_name, $size) {
public function paintGroupStart($test_name, $size) {
if (empty($this->_timeStart)) {
$this->_timeStart = $this->_getTime();
}
@ -111,7 +111,7 @@ class CakeBaseReporter extends SimpleReporter {
* @param string $test_name Name of the test that is being run.
* @return void
*/
function paintGroupEnd($test_name) {
public function paintGroupEnd($test_name) {
$this->_timeEnd = $this->_getTime();
$this->_timeDuration = $this->_timeEnd - $this->_timeStart;
parent::paintGroupEnd($test_name);
@ -124,7 +124,7 @@ class CakeBaseReporter extends SimpleReporter {
* @param string $method The method name being run.
* @return void
*/
function paintMethodStart($method) {
public function paintMethodStart($method) {
parent::paintMethodStart($method);
if (!empty($this->params['codeCoverage'])) {
CodeCoverageManager::start();
@ -138,7 +138,7 @@ class CakeBaseReporter extends SimpleReporter {
* @param string $method The name of the method being run.
* @return void
*/
function paintMethodEnd($method) {
public function paintMethodEnd($method) {
parent::paintMethodEnd($method);
if (!empty($this->params['codeCoverage'])) {
CodeCoverageManager::stop();
@ -162,7 +162,7 @@ class CakeBaseReporter extends SimpleReporter {
*
* @return mixed
*/
function testCaseList() {
public function testCaseList() {
$testList = TestManager::getTestCaseList();
return $testList;
}
@ -173,7 +173,7 @@ class CakeBaseReporter extends SimpleReporter {
*
* @return void
*/
function groupTestList() {
public function groupTestList() {
$testList = TestManager::getGroupTestList();
return $testList;
}
@ -184,7 +184,7 @@ class CakeBaseReporter extends SimpleReporter {
*
* @return void
*/
function paintDocumentStart() {
public function paintDocumentStart() {
}
@ -194,7 +194,7 @@ class CakeBaseReporter extends SimpleReporter {
*
* @return void
*/
function paintDocumentEnd() {
public function paintDocumentEnd() {
}
@ -204,7 +204,7 @@ class CakeBaseReporter extends SimpleReporter {
*
* @return void
*/
function paintTestMenu() {
public function paintTestMenu() {
}
@ -213,7 +213,7 @@ class CakeBaseReporter extends SimpleReporter {
*
* @return string The base url for the request.
*/
function baseUrl() {
public function baseUrl() {
if (!empty($_SERVER['PHP_SELF'])) {
return $_SERVER['PHP_SELF'];
}

View file

@ -55,11 +55,11 @@ class CakeCliReporter extends CakeBaseReporter {
* @param array $params
* @return void
*/
function CakeCLIReporter($charset = 'utf-8', $params = array()) {
$this->CakeBaseReporter($charset, $params);
function __construct($charset = 'utf-8', $params = array()) {
parent::__construct($charset, $params);
}
function setFailDetailSeparator($separator) {
public function setFailDetailSeparator($separator) {
$this->separator = $separator;
}
@ -110,7 +110,7 @@ class CakeCliReporter extends CakeBaseReporter {
*
* @return string The string for the breadcrumb
*/
function _getBreadcrumb() {
protected function _getBreadcrumb() {
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
$out = "\n\tin " . implode("\n\tin ", array_reverse($breadcrumb));
@ -124,7 +124,7 @@ class CakeCliReporter extends CakeBaseReporter {
* @param string $message The message of the skip
* @return void
*/
function paintSkip($message) {
public function paintSkip($message) {
parent::paintSkip($message);
fwrite(STDOUT, 'SKIP' . $this->separator . $message . "\n\n");
}
@ -132,7 +132,7 @@ class CakeCliReporter extends CakeBaseReporter {
/**
* Paint a footer with test case name, timestamp, counts of fails and exceptions.
*/
function paintFooter($test_name) {
public function paintFooter($test_name) {
$buffer = $this->getTestCaseProgress() . '/' . $this->getTestCaseCount() . ' test cases complete: ';
if (0 < ($this->getFailCount() + $this->getExceptionCount())) {

View file

@ -48,7 +48,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
*
* @return void
*/
function paintDocumentStart() {
public function paintDocumentStart() {
ob_start();
$baseDir = $this->params['baseDir'];
include CAKE_TESTS_LIB . 'templates' . DS . 'header.php';
@ -60,7 +60,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
*
* @return void
*/
function paintTestMenu() {
public function paintTestMenu() {
$groups = $this->baseUrl() . '?show=groups';
$cases = $this->baseUrl() . '?show=cases';
$plugins = App::objects('plugin');
@ -73,7 +73,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
*
* @return void
*/
function testCaseList() {
public function testCaseList() {
$testCases = parent::testCaseList();
$app = $this->params['app'];
$plugin = $this->params['plugin'];
@ -107,7 +107,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
*
* @return void
*/
function groupTestList() {
public function groupTestList() {
$groupTests = parent::groupTestList();
$app = $this->params['app'];
$plugin = $this->params['plugin'];
@ -189,7 +189,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
*
* @return void
*/
function _paintLinks() {
protected function _paintLinks() {
$show = $query = array();
if (!empty($this->params['group'])) {
$show['show'] = 'groups';
@ -221,7 +221,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
* @param array $url Url hash to be converted
* @return string Converted url query string
*/
function _queryString($url) {
protected function _queryString($url) {
$out = '?';
$params = array();
foreach ($url as $key => $value) {
@ -236,7 +236,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
*
* @return void
*/
function paintDocumentEnd() {
public function paintDocumentEnd() {
$baseDir = $this->params['baseDir'];
include CAKE_TESTS_LIB . 'templates' . DS . 'footer.php';
ob_end_flush();

View file

@ -32,7 +32,7 @@ class CakeTextReporter extends CakeBaseReporter {
*
* @return void
*/
function paintDocumentStart() {
public function paintDocumentStart() {
if (!SimpleReporter::inCli()) {
header('Content-type: text/plain');
}
@ -161,7 +161,7 @@ class CakeTextReporter extends CakeBaseReporter {
*
* @return void
*/
function testCaseList() {
public function testCaseList() {
$testCases = parent::testCaseList();
$app = $this->params['app'];
$plugin = $this->params['plugin'];

View file

@ -63,7 +63,7 @@ class TestManager {
*
* @return void
*/
public function TestManager() {
public function __construct() {
$this->_installSimpleTest();
if (isset($_GET['app'])) {
$this->appTest = true;
@ -96,13 +96,13 @@ class TestManager {
* @return mixed
*/
public function runAllTests(&$reporter, $testing = false) {
$testCases =& $this->_getTestFileList($this->_getTestsPath());
$testCases = $this->_getTestFileList($this->_getTestsPath());
if ($this->appTest) {
$test =& new TestSuite(__('All App Tests', true));
$test = new TestSuite(__('All App Tests', true));
} else if ($this->pluginTest) {
$test =& new TestSuite(sprintf(__('All %s Plugin Tests', true), Inflector::humanize($this->pluginTest)));
$test = new TestSuite(sprintf(__('All %s Plugin Tests', true), Inflector::humanize($this->pluginTest)));
} else {
$test =& new TestSuite(__('All Core Tests', true));
$test = new TestSuite(__('All Core Tests', true));
}
if ($testing) {
@ -136,7 +136,7 @@ class TestManager {
return true;
}
$test =& new TestSuite(sprintf(__('Individual test case: %s', true), $testCaseFile));
$test = new TestSuite(sprintf(__('Individual test case: %s', true), $testCaseFile));
$test->addTestFile($testCaseFileWithPath);
return $test->run($reporter);
}
@ -156,7 +156,7 @@ class TestManager {
}
require_once $filePath;
$test =& new TestSuite(sprintf(__('%s group test', true), $groupTestName));
$test = new TestSuite(sprintf(__('%s group test', true), $groupTestName));
foreach ($this->_getGroupTestClassNames($filePath) as $groupTest) {
$testCase = new $groupTest();
$test->addTestCase($testCase);
@ -177,8 +177,8 @@ class TestManager {
* @static
*/
function addTestCasesFromDirectory(&$groupTest, $directory = '.') {
$manager =& new TestManager();
$testCases =& $manager->_getTestFileList($directory);
$manager = new TestManager();
$testCases = $manager->_getTestFileList($directory);
foreach ($testCases as $testCase) {
$groupTest->addTestFile($testCase);
}
@ -194,7 +194,7 @@ class TestManager {
* @static
*/
function addTestFile(&$groupTest, $file) {
$manager =& new TestManager();
$manager = new TestManager();
if (file_exists($file . $manager->_testExtension)) {
$file .= $manager->_testExtension;
@ -211,7 +211,7 @@ class TestManager {
* @static
*/
function &getTestCaseList() {
$manager =& new TestManager();
$manager = new TestManager();
$return = $manager->_getTestCaseList($manager->_getTestsPath());
return $return;
}
@ -222,7 +222,7 @@ class TestManager {
* @param string $directory Directory to get test case list from.
*/
protected function &_getTestCaseList($directory = '.') {
$fileList =& $this->_getTestFileList($directory);
$fileList = $this->_getTestFileList($directory);
$testCases = array();
foreach ($fileList as $testCaseFile) {
$testCases[$testCaseFile] = str_replace($directory . DS, '', $testCaseFile);
@ -247,7 +247,7 @@ class TestManager {
* @static
*/
function &getGroupTestList() {
$manager =& new TestManager();
$manager = new TestManager();
$return = $manager->_getTestGroupList($manager->_getTestsPath('groups'));
return $return;
}
@ -268,7 +268,7 @@ class TestManager {
* @param string $directory The directory to get group tests from.
*/
protected function &_getTestGroupList($directory = '.') {
$fileList =& $this->_getTestGroupFileList($directory);
$fileList = $this->_getTestGroupFileList($directory);
$groupTests = array();
foreach ($fileList as $groupTestFile) {