Skip to content
This repository
Browse code

Moving the legacy tests into their own suite.

  • Loading branch information...
commit b6db641a1de819f8cac7a4b2cf44a9aadfdd19cf 1 parent d26a419
Louis Landry authored April 02, 2012

Showing 37 changed files with 298 additions and 178 deletions. Show diff stats Hide diff stats

  1. 200  build.xml
  2. 29  legacy.xml.dist
  3. 30  phpunit.xml.dist
  4. 70  tests/bootstrap.legacy.php
  5. 2  tests/bootstrap.php
  6. 48  tests/core/case/case.php
  7. 53  tests/core/case/database.php
  8. 0  tests/suites/{unit → }/legacy/application/JApplicationHelperTest.php
  9. 0  tests/suites/{unit → }/legacy/application/JApplicationTest.php
  10. 0  tests/suites/{unit → }/legacy/categories/JCategoriesTest.php
  11. 0  tests/suites/{unit → }/legacy/categories/JCategoryNodeTest.php
  12. 0  tests/suites/{unit → }/legacy/error/JErrorInspector.php
  13. 0  tests/suites/{unit → }/legacy/error/JErrorTest.php
  14. 0  tests/suites/{unit → }/legacy/exception/JExceptionTest.php
  15. 12  tests/suites/{unit → }/legacy/form/field/JFormFieldHelpsiteTest.php
  16. 11  tests/suites/{unit → }/legacy/form/field/JFormFieldMediaTest.php
  17. 8  tests/suites/{unit → }/legacy/form/field/JFormFieldTemplateStyleTest.php
  18. 11  tests/suites/{unit → }/legacy/form/field/JFormFieldUserTest.php
  19. 0  tests/suites/{unit → }/legacy/menu/JMenuTest.php
  20. 0  tests/suites/{unit → }/legacy/pathway/JPathwayTest.php
  21. 0  tests/suites/{unit → }/legacy/pathway/stubs/includes/pathway.php
  22. 0  tests/suites/{unit → }/legacy/request/JFilterInput-mock-general.php
  23. 0  tests/suites/{unit → }/legacy/request/JRequest-helper-dataset.php
  24. 0  tests/suites/{unit → }/legacy/request/JRequestGetVarTest.php
  25. 0  tests/suites/{unit → }/legacy/request/JRequestGetmethodTest.php
  26. 0  tests/suites/{unit → }/legacy/request/JRequestTest.php
  27. 2  tests/suites/{unit → }/legacy/table/JTableContentTest.php
  28. 0  tests/suites/{unit → }/legacy/table/stubs/jos_content.csv
  29. 0  tests/suites/{unit → }/legacy/toolbar/JToolbarButtonTest.php
  30. 0  tests/suites/{unit → }/legacy/toolbar/JToolbarTest.php
  31. 0  tests/suites/{unit → }/legacy/toolbar/button/JButtonConfirmTest.php
  32. 0  tests/suites/{unit → }/legacy/toolbar/button/JButtonCustomTest.php
  33. 0  tests/suites/{unit → }/legacy/toolbar/button/JButtonHelpTest.php
  34. 0  tests/suites/{unit → }/legacy/toolbar/button/JButtonLinkTest.php
  35. 0  tests/suites/{unit → }/legacy/toolbar/button/JButtonPopupTest.php
  36. 0  tests/suites/{unit → }/legacy/toolbar/button/JButtonSeparatorTest.php
  37. 0  tests/suites/{unit → }/legacy/toolbar/button/JButtonStandardTest.php
200  build.xml
... ...
@@ -1,118 +1,114 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 
3 3
 <project name="joomla-platform" default="build" basedir=".">
4  
- <property name="source" value="libraries"/>
5  
- <property name="joomlasource" value="libraries/joomla,libraries/platform.php,libraries/loader.php,libraries/import.php"/>
  4
+	<property name="source" value="libraries" />
  5
+	<property name="joomlasource" value="libraries/joomla,libraries/platform.php,libraries/loader.php,libraries/import.php" />
6 6
 
7  
- <target name="clean"
8  
-         description="Clean up and create artifact directories">
9  
-  <delete dir="${basedir}/build/api"/>
10  
-  <delete dir="${basedir}/build/code-browser"/>
11  
-  <delete dir="${basedir}/build/coverage"/>
12  
-  <delete dir="${basedir}/build/logs"/>
13  
-  <delete dir="${basedir}/build/pdepend"/>
  7
+	<target name="clean" description="Clean up and create artifact directories">
  8
+		<delete dir="${basedir}/build/api" />
  9
+		<delete dir="${basedir}/build/code-browser" />
  10
+		<delete dir="${basedir}/build/coverage" />
  11
+		<delete dir="${basedir}/build/logs" />
  12
+		<delete dir="${basedir}/build/pdepend" />
14 13
 
15  
-  <mkdir dir="${basedir}/build/api"/>
16  
-  <mkdir dir="${basedir}/build/code-browser"/>
17  
-  <mkdir dir="${basedir}/build/coverage"/>
18  
-  <mkdir dir="${basedir}/build/logs"/>
19  
-  <mkdir dir="${basedir}/build/pdepend"/>
20  
- </target>
  14
+		<mkdir dir="${basedir}/build/api" />
  15
+		<mkdir dir="${basedir}/build/code-browser" />
  16
+		<mkdir dir="${basedir}/build/coverage" />
  17
+		<mkdir dir="${basedir}/build/logs" />
  18
+		<mkdir dir="${basedir}/build/pdepend" />
  19
+	</target>
21 20
 
22  
- <target name="phpunit"
23  
-         description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
24  
-  <exec executable="phpunit"/>
25  
- </target>
  21
+	<target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
  22
+		<exec executable="phpunit" />
  23
+	</target>
26 24
 
27  
- <target name="parallelTasks"
28  
-         description="Run the pdepend, phpmd, phpcpd, phpcs, phpdoc and phploc tasks in parallel using a maximum of 2 threads.">
29  
-  <parallel threadCount="2">
30  
-   <sequential>
31  
-    <antcall target="pdepend"/>
32  
-    <antcall target="phpmd"/>
33  
-   </sequential>
34  
-   <antcall target="phpcpd"/>
35  
-   <antcall target="phpcs"/>
36  
-   <antcall target="phpdoc"/>
37  
-   <antcall target="phploc"/>
38  
-  </parallel>
39  
- </target>
  25
+	<target name="phpunit-legacy" description="Run legacy tests using PHPUnit and generates junit.legacy.xml and clover.legacy.xml">
  26
+		<exec executable="phpunit">
  27
+			<arg value="-c legacy.xml.dist" />
  28
+		</exec>
  29
+	</target>
40 30
 
41  
- <target name="pdepend"
42  
-         description="Generate jdepend.xml and software metrics charts using PHP_Depend">
43  
-  <exec executable="pdepend">
44  
-   <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
45  
-   <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
46  
-   <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
47  
-   <arg path="${source}" />
48  
-  </exec>
49  
- </target>
  31
+	<target name="parallelTasks" description="Run the pdepend, phpmd, phpcpd, phpcs, phpdoc and phploc tasks in parallel using a maximum of 2 threads.">
  32
+		<parallel threadCount="2">
  33
+			<sequential>
  34
+				<antcall target="pdepend" />
  35
+				<antcall target="phpmd" />
  36
+			</sequential>
  37
+			<antcall target="phpcpd" />
  38
+			<antcall target="phpcs" />
  39
+			<antcall target="phpdoc" />
  40
+			<antcall target="phploc" />
  41
+		</parallel>
  42
+	</target>
50 43
 
51  
- <target name="phpmd"
52  
-         description="Generate pmd.xml using PHPMD">
53  
-  <exec executable="phpmd">
54  
-   <arg path="${joomlasource}" />
55  
-   <arg value="xml" />
56  
-   <arg value="${basedir}/build/phpmd.xml" />
57  
-   <arg value="--reportfile" />
58  
-   <arg value="${basedir}/build/logs/pmd.xml" />
59  
-  </exec>
60  
- </target>
  44
+	<target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
  45
+		<exec executable="pdepend">
  46
+			<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
  47
+			<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
  48
+			<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
  49
+			<arg path="${source}" />
  50
+		</exec>
  51
+	</target>
61 52
 
62  
- <target name="phpcpd"
63  
-         description="Generate pmd-cpd.xml using PHPCPD">
64  
-  <exec executable="phpcpd">
65  
-   <arg value="--log-pmd" />
66  
-   <arg value="${basedir}/build/logs/pmd-cpd.xml" />
67  
-   <arg path="${source}/joomla" />
68  
-  </exec>
69  
- </target>
  53
+	<target name="phpmd" description="Generate pmd.xml using PHPMD">
  54
+		<exec executable="phpmd">
  55
+			<arg path="${joomlasource}" />
  56
+			<arg value="xml" />
  57
+			<arg value="${basedir}/build/phpmd.xml" />
  58
+			<arg value="--reportfile" />
  59
+			<arg value="${basedir}/build/logs/pmd.xml" />
  60
+		</exec>
  61
+	</target>
70 62
 
71  
- <target name="phploc"
72  
-         description="Generate phploc.csv">
73  
-  <exec executable="phploc">
74  
-   <arg value="--log-csv" />
75  
-   <arg value="${basedir}/build/logs/phploc.csv" />
76  
-   <arg path="${source}/joomla" />
77  
-  </exec>
78  
- </target>
  63
+	<target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD">
  64
+		<exec executable="phpcpd">
  65
+			<arg value="--log-pmd" />
  66
+			<arg value="${basedir}/build/logs/pmd-cpd.xml" />
  67
+			<arg path="${source}/joomla" />
  68
+		</exec>
  69
+	</target>
79 70
 
80  
- <target name="phpcs"
81  
-         description="Generate checkstyle.xml using PHP_CodeSniffer">
82  
-  <exec executable="phpcs">
83  
-   <arg value="--report=checkstyle" />
84  
-   <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
85  
-   <arg value="--standard=${basedir}/build/phpcs/Joomla" />
86  
-   <arg value="--ignore=${source}/phpmailer,${source}/phputf8,${source}/simplepie/,${source}/config.example.php" />
87  
-   <arg path="${source}" />
88  
-  </exec>
89  
- </target>
  71
+	<target name="phploc" description="Generate phploc.csv">
  72
+		<exec executable="phploc">
  73
+			<arg value="--log-csv" />
  74
+			<arg value="${basedir}/build/logs/phploc.csv" />
  75
+			<arg path="${source}/joomla" />
  76
+		</exec>
  77
+	</target>
90 78
 
91  
- <target name="phpdoc"
92  
-         description="Generate API documentation using PHPDocumentor">
93  
-  <exec executable="phpdox">
94  
-   <arg value="-c" />
95  
-   <arg path="${source}" />
96  
-   <arg value="-d" />
97  
-   <arg path="${basedir}/build/api" />
98  
-   <arg value="-x" />
99  
-   <arg path="${basedir}/build/docs" />
100  
-   <arg value="-g" />
101  
-   <arg value="html" />
102  
-  </exec>
103  
- </target>
  79
+	<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer">
  80
+		<exec executable="phpcs">
  81
+			<arg value="--report=checkstyle" />
  82
+			<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
  83
+			<arg value="--standard=${basedir}/build/phpcs/Joomla" />
  84
+			<arg value="--ignore=${source}/phpmailer,${source}/phputf8,${source}/simplepie/,${source}/config.example.php" />
  85
+			<arg path="${source}" />
  86
+		</exec>
  87
+	</target>
104 88
 
105  
- <target name="phpcb"
106  
-         description="Aggregate tool output with PHP_CodeBrowser">
107  
-  <exec executable="phpcb">
108  
-   <arg value="--log" />
109  
-   <arg path="${basedir}/build/logs" />
110  
-   <arg value="--source" />
111  
-   <arg path="${source}" />
112  
-   <arg value="--output" />
113  
-   <arg path="${basedir}/build/code-browser" />
114  
-  </exec>
115  
- </target>
  89
+	<target name="phpdoc" description="Generate API documentation using PHPDocumentor">
  90
+		<exec executable="phpdox">
  91
+			<arg value="-c" />
  92
+			<arg path="${source}" />
  93
+			<arg value="-d" />
  94
+			<arg path="${basedir}/build/api" />
  95
+			<arg value="-x" />
  96
+			<arg path="${basedir}/build/docs" />
  97
+			<arg value="-g" />
  98
+			<arg value="html" />
  99
+		</exec>
  100
+	</target>
116 101
 
117  
- <target name="build" depends="clean,parallelTasks,phpunit,phpcb"/>
  102
+	<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
  103
+		<exec executable="phpcb">
  104
+			<arg value="--log" />
  105
+			<arg path="${basedir}/build/logs" />
  106
+			<arg value="--source" />
  107
+			<arg path="${source}" />
  108
+			<arg value="--output" />
  109
+			<arg path="${basedir}/build/code-browser" />
  110
+		</exec>
  111
+	</target>
  112
+
  113
+	<target name="build" depends="clean,phpunit,phpunit-legacy,parallelTasks,phpcb" />
118 114
 </project>
29  legacy.xml.dist
... ...
@@ -0,0 +1,29 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<phpunit bootstrap="tests/bootstrap.legacy.php" colors="false">
  3
+	<!-- These constants help setup environment configurations for running optional tests.
  4
+	<php>
  5
+		<const name="JTEST_DATABASE_MYSQL_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
  6
+		<const name="JTEST_DATABASE_MYSQLI_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
  7
+		<const name="JTEST_DATABASE_POSTGRESQL_DSN" value="host=localhost;port=5432;dbname=joomla_ut;user=utuser;pass=ut1234" />
  8
+		<const name="JTEST_HTTP_STUB" value="http://localhost/joomla-platform/tests/suites/unit/stubs/jhttp_stub.php" />
  9
+	</php>
  10
+	-->
  11
+
  12
+	<testsuites>
  13
+		<testsuite name="Legacy">
  14
+			<directory>tests/suites/legacy</directory>
  15
+		</testsuite>
  16
+	</testsuites>
  17
+
  18
+	<logging>
  19
+		<log type="coverage-html" target="build/coverage-legacy" title="Joomla-Platform-Legacy" charset="UTF-8" yui="true" highlight="true"
  20
+			lowUpperBound="35" highLowerBound="70" />
  21
+		<log type="coverage-clover" target="build/logs/clover.legacy.xml" />
  22
+		<log type="junit" target="build/logs/junit.legacy.xml" logIncompleteSkipped="false" />
  23
+	</logging>
  24
+	<filter>
  25
+		<whitelist addUncoveredFilesFromWhitelist="false">
  26
+			<directory suffix=".php">libraries/legacy</directory>
  27
+		</whitelist>
  28
+	</filter>
  29
+</phpunit>
30  phpunit.xml.dist
... ...
@@ -1,30 +1,32 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2  
-
3 2
 <phpunit bootstrap="tests/bootstrap.php" colors="false">
4  
-
5  
-	<!-- <php>
  3
+	<!-- These constants help setup environment configurations for running optional tests.
  4
+	<php>
6 5
 		<const name="JTEST_DATABASE_MYSQL_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
7 6
 		<const name="JTEST_DATABASE_MYSQLI_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
8 7
 		<const name="JTEST_DATABASE_POSTGRESQL_DSN" value="host=localhost;port=5432;dbname=joomla_ut;user=utuser;pass=ut1234" />
9 8
 		<const name="JTEST_HTTP_STUB" value="http://localhost/joomla-platform/tests/suites/unit/stubs/jhttp_stub.php" />
10  
-	</php> -->
  9
+	</php>
  10
+	-->
11 11
 
12  
-	<testsuite name="AllTests">
13  
-		<directory>tests/suites</directory>
14  
-	</testsuite>
  12
+	<testsuites>
  13
+		<testsuite name="Database">
  14
+			<directory>tests/suites/database</directory>
  15
+		</testsuite>
  16
+		<testsuite name="Unit">
  17
+			<directory>tests/suites/unit</directory>
  18
+		</testsuite>
  19
+	</testsuites>
15 20
 
16 21
 	<logging>
17  
-		<log type="coverage-html" target="build/coverage" title="Joomla-Platform"
18  
-			charset="UTF-8" yui="true" highlight="true" lowUpperBound="35"
19  
-			highLowerBound="70" />
  22
+		<log type="coverage-html" target="build/coverage" title="Joomla-Platform" charset="UTF-8" yui="true" highlight="true"
  23
+			lowUpperBound="35" highLowerBound="70" />
20 24
 		<log type="coverage-clover" target="build/logs/clover.xml" />
21  
-		<log type="junit" target="build/logs/junit.xml"
22  
-			logIncompleteSkipped="false" />
  25
+		<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false" />
23 26
 	</logging>
24 27
 	<filter>
25  
-		<whitelist addUncoveredFilesFromWhitelist="false">
  28
+		<whitelist addUncoveredFilesFromWhitelist="true">
26 29
 			<directory suffix=".php">libraries/joomla</directory>
27  
-			<directory suffix=".php">libraries/legacy</directory>
28 30
 			<file>libraries/import.php</file>
29 31
 			<file>libraries/loader.php</file>
30 32
 			<file>libraries/platform.php</file>
70  tests/bootstrap.legacy.php
... ...
@@ -0,0 +1,70 @@
  1
+<?php
  2
+/**
  3
+ * Prepares a minimalist framework for unit testing.
  4
+ *
  5
+ * Joomla is assumed to include the /unittest/ directory.
  6
+ * eg, /path/to/joomla/unittest/
  7
+ *
  8
+ * @package     Joomla.UnitTest
  9
+ *
  10
+ * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
  11
+ * @license     GNU General Public License version 2 or later; see LICENSE
  12
+ * @link        http://www.phpunit.de/manual/current/en/installation.html
  13
+ */
  14
+
  15
+define('_JEXEC', 1);
  16
+
  17
+// Fix magic quotes.
  18
+@ini_set('magic_quotes_runtime', 0);
  19
+
  20
+// Maximise error reporting.
  21
+@ini_set('zend.ze1_compatibility_mode', '0');
  22
+error_reporting(E_ALL);
  23
+ini_set('display_errors', 1);
  24
+
  25
+/*
  26
+ * Ensure that required path constants are defined.  These can be overridden within the phpunit.xml file
  27
+ * if you chose to create a custom version of that file.
  28
+ */
  29
+if (!defined('JPATH_TESTS'))
  30
+{
  31
+	define('JPATH_TESTS', realpath(__DIR__));
  32
+}
  33
+if (!defined('JPATH_PLATFORM'))
  34
+{
  35
+	define('JPATH_PLATFORM', realpath(dirname(JPATH_TESTS) . '/libraries'));
  36
+}
  37
+if (!defined('JPATH_BASE'))
  38
+{
  39
+	define('JPATH_BASE', realpath(JPATH_TESTS . '/tmp'));
  40
+}
  41
+if (!defined('JPATH_ROOT'))
  42
+{
  43
+	define('JPATH_ROOT', realpath(JPATH_BASE));
  44
+}
  45
+if (!defined('JPATH_CACHE'))
  46
+{
  47
+	define('JPATH_CACHE', JPATH_BASE . '/cache');
  48
+}
  49
+if (!defined('JPATH_CONFIGURATION'))
  50
+{
  51
+	define('JPATH_CONFIGURATION', JPATH_BASE);
  52
+}
  53
+if (!defined('JPATH_MANIFESTS'))
  54
+{
  55
+	define('JPATH_MANIFESTS', JPATH_BASE . '/manifests');
  56
+}
  57
+if (!defined('JPATH_PLUGINS'))
  58
+{
  59
+	define('JPATH_PLUGINS', JPATH_BASE . '/plugins');
  60
+}
  61
+if (!defined('JPATH_THEMES'))
  62
+{
  63
+	define('JPATH_THEMES', JPATH_BASE . '/themes');
  64
+}
  65
+
  66
+// Import the platform.
  67
+require_once JPATH_PLATFORM . '/import.legacy.php';
  68
+
  69
+// Register the core Joomla test classes.
  70
+JLoader::registerPrefix('Test', __DIR__ . '/core');
2  tests/bootstrap.php
@@ -64,7 +64,7 @@
64 64
 }
65 65
 
66 66
 // Import the platform.
67  
-require_once JPATH_PLATFORM . '/import.legacy.php';
  67
+require_once JPATH_PLATFORM . '/import.php';
68 68
 
69 69
 // Register the core Joomla test classes.
70 70
 JLoader::registerPrefix('Test', __DIR__ . '/core');
48  tests/core/case/case.php
@@ -300,9 +300,14 @@ public function setExpectedError($error = null)
300 300
 		if (!is_array($this->expectedErrors))
301 301
 		{
302 302
 			$this->expectedErrors = array();
303  
-			JError::setErrorHandling(E_NOTICE, 'callback', array($this, 'expectedErrorCallback'));
304  
-			JError::setErrorHandling(E_WARNING, 'callback', array($this, 'expectedErrorCallback'));
305  
-			JError::setErrorHandling(E_ERROR, 'callback', array($this, 'expectedErrorCallback'));
  303
+
  304
+			// Handle optional usage of JError until removed.
  305
+			if (class_exists('JError'))
  306
+			{
  307
+				JError::setErrorHandling(E_NOTICE, 'callback', array($this, 'expectedErrorCallback'));
  308
+				JError::setErrorHandling(E_WARNING, 'callback', array($this, 'expectedErrorCallback'));
  309
+				JError::setErrorHandling(E_ERROR, 'callback', array($this, 'expectedErrorCallback'));
  310
+			}
306 311
 		}
307 312
 
308 313
 		if (!is_null($error))
@@ -354,9 +359,14 @@ protected function restoreFactoryState()
354 359
 	protected function saveErrorHandlers()
355 360
 	{
356 361
 		$this->_stashedErrorState = array();
357  
-		$this->_stashedErrorState[E_NOTICE] = JError::getErrorHandling(E_NOTICE);
358  
-		$this->_stashedErrorState[E_WARNING] = JError::getErrorHandling(E_WARNING);
359  
-		$this->_stashedErrorState[E_ERROR] = JError::getErrorHandling(E_ERROR);
  362
+
  363
+		// Handle optional usage of JError until removed.
  364
+		if (class_exists('JError'))
  365
+		{
  366
+			$this->_stashedErrorState[E_NOTICE] = JError::getErrorHandling(E_NOTICE);
  367
+			$this->_stashedErrorState[E_WARNING] = JError::getErrorHandling(E_WARNING);
  368
+			$this->_stashedErrorState[E_ERROR] = JError::getErrorHandling(E_ERROR);
  369
+		}
360 370
 	}
361 371
 
362 372
 	/**
@@ -396,13 +406,17 @@ protected function setErrorHandlers($errorHandlers)
396 406
 		{
397 407
 			$mode = $params['mode'];
398 408
 
399  
-			if (isset($params['options']))
  409
+			// Handle optional usage of JError until removed.
  410
+			if (class_exists('JError'))
400 411
 			{
401  
-				JError::setErrorHandling($type, $mode, $params['options']);
402  
-			}
403  
-			else
404  
-			{
405  
-				JError::setErrorHandling($type, $mode);
  412
+				if (isset($params['options']))
  413
+				{
  414
+					JError::setErrorHandling($type, $mode, $params['options']);
  415
+				}
  416
+				else
  417
+				{
  418
+					JError::setErrorHandling($type, $mode);
  419
+				}
406 420
 			}
407 421
 		}
408 422
 	}
@@ -456,9 +470,13 @@ protected function tearDown()
456 470
 			$this->fail('An expected error was not raised.');
457 471
 		}
458 472
 
459  
-		JError::setErrorHandling(E_NOTICE, 'ignore');
460  
-		JError::setErrorHandling(E_WARNING, 'ignore');
461  
-		JError::setErrorHandling(E_ERROR, 'ignore');
  473
+		// Handle optional usage of JError until removed.
  474
+		if (class_exists('JError'))
  475
+		{
  476
+			JError::setErrorHandling(E_NOTICE, 'ignore');
  477
+			JError::setErrorHandling(E_WARNING, 'ignore');
  478
+			JError::setErrorHandling(E_ERROR, 'ignore');
  479
+		}
462 480
 
463 481
 		parent::tearDown();
464 482
 	}
53  tests/core/case/database.php
@@ -389,9 +389,14 @@ protected function restoreFactoryState()
389 389
 	protected function saveErrorHandlers()
390 390
 	{
391 391
 		$this->_stashedErrorState = array();
392  
-		$this->_stashedErrorState[E_NOTICE] = JError::getErrorHandling(E_NOTICE);
393  
-		$this->_stashedErrorState[E_WARNING] = JError::getErrorHandling(E_WARNING);
394  
-		$this->_stashedErrorState[E_ERROR] = JError::getErrorHandling(E_ERROR);
  392
+
  393
+		// Handle optional usage of JError until removed.
  394
+		if (class_exists('JError'))
  395
+		{
  396
+			$this->_stashedErrorState[E_NOTICE] = JError::getErrorHandling(E_NOTICE);
  397
+			$this->_stashedErrorState[E_WARNING] = JError::getErrorHandling(E_WARNING);
  398
+			$this->_stashedErrorState[E_ERROR] = JError::getErrorHandling(E_ERROR);
  399
+		}
395 400
 	}
396 401
 
397 402
 	/**
@@ -431,13 +436,17 @@ protected function setErrorHandlers($errorHandlers)
431 436
 		{
432 437
 			$mode = $params['mode'];
433 438
 
434  
-			if (isset($params['options']))
435  
-			{
436  
-				JError::setErrorHandling($type, $mode, $params['options']);
437  
-			}
438  
-			else
  439
+			// Handle optional usage of JError until removed.
  440
+			if (class_exists('JError'))
439 441
 			{
440  
-				JError::setErrorHandling($type, $mode);
  442
+				if (isset($params['options']))
  443
+				{
  444
+					JError::setErrorHandling($type, $mode, $params['options']);
  445
+				}
  446
+				else
  447
+				{
  448
+					JError::setErrorHandling($type, $mode);
  449
+				}
441 450
 			}
442 451
 		}
443 452
 	}
@@ -479,4 +488,30 @@ protected function setUp()
479 488
 
480 489
 		parent::setUp();
481 490
 	}
  491
+
  492
+	/**
  493
+	 * Overrides the parent tearDown method.
  494
+	 *
  495
+	 * @return  void
  496
+	 *
  497
+	 * @see     PHPUnit_Framework_TestCase::tearDown()
  498
+	 * @since   11.1
  499
+	 */
  500
+	protected function tearDown()
  501
+	{
  502
+		if (is_array($this->expectedErrors) && !empty($this->expectedErrors))
  503
+		{
  504
+			$this->fail('An expected error was not raised.');
  505
+		}
  506
+
  507
+		// Handle optional usage of JError until removed.
  508
+		if (class_exists('JError'))
  509
+		{
  510
+			JError::setErrorHandling(E_NOTICE, 'ignore');
  511
+			JError::setErrorHandling(E_WARNING, 'ignore');
  512
+			JError::setErrorHandling(E_ERROR, 'ignore');
  513
+		}
  514
+
  515
+		parent::tearDown();
  516
+	}
482 517
 }
0  ...nit/legacy/application/JApplicationHelperTest.php → ...tes/legacy/application/JApplicationHelperTest.php
File renamed without changes
0  ...ites/unit/legacy/application/JApplicationTest.php → tests/suites/legacy/application/JApplicationTest.php
File renamed without changes
0  ...suites/unit/legacy/categories/JCategoriesTest.php → tests/suites/legacy/categories/JCategoriesTest.php
File renamed without changes
0  ...ites/unit/legacy/categories/JCategoryNodeTest.php → tests/suites/legacy/categories/JCategoryNodeTest.php
File renamed without changes
0  tests/suites/unit/legacy/error/JErrorInspector.php → tests/suites/legacy/error/JErrorInspector.php
File renamed without changes
0  tests/suites/unit/legacy/error/JErrorTest.php → tests/suites/legacy/error/JErrorTest.php
File renamed without changes
0  ...s/suites/unit/legacy/exception/JExceptionTest.php → tests/suites/legacy/exception/JExceptionTest.php
File renamed without changes
12  ...unit/legacy/form/field/JFormFieldHelpsiteTest.php → ...ites/legacy/form/field/JFormFieldHelpsiteTest.php
@@ -7,6 +7,8 @@
7 7
  * @license     GNU General Public License version 2 or later; see LICENSE
8 8
  */
9 9
 
  10
+require_once JPATH_TESTS . '/suites/unit/joomla/form/inspectors.php';
  11
+
10 12
 /**
11 13
  * Test class for JForm.
12 14
  *
@@ -16,16 +18,6 @@
16 18
 class JFormFieldHelpsiteTest extends TestCase
17 19
 {
18 20
 	/**
19  
-	 * Sets up dependancies for the test.
20  
-	 */
21  
-	protected function setUp()
22  
-	{
23  
-		require_once JPATH_PLATFORM . '/legacy/help/help.php';
24  
-		require_once JPATH_PLATFORM . '/legacy/form/field/helpsite.php';
25  
-		include_once dirname(dirname(dirname(__DIR__))) . '/joomla/form/inspectors.php';
26  
-	}
27  
-
28  
-	/**
29 21
 	 * Test the getInput method.
30 22
 	 * @covers JFormFieldHelpsite::getOptions
31 23
 	 */
11  ...es/unit/legacy/form/field/JFormFieldMediaTest.php → .../suites/legacy/form/field/JFormFieldMediaTest.php
@@ -7,6 +7,8 @@
7 7
  * @license     GNU General Public License version 2 or later; see LICENSE
8 8
  */
9 9
 
  10
+require_once JPATH_TESTS . '/suites/unit/joomla/form/inspectors.php';
  11
+
10 12
 /**
11 13
  * Test class for JForm.
12 14
  *
@@ -16,15 +18,6 @@
16 18
 class JFormFieldMediaTest extends TestCase
17 19
 {
18 20
 	/**
19  
-	 * Sets up dependancies for the test.
20  
-	 */
21  
-	protected function setUp()
22  
-	{
23  
-		require_once JPATH_PLATFORM . '/legacy/form/field/media.php';
24  
-		include_once dirname(dirname(dirname(__DIR__))) . '/joomla/form/inspectors.php';
25  
-	}
26  
-
27  
-	/**
28 21
 	 * Test the getInput method.
29 22
 	 * @covers JFormFieldMedia::getInput
30 23
 	 */
8  ...legacy/form/field/JFormFieldTemplateStyleTest.php → ...legacy/form/field/JFormFieldTemplateStyleTest.php
@@ -16,14 +16,6 @@
16 16
 class JFormFieldTemplateStyleTest extends TestCase
17 17
 {
18 18
 	/**
19  
-	 * Sets up dependancies for the test.
20  
-	 */
21  
-	protected function setUp()
22  
-	{
23  
-		require_once JPATH_PLATFORM . '/legacy/form/field/templatestyle.php';
24  
-	}
25  
-
26  
-	/**
27 19
 	 * Test the getInput method.
28 20
 	 * @covers JFormFieldTemplateStyle::getGroups
29 21
 	 */
11  ...tes/unit/legacy/form/field/JFormFieldUserTest.php → ...s/suites/legacy/form/field/JFormFieldUserTest.php
@@ -7,6 +7,8 @@
7 7
  * @license     GNU General Public License version 2 or later; see LICENSE
8 8
  */
9 9
 
  10
+require_once JPATH_TESTS . '/suites/unit/joomla/form/inspectors.php';
  11
+
10 12
 /**
11 13
  * Test class for JForm.
12 14
  *
@@ -16,15 +18,6 @@
16 18
 class JFormFieldUserTest extends TestCase
17 19
 {
18 20
 	/**
19  
-	 * Sets up dependancies for the test.
20  
-	 */
21  
-	protected function setUp()
22  
-	{
23  
-		require_once JPATH_PLATFORM . '/legacy/form/field/user.php';
24  
-		include_once dirname(dirname(dirname(__DIR__))) . '/joomla/form/inspectors.php';
25  
-	}
26  
-
27  
-	/**
28 21
 	 * Test the getInput method.
29 22
 	 * @covers JFormFieldUser::getInput()
30 23
 	 * @covers JFormFieldUser::<!public>
0  tests/suites/unit/legacy/menu/JMenuTest.php → tests/suites/legacy/menu/JMenuTest.php
File renamed without changes
0  tests/suites/unit/legacy/pathway/JPathwayTest.php → tests/suites/legacy/pathway/JPathwayTest.php
File renamed without changes
0  ...es/unit/legacy/pathway/stubs/includes/pathway.php → .../suites/legacy/pathway/stubs/includes/pathway.php
File renamed without changes
0  ...unit/legacy/request/JFilterInput-mock-general.php → ...ites/legacy/request/JFilterInput-mock-general.php
File renamed without changes
0  ...s/unit/legacy/request/JRequest-helper-dataset.php → ...suites/legacy/request/JRequest-helper-dataset.php
File renamed without changes
0  ...suites/unit/legacy/request/JRequestGetVarTest.php → tests/suites/legacy/request/JRequestGetVarTest.php
File renamed without changes
0  ...tes/unit/legacy/request/JRequestGetmethodTest.php → ...s/suites/legacy/request/JRequestGetmethodTest.php
File renamed without changes
0  tests/suites/unit/legacy/request/JRequestTest.php → tests/suites/legacy/request/JRequestTest.php
File renamed without changes
2  tests/suites/unit/legacy/table/JTableContentTest.php → tests/suites/legacy/table/JTableContentTest.php
@@ -56,7 +56,7 @@ protected function getDataSet()
56 56
 	{
57 57
 		$dataSet = new PHPUnit_Extensions_Database_DataSet_CsvDataSet(',', "'", '\\');
58 58
 
59  
-		$stubpath = dirname(dirname(__DIR__)) . '/joomla/table/stubs';
  59
+		$stubpath = JPATH_TESTS . '/suites/unit/joomla/table/stubs';
60 60
 
61 61
 		$dataSet->addTable('jos_assets', $stubpath . '/jos_assets.csv');
62 62
 		$dataSet->addTable('jos_categories', $stubpath . '/jos_categories.csv');
0  tests/suites/unit/legacy/table/stubs/jos_content.csv → tests/suites/legacy/table/stubs/jos_content.csv
File renamed without changes
0  ...suites/unit/legacy/toolbar/JToolbarButtonTest.php → tests/suites/legacy/toolbar/JToolbarButtonTest.php
File renamed without changes
0  tests/suites/unit/legacy/toolbar/JToolbarTest.php → tests/suites/legacy/toolbar/JToolbarTest.php
File renamed without changes
0  ...unit/legacy/toolbar/button/JButtonConfirmTest.php → ...ites/legacy/toolbar/button/JButtonConfirmTest.php
File renamed without changes
0  .../unit/legacy/toolbar/button/JButtonCustomTest.php → ...uites/legacy/toolbar/button/JButtonCustomTest.php
File renamed without changes
0  ...es/unit/legacy/toolbar/button/JButtonHelpTest.php → .../suites/legacy/toolbar/button/JButtonHelpTest.php
File renamed without changes
0  ...es/unit/legacy/toolbar/button/JButtonLinkTest.php → .../suites/legacy/toolbar/button/JButtonLinkTest.php
File renamed without changes
0  ...s/unit/legacy/toolbar/button/JButtonPopupTest.php → ...suites/legacy/toolbar/button/JButtonPopupTest.php
File renamed without changes
0  ...it/legacy/toolbar/button/JButtonSeparatorTest.php → ...es/legacy/toolbar/button/JButtonSeparatorTest.php
File renamed without changes
0  ...nit/legacy/toolbar/button/JButtonStandardTest.php → ...tes/legacy/toolbar/button/JButtonStandardTest.php
File renamed without changes

0 notes on commit b6db641

Please sign in to comment.
Something went wrong with that request. Please try again.