Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Commit

Permalink
A bit of code sniffer cleanup on the test tree.
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisLandry committed Oct 8, 2012
1 parent dd45eae commit f210190
Show file tree
Hide file tree
Showing 18 changed files with 623 additions and 564 deletions.
8 changes: 4 additions & 4 deletions tests/bootstrap.legacy.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* Joomla is assumed to include the /unittest/ directory. * Joomla is assumed to include the /unittest/ directory.
* eg, /path/to/joomla/unittest/ * eg, /path/to/joomla/unittest/
* *
* @package Joomla.UnitTest * @package Joomla.UnitTest
* *
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE * @license GNU General Public License version 2 or later; see LICENSE
* @link http://www.phpunit.de/manual/current/en/installation.html * @link http://www.phpunit.de/manual/current/en/installation.html
*/ */


define('_JEXEC', 1); define('_JEXEC', 1);
Expand Down
8 changes: 4 additions & 4 deletions tests/bootstrap.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* Joomla is assumed to include the /unittest/ directory. * Joomla is assumed to include the /unittest/ directory.
* eg, /path/to/joomla/unittest/ * eg, /path/to/joomla/unittest/
* *
* @package Joomla.UnitTest * @package Joomla.UnitTest
* *
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE * @license GNU General Public License version 2 or later; see LICENSE
* @link http://www.phpunit.de/manual/current/en/installation.html * @link http://www.phpunit.de/manual/current/en/installation.html
*/ */


define('_JEXEC', 1); define('_JEXEC', 1);
Expand Down
11 changes: 6 additions & 5 deletions tests/core/case/case.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ abstract class TestCase extends PHPUnit_Framework_TestCase
/** /**
* Receives the callback from JError and logs the required error information for the test. * Receives the callback from JError and logs the required error information for the test.
* *
* @param JException $error The JException object from JError * @param JException $error The JException object from JError
* *
* @return boolean To not continue with JError processing * @return boolean To not continue with JError processing
* *
Expand Down Expand Up @@ -116,7 +116,7 @@ public function assignMockReturns($mockObject, $array)
* If a test expects a JError to be raised, it should call this setExpectedError first * If a test expects a JError to be raised, it should call this setExpectedError first
* If you don't call this method first, the test will fail. * If you don't call this method first, the test will fail.
* *
* @param JException $error * @param JException $error The JException object from JError
* *
* @return JException * @return JException
* *
Expand Down Expand Up @@ -288,7 +288,7 @@ class_exists('JApplicationWeb');
* *
* If passed without argument, the array is initialized if it hsn't been already * If passed without argument, the array is initialized if it hsn't been already
* *
* @param mixed $error * @param mixed $error The JException object to expect.
* *
* @return void * @return void
* *
Expand Down Expand Up @@ -422,8 +422,9 @@ protected function setErrorHandlers($errorHandlers)
} }


/** /**
* Sets the JError error handlers to callback mode and points them at the test * Sets the JError error handlers to callback mode and points them at the test logging method.
* logging method. *
* @param string $testName The name of the test class for which to set the error callback method.
* *
* @return void * @return void
* *
Expand Down
7 changes: 4 additions & 3 deletions tests/core/case/database.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ abstract class TestCaseDatabase extends PHPUnit_Extensions_Database_TestCase
/** /**
* Receives the callback from JError and logs the required error information for the test. * Receives the callback from JError and logs the required error information for the test.
* *
* @param JException The JException object from JError * @param JException $error The JException object from JError
* *
* @return bool To not continue with JError processing * @return bool To not continue with JError processing
* *
Expand Down Expand Up @@ -459,8 +459,9 @@ protected function setErrorHandlers($errorHandlers)
} }


/** /**
* Sets the JError error handlers to callback mode and points them at the test * Sets the JError error handlers to callback mode and points them at the test logging method.
* logging method. *
* @param string $testName The name of the test class for which to set the error callback method.
* *
* @return void * @return void
* *
Expand Down
14 changes: 7 additions & 7 deletions tests/core/mock/cache.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ public static function create(TestCase $test, $data = array())
/** /**
* Callback for the cache get method. * Callback for the cache get method.
* *
* @param string $id The name of the cache key to retrieve. * @param string $id The name of the cache key to retrieve.
* *
* @return mixed The value of the key or null if it does not exist. * @return mixed The value of the key or null if it does not exist.
* *
* @since 12.1 * @since 12.1
*/ */
public function mockGet($id) public function mockGet($id)
{ {
Expand All @@ -82,12 +82,12 @@ public function mockGet($id)
/** /**
* Callback for the cache get method. * Callback for the cache get method.
* *
* @param string $key The name of the cache key. * @param string $value The value to store.
* @param string $group Dummy group. * @param string $id The name of the cache key.
* *
* @return mixed The value of the key or null if it does not exist. * @return mixed The value of the key or null if it does not exist.
* *
* @since 12.1 * @since 12.1
*/ */
public function mockStore($value, $id) public function mockStore($value, $id)
{ {
Expand Down
28 changes: 15 additions & 13 deletions tests/core/mock/database/driver.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class TestMockDatabaseDriver
/** /**
* Creates and instance of the mock JDatabase object. * Creates and instance of the mock JDatabase object.
* *
* @param object $test A test object. * @param object $test A test object.
* @param string $nullDate A null date string for the driver.
* @param string $dateFormat A date format for the driver.
* *
* @return object * @return object
* *
Expand Down Expand Up @@ -128,11 +130,11 @@ public static function create($test, $nullDate = '0000-00-00 00:00:00', $dateFor
/** /**
* Callback for the dbo setQuery method. * Callback for the dbo setQuery method.
* *
* @param string $new True to get a new query, false to get the last query. * @param boolean $new True to get a new query, false to get the last query.
* *
* @return void * @return void
* *
* @since 11.3 * @since 11.3
*/ */
public function mockGetQuery($new = false) public function mockGetQuery($new = false)
{ {
Expand All @@ -149,11 +151,11 @@ public function mockGetQuery($new = false)
/** /**
* Mocking the quote method. * Mocking the quote method.
* *
* @param string $value The value to be quoted. * @param string $value The value to be quoted.
* *
* @return string The value passed wrapped in MySQL quotes. * @return string The value passed wrapped in MySQL quotes.
* *
* @since 11.3 * @since 11.3
*/ */
public function mockQuote($value) public function mockQuote($value)
{ {
Expand All @@ -163,11 +165,11 @@ public function mockQuote($value)
/** /**
* Mock quoteName method. * Mock quoteName method.
* *
* @param string $value The value to be quoted. * @param string $value The value to be quoted.
* *
* @return string The value passed wrapped in MySQL quotes. * @return string The value passed wrapped in MySQL quotes.
* *
* @since 11.3 * @since 11.3
*/ */
public function mockQuoteName($value) public function mockQuoteName($value)
{ {
Expand All @@ -177,11 +179,11 @@ public function mockQuoteName($value)
/** /**
* Callback for the dbo setQuery method. * Callback for the dbo setQuery method.
* *
* @param string $query The query. * @param string $query The query.
* *
* @return void * @return void
* *
* @since 11.3 * @since 11.3
*/ */
public function mockSetQuery($query) public function mockSetQuery($query)
{ {
Expand Down
3 changes: 2 additions & 1 deletion tests/core/mock/dispatcher.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class TestMockDispatcher
/** /**
* Creates and instance of the mock JLanguage object. * Creates and instance of the mock JLanguage object.
* *
* @param object $test A test object. * @param object $test A test object.
* @param boolean $defaults True to create the default mock handlers and triggers.
* *
* @return object * @return object
* *
Expand Down
2 changes: 1 addition & 1 deletion tests/core/mock/document.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestMockDocument
/** /**
* Creates and instance of the mock JLanguage object. * Creates and instance of the mock JLanguage object.
* *
* @param object $test A test object. * @param object $test A test object.
* *
* @return object * @return object
* *
Expand Down
2 changes: 1 addition & 1 deletion tests/core/mock/language.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestMockLanguage
/** /**
* Creates and instance of the mock JLanguage object. * Creates and instance of the mock JLanguage object.
* *
* @param object $test A test object. * @param object $test A test object.
* *
* @return object * @return object
* *
Expand Down
5 changes: 3 additions & 2 deletions tests/core/mock/rules.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestMockRules
/** /**
* Creates an instance of the mock JDatabase object. * Creates an instance of the mock JDatabase object.
* *
* @param object $test A test object. * @param object $test A test object.
* *
* @return object * @return object
* *
Expand Down Expand Up @@ -55,7 +55,8 @@ public static function create($test)
/** /**
* Mocking the allow method. * Mocking the allow method.
* *
* @param string $action The action. * @param string $action The action.
* @param integer $identity The identity ID.
* *
* @return mixed Boolean or null. * @return mixed Boolean or null.
* *
Expand Down
16 changes: 8 additions & 8 deletions tests/core/reflection/reflection.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class TestReflection
/** /**
* Helper method that gets a protected or private property in a class by relfection. * Helper method that gets a protected or private property in a class by relfection.
* *
* @param object $object * @param object $object The object from which to return the property value.
* @param string $propertyName * @param string $propertyName The name of the property to return.
* *
* @return mixed The value of the property. * @return mixed The value of the property.
* *
Expand Down Expand Up @@ -57,8 +57,8 @@ public static function getValue($object, $propertyName)
* *
* $this->asserTrue(TestCase::invoke('methodName', $this->object, 123)); * $this->asserTrue(TestCase::invoke('methodName', $this->object, 123));
* *
* @param object $object * @param object $object The object on which to invoke the method.
* @param string $methodName * @param string $methodName The name of the method to invoke.
* *
* @return mixed * @return mixed
* *
Expand All @@ -84,9 +84,9 @@ public static function invoke($object, $methodName)
/** /**
* Helper method that sets a protected or private property in a class by relfection. * Helper method that sets a protected or private property in a class by relfection.
* *
* @param object $object * @param object $object The object for which to set the property.
* @param string $propertyName * @param string $propertyName The name of the property to set.
* @param mixed $value * @param mixed $value The value to set for the property.
* *
* @return void * @return void
* *
Expand All @@ -105,7 +105,7 @@ public static function setValue($object, $propertyName, $value)
$property->setValue($object, $value); $property->setValue($object, $value);
} }
// Hrm, maybe dealing with a private property in the parent class. // Hrm, maybe dealing with a private property in the parent class.
else if (get_parent_class($object)) elseif (get_parent_class($object))
{ {
$property = new \ReflectionProperty(get_parent_class($object), $propertyName); $property = new \ReflectionProperty(get_parent_class($object), $propertyName);
$property->setAccessible(true); $property->setAccessible(true);
Expand Down
Loading

0 comments on commit f210190

Please sign in to comment.