Permalink
Browse files

Moving the legacy tests into their own suite.

  • Loading branch information...
1 parent d26a419 commit b6db641a1de819f8cac7a4b2cf44a9aadfdd19cf @LouisLandry LouisLandry committed Apr 3, 2012
Showing with 298 additions and 178 deletions.
  1. +98 −102 build.xml
  2. +29 −0 legacy.xml.dist
  3. +16 −14 phpunit.xml.dist
  4. +70 −0 tests/bootstrap.legacy.php
  5. +1 −1 tests/bootstrap.php
  6. +33 −15 tests/core/case/case.php
  7. +44 −9 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. +2 −10 tests/suites/{unit → }/legacy/form/field/JFormFieldHelpsiteTest.php
  16. +2 −9 tests/suites/{unit → }/legacy/form/field/JFormFieldMediaTest.php
  17. +0 −8 tests/suites/{unit → }/legacy/form/field/JFormFieldTemplateStyleTest.php
  18. +2 −9 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. +1 −1 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
View
@@ -1,118 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="joomla-platform" default="build" basedir=".">
- <property name="source" value="libraries"/>
- <property name="joomlasource" value="libraries/joomla,libraries/platform.php,libraries/loader.php,libraries/import.php"/>
+ <property name="source" value="libraries" />
+ <property name="joomlasource" value="libraries/joomla,libraries/platform.php,libraries/loader.php,libraries/import.php" />
- <target name="clean"
- description="Clean up and create artifact directories">
- <delete dir="${basedir}/build/api"/>
- <delete dir="${basedir}/build/code-browser"/>
- <delete dir="${basedir}/build/coverage"/>
- <delete dir="${basedir}/build/logs"/>
- <delete dir="${basedir}/build/pdepend"/>
+ <target name="clean" description="Clean up and create artifact directories">
+ <delete dir="${basedir}/build/api" />
+ <delete dir="${basedir}/build/code-browser" />
+ <delete dir="${basedir}/build/coverage" />
+ <delete dir="${basedir}/build/logs" />
+ <delete dir="${basedir}/build/pdepend" />
- <mkdir dir="${basedir}/build/api"/>
- <mkdir dir="${basedir}/build/code-browser"/>
- <mkdir dir="${basedir}/build/coverage"/>
- <mkdir dir="${basedir}/build/logs"/>
- <mkdir dir="${basedir}/build/pdepend"/>
- </target>
+ <mkdir dir="${basedir}/build/api" />
+ <mkdir dir="${basedir}/build/code-browser" />
+ <mkdir dir="${basedir}/build/coverage" />
+ <mkdir dir="${basedir}/build/logs" />
+ <mkdir dir="${basedir}/build/pdepend" />
+ </target>
- <target name="phpunit"
- description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
- <exec executable="phpunit"/>
- </target>
+ <target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
+ <exec executable="phpunit" />
+ </target>
- <target name="parallelTasks"
- description="Run the pdepend, phpmd, phpcpd, phpcs, phpdoc and phploc tasks in parallel using a maximum of 2 threads.">
- <parallel threadCount="2">
- <sequential>
- <antcall target="pdepend"/>
- <antcall target="phpmd"/>
- </sequential>
- <antcall target="phpcpd"/>
- <antcall target="phpcs"/>
- <antcall target="phpdoc"/>
- <antcall target="phploc"/>
- </parallel>
- </target>
+ <target name="phpunit-legacy" description="Run legacy tests using PHPUnit and generates junit.legacy.xml and clover.legacy.xml">
+ <exec executable="phpunit">
+ <arg value="-c legacy.xml.dist" />
+ </exec>
+ </target>
- <target name="pdepend"
- description="Generate jdepend.xml and software metrics charts using PHP_Depend">
- <exec executable="pdepend">
- <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
- <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
- <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
- <arg path="${source}" />
- </exec>
- </target>
+ <target name="parallelTasks" description="Run the pdepend, phpmd, phpcpd, phpcs, phpdoc and phploc tasks in parallel using a maximum of 2 threads.">
+ <parallel threadCount="2">
+ <sequential>
+ <antcall target="pdepend" />
+ <antcall target="phpmd" />
+ </sequential>
+ <antcall target="phpcpd" />
+ <antcall target="phpcs" />
+ <antcall target="phpdoc" />
+ <antcall target="phploc" />
+ </parallel>
+ </target>
- <target name="phpmd"
- description="Generate pmd.xml using PHPMD">
- <exec executable="phpmd">
- <arg path="${joomlasource}" />
- <arg value="xml" />
- <arg value="${basedir}/build/phpmd.xml" />
- <arg value="--reportfile" />
- <arg value="${basedir}/build/logs/pmd.xml" />
- </exec>
- </target>
+ <target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
+ <exec executable="pdepend">
+ <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
+ <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
+ <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
+ <arg path="${source}" />
+ </exec>
+ </target>
- <target name="phpcpd"
- description="Generate pmd-cpd.xml using PHPCPD">
- <exec executable="phpcpd">
- <arg value="--log-pmd" />
- <arg value="${basedir}/build/logs/pmd-cpd.xml" />
- <arg path="${source}/joomla" />
- </exec>
- </target>
+ <target name="phpmd" description="Generate pmd.xml using PHPMD">
+ <exec executable="phpmd">
+ <arg path="${joomlasource}" />
+ <arg value="xml" />
+ <arg value="${basedir}/build/phpmd.xml" />
+ <arg value="--reportfile" />
+ <arg value="${basedir}/build/logs/pmd.xml" />
+ </exec>
+ </target>
- <target name="phploc"
- description="Generate phploc.csv">
- <exec executable="phploc">
- <arg value="--log-csv" />
- <arg value="${basedir}/build/logs/phploc.csv" />
- <arg path="${source}/joomla" />
- </exec>
- </target>
+ <target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD">
+ <exec executable="phpcpd">
+ <arg value="--log-pmd" />
+ <arg value="${basedir}/build/logs/pmd-cpd.xml" />
+ <arg path="${source}/joomla" />
+ </exec>
+ </target>
- <target name="phpcs"
- description="Generate checkstyle.xml using PHP_CodeSniffer">
- <exec executable="phpcs">
- <arg value="--report=checkstyle" />
- <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
- <arg value="--standard=${basedir}/build/phpcs/Joomla" />
- <arg value="--ignore=${source}/phpmailer,${source}/phputf8,${source}/simplepie/,${source}/config.example.php" />
- <arg path="${source}" />
- </exec>
- </target>
+ <target name="phploc" description="Generate phploc.csv">
+ <exec executable="phploc">
+ <arg value="--log-csv" />
+ <arg value="${basedir}/build/logs/phploc.csv" />
+ <arg path="${source}/joomla" />
+ </exec>
+ </target>
- <target name="phpdoc"
- description="Generate API documentation using PHPDocumentor">
- <exec executable="phpdox">
- <arg value="-c" />
- <arg path="${source}" />
- <arg value="-d" />
- <arg path="${basedir}/build/api" />
- <arg value="-x" />
- <arg path="${basedir}/build/docs" />
- <arg value="-g" />
- <arg value="html" />
- </exec>
- </target>
+ <target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer">
+ <exec executable="phpcs">
+ <arg value="--report=checkstyle" />
+ <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
+ <arg value="--standard=${basedir}/build/phpcs/Joomla" />
+ <arg value="--ignore=${source}/phpmailer,${source}/phputf8,${source}/simplepie/,${source}/config.example.php" />
+ <arg path="${source}" />
+ </exec>
+ </target>
- <target name="phpcb"
- description="Aggregate tool output with PHP_CodeBrowser">
- <exec executable="phpcb">
- <arg value="--log" />
- <arg path="${basedir}/build/logs" />
- <arg value="--source" />
- <arg path="${source}" />
- <arg value="--output" />
- <arg path="${basedir}/build/code-browser" />
- </exec>
- </target>
+ <target name="phpdoc" description="Generate API documentation using PHPDocumentor">
+ <exec executable="phpdox">
+ <arg value="-c" />
+ <arg path="${source}" />
+ <arg value="-d" />
+ <arg path="${basedir}/build/api" />
+ <arg value="-x" />
+ <arg path="${basedir}/build/docs" />
+ <arg value="-g" />
+ <arg value="html" />
+ </exec>
+ </target>
- <target name="build" depends="clean,parallelTasks,phpunit,phpcb"/>
+ <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
+ <exec executable="phpcb">
+ <arg value="--log" />
+ <arg path="${basedir}/build/logs" />
+ <arg value="--source" />
+ <arg path="${source}" />
+ <arg value="--output" />
+ <arg path="${basedir}/build/code-browser" />
+ </exec>
+ </target>
+
+ <target name="build" depends="clean,phpunit,phpunit-legacy,parallelTasks,phpcb" />
</project>
View
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit bootstrap="tests/bootstrap.legacy.php" colors="false">
+ <!-- These constants help setup environment configurations for running optional tests.
+ <php>
+ <const name="JTEST_DATABASE_MYSQL_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
+ <const name="JTEST_DATABASE_MYSQLI_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
+ <const name="JTEST_DATABASE_POSTGRESQL_DSN" value="host=localhost;port=5432;dbname=joomla_ut;user=utuser;pass=ut1234" />
+ <const name="JTEST_HTTP_STUB" value="http://localhost/joomla-platform/tests/suites/unit/stubs/jhttp_stub.php" />
+ </php>
+ -->
+
+ <testsuites>
+ <testsuite name="Legacy">
+ <directory>tests/suites/legacy</directory>
+ </testsuite>
+ </testsuites>
+
+ <logging>
+ <log type="coverage-html" target="build/coverage-legacy" title="Joomla-Platform-Legacy" charset="UTF-8" yui="true" highlight="true"
+ lowUpperBound="35" highLowerBound="70" />
+ <log type="coverage-clover" target="build/logs/clover.legacy.xml" />
+ <log type="junit" target="build/logs/junit.legacy.xml" logIncompleteSkipped="false" />
+ </logging>
+ <filter>
+ <whitelist addUncoveredFilesFromWhitelist="false">
+ <directory suffix=".php">libraries/legacy</directory>
+ </whitelist>
+ </filter>
+</phpunit>
View
@@ -1,30 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
-
<phpunit bootstrap="tests/bootstrap.php" colors="false">
-
- <!-- <php>
+ <!-- These constants help setup environment configurations for running optional tests.
+ <php>
<const name="JTEST_DATABASE_MYSQL_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
<const name="JTEST_DATABASE_MYSQLI_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
<const name="JTEST_DATABASE_POSTGRESQL_DSN" value="host=localhost;port=5432;dbname=joomla_ut;user=utuser;pass=ut1234" />
<const name="JTEST_HTTP_STUB" value="http://localhost/joomla-platform/tests/suites/unit/stubs/jhttp_stub.php" />
- </php> -->
+ </php>
+ -->
- <testsuite name="AllTests">
- <directory>tests/suites</directory>
- </testsuite>
+ <testsuites>
+ <testsuite name="Database">
+ <directory>tests/suites/database</directory>
+ </testsuite>
+ <testsuite name="Unit">
+ <directory>tests/suites/unit</directory>
+ </testsuite>
+ </testsuites>
<logging>
- <log type="coverage-html" target="build/coverage" title="Joomla-Platform"
- charset="UTF-8" yui="true" highlight="true" lowUpperBound="35"
- highLowerBound="70" />
+ <log type="coverage-html" target="build/coverage" title="Joomla-Platform" charset="UTF-8" yui="true" highlight="true"
+ lowUpperBound="35" highLowerBound="70" />
<log type="coverage-clover" target="build/logs/clover.xml" />
- <log type="junit" target="build/logs/junit.xml"
- logIncompleteSkipped="false" />
+ <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false" />
</logging>
<filter>
- <whitelist addUncoveredFilesFromWhitelist="false">
+ <whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">libraries/joomla</directory>
- <directory suffix=".php">libraries/legacy</directory>
<file>libraries/import.php</file>
<file>libraries/loader.php</file>
<file>libraries/platform.php</file>
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Prepares a minimalist framework for unit testing.
+ *
+ * Joomla is assumed to include the /unittest/ directory.
+ * eg, /path/to/joomla/unittest/
+ *
+ * @package Joomla.UnitTest
+ *
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ * @link http://www.phpunit.de/manual/current/en/installation.html
+ */
+
+define('_JEXEC', 1);
+
+// Fix magic quotes.
+@ini_set('magic_quotes_runtime', 0);
+
+// Maximise error reporting.
+@ini_set('zend.ze1_compatibility_mode', '0');
+error_reporting(E_ALL);
+ini_set('display_errors', 1);
+
+/*
+ * Ensure that required path constants are defined. These can be overridden within the phpunit.xml file
+ * if you chose to create a custom version of that file.
+ */
+if (!defined('JPATH_TESTS'))
+{
+ define('JPATH_TESTS', realpath(__DIR__));
+}
+if (!defined('JPATH_PLATFORM'))
+{
+ define('JPATH_PLATFORM', realpath(dirname(JPATH_TESTS) . '/libraries'));
+}
+if (!defined('JPATH_BASE'))
+{
+ define('JPATH_BASE', realpath(JPATH_TESTS . '/tmp'));
+}
+if (!defined('JPATH_ROOT'))
+{
+ define('JPATH_ROOT', realpath(JPATH_BASE));
+}
+if (!defined('JPATH_CACHE'))
+{
+ define('JPATH_CACHE', JPATH_BASE . '/cache');
+}
+if (!defined('JPATH_CONFIGURATION'))
+{
+ define('JPATH_CONFIGURATION', JPATH_BASE);
+}
+if (!defined('JPATH_MANIFESTS'))
+{
+ define('JPATH_MANIFESTS', JPATH_BASE . '/manifests');
+}
+if (!defined('JPATH_PLUGINS'))
+{
+ define('JPATH_PLUGINS', JPATH_BASE . '/plugins');
+}
+if (!defined('JPATH_THEMES'))
+{
+ define('JPATH_THEMES', JPATH_BASE . '/themes');
+}
+
+// Import the platform.
+require_once JPATH_PLATFORM . '/import.legacy.php';
+
+// Register the core Joomla test classes.
+JLoader::registerPrefix('Test', __DIR__ . '/core');
View
@@ -64,7 +64,7 @@
}
// Import the platform.
-require_once JPATH_PLATFORM . '/import.legacy.php';
+require_once JPATH_PLATFORM . '/import.php';
// Register the core Joomla test classes.
JLoader::registerPrefix('Test', __DIR__ . '/core');
Oops, something went wrong.

0 comments on commit b6db641

Please sign in to comment.