Skip to content
Browse files

Move plugin test logic to Ant script.

  • Loading branch information...
1 parent 15941df commit c8ba4a3962656eb25c549d9fa5b3e0e24980429b @zerocrates zerocrates committed Jan 11, 2012
Showing with 14 additions and 84 deletions.
  1. +0 −26 application/tests/CoreTests.php
  2. +0 −58 application/tests/PluginTests.php
  3. +14 −0 build.xml
View
26 application/tests/CoreTests.php
@@ -1,26 +0,0 @@
-<?php
-/**
- * @copyright Roy Rosenzweig Center for History and New Media, 2007-2010
- * @license http://www.gnu.org/licenses/gpl-3.0.txt
- * @package Omeka
- */
-
-require_once dirname(__FILE__) . '/integration/AllTests.php';
-require_once dirname(__FILE__) . '/unit/AllTests.php';
-
-/**
- *
- *
- * @package Omeka
- * @copyright Roy Rosenzweig Center for History and New Media, 2007-2010
- */
-class CoreTests extends PHPUnit_Framework_TestSuite
-{
- public static function suite()
- {
- $suite = new PHPUnit_Framework_TestSuite();
- $suite->addTest(Integration_AllTests::suite());
- $suite->addTest(Unit_AllTests::suite());
- return $suite;
- }
-}
View
58 application/tests/PluginTests.php
@@ -1,58 +0,0 @@
-<?php
-/**
- * @copyright Roy Rosenzweig Center for History and New Media, 2007-2010
- * @license http://www.gnu.org/licenses/gpl-3.0.txt
- * @package Omeka
- */
-
-/**
- *
- *
- * @package Omeka
- * @copyright Roy Rosenzweig Center for History and New Media, 2007-2010
- */
-class PluginTests extends PHPUnit_Framework_TestSuite
-{
- public static function suite()
- {
- $suite = new PluginTests;
- $suite->addTest(self::_pluginTestSuite());
- return $suite;
- }
-
- /**
- * Check each plugin for tests and aggregate all plugin tests into a test
- * suite.
- *
- * Check for an AllTests.php file in the plugin's tests/ directory. If it
- * exists, assume that that is a test suite and try to load it. Otherwise,
- * collect all the test files using the standard aggregator supplied by
- * PHPUnit.
- */
- private static function _pluginTestSuite()
- {
- $pluginDirIterator = new VersionedDirectoryIterator(PLUGIN_DIR);
- $suite = new PHPUnit_Framework_TestSuite('Plugin Tests');
- $pluginTestDirs = array();
- foreach ($pluginDirIterator as $pluginDir) {
- $pluginTestDir = PLUGIN_DIR . '/' . $pluginDir . '/' . 'tests';
- if (!is_dir($pluginTestDir)) {
- continue;
- }
- $suiteFile = $pluginTestDir . '/AllTests.php';
- if (is_file($suiteFile)) {
- $suite->addTestFile($suiteFile);
- } else {
- $pluginTestDirs[] = $pluginTestDir;
- }
- }
-
- if ($pluginTestDirs) {
- $testCollector = new PHPUnit_Runner_IncludePathTestCollector(
- $pluginTestDirs
- );
- $suite->addTestFiles($testCollector->collectTests());
- }
- return $suite;
- }
-}
View
14 build.xml
@@ -1,6 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Omeka" basedir=".">
<property name="lang.dir" location="application/languages" />
+
+ <target name="test" description="Run automated tests.">
+ <exec executable="phpunit" dir="application/tests" failonerror="true"/>
+ </target>
+
+ <target name="test-plugins" description="Run automated tests for plugins.">
+ <apply executable="phpunit" failonerror="true">
+ <arg value="-c" />
+ <fileset dir="plugins" includes="*/tests/phpunit.xml" />
+ </apply>
+ </target>
+
+ <target name="test-all" depends="test,test-plugins" description="Run all automated tests." />
+
<target name="update-pot" description="Update the translation template.">
<property name="pot.file" location="${lang.dir}/Omeka.pot"/>
<property name="pot.base" location="${lang.dir}/Omeka.base.pot"/>

0 comments on commit c8ba4a3

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