You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ch...@apache.org on 2008/08/02 19:49:28 UTC

svn commit: r682030 - in /incubator/shindig/trunk/php/test: ./ common/ gadgets/

Author: chabotc
Date: Sat Aug  2 10:49:28 2008
New Revision: 682030

URL: http://svn.apache.org/viewvc?rev=682030&view=rev
Log:
Further test case cleanups, and added test suite for command line or cruisecontrol use

Added:
    incubator/shindig/trunk/php/test/ShindigAllTests.php
Modified:
    incubator/shindig/trunk/php/test/common/CacheFileTest.php
    incubator/shindig/trunk/php/test/common/HttpServletTest.php
    incubator/shindig/trunk/php/test/common/UrlGeneratorTest.php
    incubator/shindig/trunk/php/test/gadgets/GadgetContextTest.php
    incubator/shindig/trunk/php/test/gadgets/GadgetIdTest.php
    incubator/shindig/trunk/php/test/gadgets/GadgetServerInvalid.php
    incubator/shindig/trunk/php/test/gadgets/GadgetSpecParserTest.php
    incubator/shindig/trunk/php/test/gadgets/GadgetTest.php
    incubator/shindig/trunk/php/test/gadgets/JsFeatureLoaderInvalid.php
    incubator/shindig/trunk/php/test/gadgets/JsLibraryTest.php
    incubator/shindig/trunk/php/test/gadgets/MessageBundleParserTest.php
    incubator/shindig/trunk/php/test/gadgets/MessageBundleTest.php
    incubator/shindig/trunk/php/test/gadgets/ProxyHandlerInvalid.php
    incubator/shindig/trunk/php/test/gadgets/SubstitutionsTest.php
    incubator/shindig/trunk/php/test/gadgets/UserPrefsTest.php
    incubator/shindig/trunk/php/test/gadgets/ViewSpecTest.php
    incubator/shindig/trunk/php/test/index.php

Added: incubator/shindig/trunk/php/test/ShindigAllTests.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/ShindigAllTests.php?rev=682030&view=auto
==============================================================================
--- incubator/shindig/trunk/php/test/ShindigAllTests.php (added)
+++ incubator/shindig/trunk/php/test/ShindigAllTests.php Sat Aug  2 10:49:28 2008
@@ -0,0 +1,97 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ * 
+ */
+
+/*
+ * This file is meant to be run through a php command line or cruiscontrol build, and not called directly
+ * through the web browser. To run these tests from the command line:
+ * # cd /path/to/shindig
+ * # phpunit ShindigAllTests php/test/ShindigAllTests.php   
+ */
+
+set_include_path(get_include_path(). PATH_SEPARATOR . realpath('./php') . PATH_SEPARATOR . realpath('./php/external'));
+ini_set('error_reporting', E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);
+
+require_once 'config.php';
+
+function __autoload($className)
+{
+	$basePath = realpath('./php');
+	$locations = array(
+					'src/common',
+					'src/common/samplecontainer',
+					'src/gadgets', 
+					'src/gadgets/http',
+					'src/gadgets/oauth',
+					'src/gadgets/samplecontainer',
+					'src/social-api',
+					'src/social-api/http',
+					'src/social-api/dataservice',
+					'src/social-api/opensocial',
+					'src/social-api/opensocial/model',
+					'src/social-api/samplecontainer'
+				);
+	$extension_class_paths = Config::get('extension_class_paths');
+	if (!empty($extension_class_paths)) {
+		$locations = array_merge(explode(',', $extension_class_paths), $locations);
+	}
+	// Check for the presense of this class in our all our directories.
+	$fileName = $className . '.php';
+	foreach ($locations as $path) {
+		if (file_exists("$basePath/{$path}/$fileName")) {
+			require "{$path}/$fileName";
+			break;
+		}
+	}
+}
+;
+
+if (defined('PHPUnit_MAIN_METHOD') === false) {
+	define('PHPUnit_MAIN_METHOD', 'ShindigAllTests::main');
+}
+
+class ShindigAllTests {
+
+	public static function main()
+	{
+		PHPUnit_TextUI_TestRunner::run(self::suite(), array());
+	}
+
+	public static function suite()
+	{
+		$suite = new PHPUnit_Framework_TestSuite();
+		$suite->setName('Shindig');
+		$path = realpath('./php/test/');
+		$testTypes = array('common', 'gadgets', 'social-api');
+		foreach ($testTypes as $type) {
+			foreach (glob("$path/{$type}/*Test.php") as $file) {
+				if (is_readable($file)) {
+					require_once $file;
+					$className = str_replace('.php', '', basename($file));
+					$suite->addTestSuite($className);
+				}
+			}
+		}
+		return $suite;
+	}
+}
+
+if (PHPUnit_MAIN_METHOD === 'ShindigAllTests::main') {
+	ShindigAllTests::main();
+}
\ No newline at end of file

Modified: incubator/shindig/trunk/php/test/common/CacheFileTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/common/CacheFileTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/common/CacheFileTest.php (original)
+++ incubator/shindig/trunk/php/test/common/CacheFileTest.php Sat Aug  2 10:49:28 2008
@@ -18,11 +18,6 @@
  * under the License.
  */
 
-require_once 'config.php';
-require_once 'src/common/Cache.php';
-require_once 'src/common/CacheFile.php';
-require_once 'PHPUnit/Framework/TestCase.php';
-
 /**
  * CacheFile test case.
  */

Modified: incubator/shindig/trunk/php/test/common/HttpServletTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/common/HttpServletTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/common/HttpServletTest.php (original)
+++ incubator/shindig/trunk/php/test/common/HttpServletTest.php Sat Aug  2 10:49:28 2008
@@ -18,9 +18,6 @@
  * under the License.
  */
 
-require_once 'src/common/HttpServlet.php';
-require_once 'PHPUnit/Framework/TestCase.php';
-
 /**
  * HttpServlet test case.
  */

Modified: incubator/shindig/trunk/php/test/common/UrlGeneratorTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/common/UrlGeneratorTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/common/UrlGeneratorTest.php (original)
+++ incubator/shindig/trunk/php/test/common/UrlGeneratorTest.php Sat Aug  2 10:49:28 2008
@@ -18,17 +18,6 @@
  * under the License.
  */
 
-require_once 'src/common/UrlGenerator.php';
-require_once 'src/common/Locale.php';
-require_once 'src/gadgets/Substitutions.php';
-require_once 'src/gadgets/UserPrefs.php';
-require_once 'src/gadgets/ViewSpec.php';
-require_once 'src/gadgets/HttpUtil.php';
-require_once 'src/gadgets/GadgetException.php';
-require_once 'src/gadgets/Gadget.php';
-require_once 'src/gadgets/GadgetContext.php';
-require_once 'PHPUnit/Framework/TestCase.php';
-
 /**
  * UrlGenerator test case.
  */

Modified: incubator/shindig/trunk/php/test/gadgets/GadgetContextTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/GadgetContextTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/GadgetContextTest.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/GadgetContextTest.php Sat Aug  2 10:49:28 2008
@@ -18,21 +18,6 @@
  * 
  */
 
-require_once 'src/gadgets/GadgetContext.php';
-require_once 'PHPUnit/Framework/TestCase.php';
-
-require_once 'src/gadgets/GadgetId.php';
-require_once 'config.php';
-require_once 'src/common/Cache.php';
-require_once 'src/common/CacheFile.php';
-require_once 'src/gadgets/samplecontainer/BasicGadgetBlacklist.php';
-require_once 'src/common/RemoteContent.php';
-require_once 'src/common/samplecontainer/BasicRemoteContent.php';
-require_once 'src/gadgets/UserPrefs.php';
-require_once 'src/common/Locale.php';
-require_once 'src/gadgets/JsFeatureLoader.php';
-require_once 'src/gadgets/GadgetFeatureRegistry.php';
-
 /**
  * GadgetContext test case.
  */

Modified: incubator/shindig/trunk/php/test/gadgets/GadgetIdTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/GadgetIdTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/GadgetIdTest.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/GadgetIdTest.php Sat Aug  2 10:49:28 2008
@@ -18,10 +18,6 @@
  * 
  */
 
-require_once 'src/gadgets/GadgetId.php';
-
-require_once 'PHPUnit/Framework/TestCase.php';
-
 /**
  * GadgetId test case.
  */

Modified: incubator/shindig/trunk/php/test/gadgets/GadgetServerInvalid.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/GadgetServerInvalid.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/GadgetServerInvalid.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/GadgetServerInvalid.php Sat Aug  2 10:49:28 2008
@@ -1,21 +1,22 @@
 <?php
-
-require_once 'src/gadgets/GadgetException.php';
-require_once 'src/gadgets/GadgetServer.php';
-require_once 'src/gadgets/GadgetContext.php';
-
-require_once 'src/common/RemoteContentFetcher.php';
-require_once 'src/common/RemoteContentRequest.php';
-require_once 'src/gadgets/JsFeatureLoader.php';
-require_once 'src/gadgets/GadgetFeatureRegistry.php';
-require_once 'src/gadgets/JsLibrary.php';
-require_once 'src/gadgets/GadgetFeatureFactory.php';
-require_once 'src/gadgets/GadgetFeature.php';
-require_once 'src/gadgets/JsLibraryFeatureFactory.php';
-
-require_once 'src/common/samplecontainer/BasicRemoteContentFetcher.php';
-
-require_once 'PHPUnit/Framework/TestCase.php';
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 
 /**
  * GadgetServer test case.

Modified: incubator/shindig/trunk/php/test/gadgets/GadgetSpecParserTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/GadgetSpecParserTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/GadgetSpecParserTest.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/GadgetSpecParserTest.php Sat Aug  2 10:49:28 2008
@@ -18,12 +18,6 @@
  * 
  */
 
-require_once 'src/gadgets/GadgetSpecParser.php';
-require_once 'PHPUnit/Framework/TestCase.php';
-
-require_once 'src/gadgets/Gadget.php';
-require_once 'src/gadgets/ViewSpec.php';
-
 /**
  * GadgetSpecParser test case.
  */

Modified: incubator/shindig/trunk/php/test/gadgets/GadgetTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/GadgetTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/GadgetTest.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/GadgetTest.php Sat Aug  2 10:49:28 2008
@@ -1,12 +1,22 @@
 <?php
-
-require_once 'src/gadgets/GadgetContext.php';
-require_once 'src/gadgets/UserPrefs.php';
-require_once 'src/gadgets/Substitutions.php';
-
-require_once 'src/gadgets/Gadget.php';
-
-require_once 'PHPUnit/Framework/TestCase.php';
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 
 /**
  * Gadget test case.

Modified: incubator/shindig/trunk/php/test/gadgets/JsFeatureLoaderInvalid.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/JsFeatureLoaderInvalid.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/JsFeatureLoaderInvalid.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/JsFeatureLoaderInvalid.php Sat Aug  2 10:49:28 2008
@@ -18,14 +18,6 @@
  * 
  */
 
-require_once 'PHPUnit/Framework/TestCase.php';
-require_once 'src/gadgets/JsFeatureLoader.php';
-require_once 'src/gadgets/GadgetFeatureRegistry.php';
-require_once 'src/gadgets/JsLibrary.php';
-require_once 'src/gadgets/GadgetFeatureFactory.php';
-require_once 'src/gadgets/GadgetFeature.php';
-require_once 'src/gadgets/JsLibraryFeatureFactory.php';
-
 /**
  * JsFeatureLoader test case.
  */

Modified: incubator/shindig/trunk/php/test/gadgets/JsLibraryTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/JsLibraryTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/JsLibraryTest.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/JsLibraryTest.php Sat Aug  2 10:49:28 2008
@@ -1,8 +1,22 @@
 <?php
-
-require_once 'src/gadgets/JsLibrary.php';
-
-require_once 'PHPUnit/Framework/TestCase.php';
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 
 /**
  * JsLibrary test case.

Modified: incubator/shindig/trunk/php/test/gadgets/MessageBundleParserTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/MessageBundleParserTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/MessageBundleParserTest.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/MessageBundleParserTest.php Sat Aug  2 10:49:28 2008
@@ -1,9 +1,22 @@
 <?php
-
-require_once 'src/gadgets/MessageBundle.php';
-require_once 'src/gadgets/MessageBundleParser.php';
-
-require_once 'PHPUnit/Framework/TestCase.php';
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 
 /**
  * MessageBundleParser test case.

Modified: incubator/shindig/trunk/php/test/gadgets/MessageBundleTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/MessageBundleTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/MessageBundleTest.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/MessageBundleTest.php Sat Aug  2 10:49:28 2008
@@ -1,8 +1,22 @@
 <?php
-
-require_once 'src/gadgets/MessageBundle.php';
-
-require_once 'PHPUnit/Framework/TestCase.php';
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 
 /**
  * MessageBundle test case.

Modified: incubator/shindig/trunk/php/test/gadgets/ProxyHandlerInvalid.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/ProxyHandlerInvalid.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/ProxyHandlerInvalid.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/ProxyHandlerInvalid.php Sat Aug  2 10:49:28 2008
@@ -1,12 +1,22 @@
 <?php
-
-require_once 'PHPUnit/Framework/TestCase.php';
-require_once 'src/gadgets/ProxyHandler.php';
-require_once 'src/gadgets/SigningFetcherFactory.php';
-require_once 'src/gadgets/GadgetContext.php';
-require_once 'src/common/RemoteContentFetcher.php';
-require_once 'src/common/RemoteContentRequest.php';
-require_once 'src/common/samplecontainer/BasicRemoteContentFetcher.php';
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 
 /**
  * ProxyHandler test case.

Modified: incubator/shindig/trunk/php/test/gadgets/SubstitutionsTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/SubstitutionsTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/SubstitutionsTest.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/SubstitutionsTest.php Sat Aug  2 10:49:28 2008
@@ -18,10 +18,6 @@
  * 
  */
 
-require_once 'src/gadgets/Substitutions.php';
-
-require_once 'PHPUnit/Framework/TestCase.php';
-
 /**
  * Substitutions test case.
  */

Modified: incubator/shindig/trunk/php/test/gadgets/UserPrefsTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/UserPrefsTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/UserPrefsTest.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/UserPrefsTest.php Sat Aug  2 10:49:28 2008
@@ -1,8 +1,22 @@
 <?php
-
-require_once 'src/gadgets/UserPrefs.php';
-
-require_once 'PHPUnit/Framework/TestCase.php';
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 
 /**
  * UserPrefs test case.

Modified: incubator/shindig/trunk/php/test/gadgets/ViewSpecTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/ViewSpecTest.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/ViewSpecTest.php (original)
+++ incubator/shindig/trunk/php/test/gadgets/ViewSpecTest.php Sat Aug  2 10:49:28 2008
@@ -1,9 +1,22 @@
 <?php
-
-require_once 'src/gadgets/ViewSpec.php';
-require_once 'PHPUnit/Framework/TestCase.php';
-
-require_once 'src/gadgets/GadgetSpecParser.php';
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 
 /**
  * ViewSpec test case.

Modified: incubator/shindig/trunk/php/test/index.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/index.php?rev=682030&r1=682029&r2=682030&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/index.php (original)
+++ incubator/shindig/trunk/php/test/index.php Sat Aug  2 10:49:28 2008
@@ -22,6 +22,38 @@
 
 require_once "PHPUnit/Framework/TestSuite.php";
 require_once "PHPUnit/TextUI/TestRunner.php";
+require_once realpath('../')."/config.php";
+
+function __autoload($className)
+{
+	$basePath = realpath('../');
+	$locations = array(
+					'src/common',
+					'src/common/samplecontainer',
+					'src/gadgets', 
+					'src/gadgets/http',
+					'src/gadgets/oauth',
+					'src/gadgets/samplecontainer',
+					'src/social-api',
+					'src/social-api/http',
+					'src/social-api/dataservice',
+					'src/social-api/opensocial',
+					'src/social-api/opensocial/model',
+					'src/social-api/samplecontainer'
+				);
+	$extension_class_paths = Config::get('extension_class_paths');
+	if (!empty($extension_class_paths)) {
+		$locations = array_merge(explode(',', $extension_class_paths), $locations);
+	}
+	// Check for the presense of this class in our all our directories.
+	$fileName = $className . '.php';
+	foreach ($locations as $path) {
+		if (file_exists("$basePath/{$path}/$fileName")) {
+			require "$basePath/{$path}/$fileName";
+			break;
+		}
+	}
+}
 
 class AllTests {