Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tests: fix whitespace, comments and phpDoc

  • Loading branch information...
commit 35c78289df2e87a6e7b852ab572bb529ae24f3ec 1 parent f2b9bb7
@dregad dregad authored
View
26 tests/Mantis/AllTests.php
@@ -15,35 +15,37 @@
# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package Tests
+ * MantisBT Core Unit Tests
+ * @package Tests
* @subpackage UnitTests
- * @copyright Copyright (C) 2002 - 2013 MantisBT Team - mantisbt-dev@lists.sourceforge.net
+ * @copyright Copyright (C) 2002 - 2013 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*/
+
/**
- * Test config
+ * Includes
*/
require_once dirname(__FILE__) . '/../TestConfig.php';
require_once 'EnumTest.php';
require_once 'StringTest.php';
+
/**
+ * All Test Cases
* @package Tests
* @subpackage UnitTests
- * @copyright Copyright (C) 2002 - 2013 MantisBT Team - mantisbt-dev@lists.sourceforge.net
- * @link http://www.mantisbt.org
*/
class Mantis_AllTests extends PHPUnit_Framework_TestSuite
{
- public static function suite()
- {
- $suite = new Mantis_AllTests('Main Code');
+ public static function suite()
+ {
+ $suite = new Mantis_AllTests('Main Code');
- $suite->addTestSuite('MantisEnumTest');
- $suite->addTestSuite('Mantis_StringTest');
+ $suite->addTestSuite('MantisEnumTest');
+ $suite->addTestSuite('Mantis_StringTest');
- return $suite;
- }
+ return $suite;
+ }
}
View
12 tests/Mantis/EnumTest.php
@@ -15,16 +15,22 @@
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package Tests
- * @subpackage UnitTests
+ * @package Tests
+ * @subpackage Enum
* @copyright Copyright (C) 2002 - 2013 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*/
+/**
+ * Includes
+ */
require_once 'MantisEnum.class.php';
+
/**
* Test cases for MantisEnum class.
+ * @package Tests
+ * @subpackage Enum
*/
class MantisEnumTest extends PHPUnit_Framework_TestCase {
const ACCESS_LEVELS_ENUM = '10:viewer,25:reporter,40:updater,55:developer,70:manager,90:administrator';
@@ -48,7 +54,7 @@ public function testGetLabel() {
$this->assertEquals( 'administrator', MantisEnum::getLabel( MantisEnumTest::ACCESS_LEVELS_ENUM, 90 ) );
$this->assertEquals( '@100@', MantisEnum::getLabel( MantisEnumTest::ACCESS_LEVELS_ENUM, 100 ) );
$this->assertEquals( '@-1@', MantisEnum::getLabel( MantisEnumTest::ACCESS_LEVELS_ENUM, -1 ) );
- $this->assertEquals( '@10@', MantisEnum::getLabel( MantisEnumTest::EMPTY_ENUM, 10 ) );
+ $this->assertEquals( '@10@', MantisEnum::getLabel( MantisEnumTest::EMPTY_ENUM, 10 ) );
}
/**
View
79 tests/Mantis/StringTest.php
@@ -15,47 +15,51 @@
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package Tests
+ * @package Tests
* @subpackage String
* @copyright Copyright (C) 2002 - 2013 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*/
+
+/**
+ * String API tests
+ * @package Tests
+ * @subpackage String
+ */
class Mantis_StringTest extends PHPUnit_Framework_TestCase {
- /**
- * Tests string_sanitize_url()
- *
- * @dataProvider provider
- */
- public function testStringSanitize( $in, $out )
- {
- $a = string_do_sanitize_url($in, false);
- $this->assertEquals( $out, $a );
- }
-
- public function provider()
- {
- $testStrings = array(
- array( '', 'index.php' ),
- array( 'abc.php', 'abc.php' ),
- array( 'abc.php?','abc.php'),
- array( 'abc.php#a','abc.php#a'),
- array( 'abc.php?abc=def','abc.php?abc=def'),
- array( 'abc.php?abc=def#a','abc.php?abc=def#a'),
- array( 'abc.php?abc=def&z=xyz','abc.php?abc=def&amp;z=xyz'),
- array( 'abc.php?abc=def&amp;z=xyz','abc.php?abc=def&amp;z=xyz'),
- array( 'abc.php?abc=def&z=xyz#a','abc.php?abc=def&amp;z=xyz#a'),
- array( 'abc.php?abc=def&amp;z=xyz#a','abc.php?abc=def&amp;z=xyz#a'),
-/* FIXME array( 'abc.php?abc=def&z=<script>alert("foo")</script>z#a','abc.php?abc=def&amp;z=alert%28%22foo%29%22%3cz#a'), */
-/* FIXME array( 'abc.php?abc=def&z=z#<script>alert("foo")</script>a','abc.php?abc=def&amp;z=z#alert%28%22foo%22%3ca'), */
- array( 'plugin.php?page=Source/index','plugin.php?page=Source%2Findex'),
- array( 'plugin.php?page=Source/list&id=1','plugin.php?page=Source%2Flist&amp;id=1'),
- array( 'plugin.php?page=Source/list&id=1#abc','plugin.php?page=Source%2Flist&amp;id=1#abc'),
- );
-
- /*
- FIXME
+ /**
+ * Tests string_sanitize_url()
+ * @dataProvider provider
+ */
+ public function testStringSanitize( $in, $out )
+ {
+ $a = string_do_sanitize_url($in, false);
+ $this->assertEquals( $out, $a );
+ }
+
+ public function provider()
+ {
+ $testStrings = array(
+ array( '', 'index.php' ),
+ array( 'abc.php', 'abc.php' ),
+ array( 'abc.php?', 'abc.php'),
+ array( 'abc.php#a', 'abc.php#a'),
+ array( 'abc.php?abc=def', 'abc.php?abc=def'),
+ array( 'abc.php?abc=def#a', 'abc.php?abc=def#a'),
+ array( 'abc.php?abc=def&z=xyz', 'abc.php?abc=def&amp;z=xyz'),
+ array( 'abc.php?abc=def&amp;z=xyz', 'abc.php?abc=def&amp;z=xyz'),
+ array( 'abc.php?abc=def&z=xyz#a', 'abc.php?abc=def&amp;z=xyz#a'),
+ array( 'abc.php?abc=def&amp;z=xyz#a', 'abc.php?abc=def&amp;z=xyz#a'),
+# @FIXME array( 'abc.php?abc=def&z=<script>alert("foo")</script>z#a', 'abc.php?abc=def&amp;z=alert%28%22foo%29%22%3cz#a'),
+# @FIXME array( 'abc.php?abc=def&z=z#<script>alert("foo")</script>a', 'abc.php?abc=def&amp;z=z#alert%28%22foo%22%3ca'),
+ array( 'plugin.php?page=Source/index', 'plugin.php?page=Source%2Findex'),
+ array( 'plugin.php?page=Source/list&id=1', 'plugin.php?page=Source%2Flist&amp;id=1'),
+ array( 'plugin.php?page=Source/list&id=1#abc', 'plugin.php?page=Source%2Flist&amp;id=1#abc'),
+ );
+
+ /* @FIXME
array( $my_path.'abc.php',
array( $my_path.'abc.php?',
array( $my_path.'abc.php#a',
@@ -72,13 +76,13 @@ public function provider()
array( $my_path.'plugin.php?page=Source/list&id=1#abc',
array( 'http://www.test.my.url/'),
*/
- return $testStrings;
- }
+ return $testStrings;
+ }
}
-// FIXME: hardcoced here to avoid external dependencies, should use code in string_api.php
+# @FIXME: hardcoced here to avoid external dependencies, should use code in string_api.php
function string_do_sanitize_url( $p_url, $p_return_absolute = false ) {
$t_url = strip_tags( urldecode( $p_url ) );
@@ -137,4 +141,3 @@ function string_do_sanitize_url( $p_url, $p_return_absolute = false ) {
return ( !empty( $t_script_path ) ? $t_script_path . '/' : '' ) . $t_script . $t_query . $t_anchor;
}
}
-
View
40 tests/TestConfig.php
@@ -18,7 +18,7 @@
* @package Tests
* @subpackage UnitTests
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
- * @copyright Copyright (C) 2002 - 2013 MantisBT Team - mantisbt-dev@lists.sourceforge.net
+ * @copyright Copyright (C) 2002 - 2013 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*/
@@ -27,40 +27,32 @@
*/
ob_start();
-/*
- * Include PHPUnit dependencies ; insure compatibility with 3.5 and 3.6
+/**
+ * Include PHPUnit dependencies ; ensure compatibility with 3.5 and 3.6
*/
@include_once 'PHPUnit/Framework.php';
-/*
- * Set error reporting to the level to which Zend Framework code must comply.
- */
+
+
+# Set error reporting to the level to which Zend Framework code must comply.
error_reporting( E_ALL | E_STRICT );
-/*
- * Determine the root, library, and tests directories of the framework
- * distribution.
- */
-$mantisRoot = dirname(__FILE__) . '/..';
+# Determine the root, library, and tests directories of the framework
+# distribution.
+$mantisRoot = dirname( dirname(__FILE__) );
$mantisCore = "$mantisRoot/core";
$mantisLibrary = "$mantisRoot/library";
$mantisClasses = "$mantisRoot/core/classes";
$mantisTests = "$mantisRoot/tests";
-/*
- * Prepend the application/ and tests/ directories to the
- * include_path.
- */
+# Prepend the application/ and tests/ directories to the include_path.
$path = array(
- $mantisCore,
- $mantisLibrary,
- $mantisClasses,
- get_include_path()
- );
+ $mantisCore,
+ $mantisLibrary,
+ $mantisClasses,
+ get_include_path()
+);
set_include_path( implode( PATH_SEPARATOR, $path ) );
-
-/*
- * Unset global variables that are no longer needed.
- */
+# Unset global variables that are no longer needed.
unset($mantisRoot, $mantisLibrary, $mantisTests, $path);
Please sign in to comment.
Something went wrong with that request. Please try again.