Permalink
Browse files

Reorganize file structure and clarify naming

* Move non-model objects outside of model folder
* Move exceptions folder up one level to reduce complexity
* Rename PluginHook and its extending classes to PluginRegistrar for clarity
* Remove ThinkUp from class names: mv ThinkUpPlugin to GenericPlugin and SmartyThinkUp to ViewManager
* Clarify crawler registrar crawl function name, renamed to runRegisteredPluginsCrawl to differentiate from plugins' crawl function
* Rename InsightsGenerator to DashboardModuleCacher to differentiate from Insights plugin
* Modify makeplugin dev script to reflect changes

This refactor is in preparatory groundwork for making insights pluggable
  • Loading branch information...
ginatrapani committed Jul 20, 2012
1 parent d3328a4 commit 62258367cb2786495db19f2b96bca52c5af49e86
Showing with 427 additions and 438 deletions.
  1. +1 −1 extras/dev/makemodel/classes/class.ModelMaker.php
  2. +9 −9 extras/dev/makeplugin/makeplugin
  3. +2 −2 tests/TestOfAccountConfigurationController.php
  4. +0 −2 tests/TestOfBackupController.php
  5. +25 −25 tests/TestOfCrawler.php
  6. +4 −4 tests/TestOfDashboardController.php
  7. +6 −6 tests/{TestOfInsightsGenerator.php → TestOfDashboardModuleCacher.php}
  8. +2 −2 tests/TestOfGridController.php
  9. +11 −6 tests/TestOfLoader.php
  10. +4 −4 tests/{TestOfPluginHook.php → TestOfPluginRegistrar.php}
  11. +2 −2 tests/TestOfPostController.php
  12. +2 −2 tests/TestOfRegisterController.php
  13. +2 −2 tests/TestOfThreadJSController.php
  14. +2 −2 tests/TestOfToggleActivePluginController.php
  15. +19 −19 tests/{TestOfSmartyThinkUp.php → TestOfViewManager.php}
  16. +36 −36 tests/TestOfWebapp.php
  17. +3 −3 tests/all_model_tests.php
  18. +4 −4 tests/classes/class.TestFauxHookableApp.php
  19. +2 −2 tests/classes/class.TestFauxPlugin.php
  20. +5 −5 tests/classes/class.ThinkUpBasicUnitTestCase.php
  21. +3 −3 tests/classes/interface.TestAppPlugin.php
  22. +1 −1 tests/init.tests.php
  23. +1 −1 webapp/_lib/{model → }/class.AppConfig.php
  24. +1 −1 webapp/_lib/{model → }/class.AppUpgraderClient.php
  25. +1 −1 webapp/_lib/{model → }/class.AppUpgraderDiskUtil.php
  26. +1 −1 webapp/_lib/{model → }/class.Captcha.php
  27. +1 −1 webapp/_lib/{model → }/class.Config.php
  28. +1 −1 webapp/_lib/{model → }/class.DAOFactory.php
  29. +6 −6 webapp/_lib/{model/class.InsightsGenerator.php → class.DashboardModuleCacher.php}
  30. +1 −1 webapp/_lib/{model → }/class.FileDataManager.php
  31. +2 −2 webapp/_lib/{model → }/class.Installer.php
  32. +3 −2 webapp/_lib/{model → }/class.Loader.php
  33. +1 −1 webapp/_lib/{model → }/class.Logger.php
  34. +1 −1 webapp/_lib/{model → }/class.LoggerSlowSQL.php
  35. +1 −1 webapp/_lib/{model → }/class.Mailer.php
  36. +20 −25 webapp/_lib/{model/class.PluginHook.php → class.PluginRegistrar.php}
  37. +15 −18 webapp/_lib/{model/class.Crawler.php → class.PluginRegistrarCrawler.php}
  38. +14 −14 webapp/_lib/{model/class.Streamer.php → class.PluginRegistrarStreamer.php}
  39. +8 −12 webapp/_lib/{model/class.Webapp.php → class.PluginRegistrarWebapp.php}
  40. +1 −1 webapp/_lib/{model → }/class.Profiler.php
  41. +1 −1 webapp/_lib/{model → }/class.Session.php
  42. +1 −1 webapp/_lib/{model → }/class.SessionCache.php
  43. +1 −1 webapp/_lib/{model → }/class.URLProcessor.php
  44. +1 −1 webapp/_lib/{model → }/class.Utils.php
  45. +3 −3 webapp/_lib/{model/class.SmartyThinkUp.php → class.ViewManager.php}
  46. +2 −2 webapp/_lib/controller/class.AccountConfigurationController.php
  47. +3 −3 webapp/_lib/controller/class.BackupController.php
  48. +2 −2 webapp/_lib/controller/class.CrawlerAuthController.php
  49. +2 −2 webapp/_lib/controller/class.CrawlerWebController.php
  50. +6 −6 webapp/_lib/controller/class.DashboardController.php
  51. +1 −1 webapp/_lib/controller/class.ForgotPasswordController.php
  52. +3 −3 webapp/_lib/controller/class.GridController.php
  53. +2 −2 webapp/_lib/controller/class.InstallerController.php
  54. +1 −1 webapp/_lib/controller/class.PluginConfigurationController.php
  55. +4 −4 webapp/_lib/controller/class.PostController.php
  56. +10 −10 webapp/_lib/controller/class.RSSController.php
  57. +1 −1 webapp/_lib/controller/class.RegisterController.php
  58. +13 −12 webapp/_lib/controller/class.ThinkUpController.php
  59. +2 −2 webapp/_lib/controller/class.ToggleActivePluginController.php
  60. +1 −1 webapp/_lib/controller/class.UpgradeDatabaseController.php
  61. 0 webapp/_lib/{model → }/exceptions/class.APICallLimitExceededException.php
  62. 0 webapp/_lib/{model → }/exceptions/class.APICallTypeNotRecognizedException.php
  63. 0 webapp/_lib/{model → }/exceptions/class.APIDisabledException.php
  64. 0 webapp/_lib/{model → }/exceptions/class.APIOAuthException.php
  65. 0 webapp/_lib/{model → }/exceptions/class.BadArgumentException.php
  66. 0 webapp/_lib/{model → }/exceptions/class.ConfigurationException.php
  67. 0 webapp/_lib/{model → }/exceptions/class.ControllerAuthException.php
  68. 0 webapp/_lib/{model → }/exceptions/class.CrawlerLockedException.php
  69. 0 webapp/_lib/{model → }/exceptions/class.DuplicateOptionException.php
  70. 0 webapp/_lib/{model → }/exceptions/class.InstallerException.php
  71. 0 webapp/_lib/{model → }/exceptions/class.InvalidCSRFTokenException.php
  72. 0 webapp/_lib/{model → }/exceptions/class.MySQLGrantException.php
  73. 0 webapp/_lib/{model → }/exceptions/class.OpenFileException.php
  74. 0 webapp/_lib/{model → }/exceptions/class.PluginNotFoundException.php
  75. 0 webapp/_lib/{model → }/exceptions/class.PostNotFoundException.php
  76. 0 webapp/_lib/{model → }/exceptions/class.RequiredArgumentMissingException.php
  77. 0 webapp/_lib/{model → }/exceptions/class.StreamingException.php
  78. 0 webapp/_lib/{model → }/exceptions/class.UnauthorizedUserException.php
  79. 0 webapp/_lib/{model → }/exceptions/class.UserNotFoundException.php
  80. +1 −2 webapp/_lib/model/class.BackupMySQLDAO.php
  81. +1 −1 webapp/_lib/model/interface.CrawlerPlugin.php
  82. +1 −1 webapp/_lib/model/interface.DashboardPlugin.php
  83. +2 −2 webapp/_lib/model/{interface.ThinkUpPlugin.php → interface.GenericPlugin.php}
  84. +1 −1 webapp/_lib/model/interface.PostDetailPlugin.php
  85. +1 −1 webapp/_lib/model/interface.StreamerPlugin.php
  86. +1 −1 webapp/init.php
  87. +4 −4 webapp/plugins/expandurls/controller/expandurls.php
  88. +12 −12 webapp/plugins/expandurls/tests/TestOfExpandURLsPlugin.php
  89. +2 −2 webapp/plugins/expandurls/tests/TestOfExpandURLsPluginConfigurationController.php
  90. +5 −5 webapp/plugins/facebook/controller/facebook.php
  91. +6 −6 webapp/plugins/facebook/model/class.FacebookPlugin.php
  92. +2 −2 webapp/plugins/facebook/tests/TestOfFacebookCrawler.php
  93. +6 −6 webapp/plugins/facebook/tests/TestOfFacebookPlugin.php
  94. +2 −2 webapp/plugins/facebook/tests/TestOfFacebookPluginConfigurationController.php
  95. +4 −4 webapp/plugins/geoencoder/controller/geoencoder.php
  96. +3 −3 webapp/plugins/geoencoder/model/class.GeoEncoderPlugin.php
  97. +10 −10 webapp/plugins/geoencoder/tests/TestOfGeoEncoderPlugin.php
  98. +2 −2 webapp/plugins/geoencoder/tests/TestOfGeoEncoderPluginConfigurationController.php
  99. +2 −2 webapp/plugins/googleplus/controller/class.GooglePlusPluginConfigurationController.php
  100. +4 −4 webapp/plugins/googleplus/controller/googleplus.php
  101. +6 −6 webapp/plugins/googleplus/model/class.GooglePlusPlugin.php
  102. +5 −5 webapp/plugins/googleplus/tests/TestOfGooglePlusPlugin.php
  103. +2 −2 webapp/plugins/googleplus/tests/TestOfGooglePlusPluginConfigurationController.php
  104. +4 −4 webapp/plugins/hellothinkup/controller/hellothinkup.php
  105. +3 −3 webapp/plugins/hellothinkup/tests/TestOfHelloThinkUpPlugin.php
  106. +2 −2 webapp/plugins/hellothinkup/tests/TestOfHelloThinkUpPluginConfigurationController.php
  107. +4 −4 webapp/plugins/twitter/controller/twitter.php
  108. +19 −19 webapp/plugins/twitter/model/class.TwitterPlugin.php
  109. +10 −10 webapp/plugins/twitter/tests/TestOfTwitterCrawler.php
  110. +5 −5 webapp/plugins/twitter/tests/TestOfTwitterPlugin.php
  111. +2 −2 webapp/plugins/twitter/tests/TestOfTwitterPluginConfigurationController.php
  112. +0 −1 webapp/plugins/twitterrealtime/controller/class.TwitterRealtimePluginConfigurationController.php
  113. +4 −4 webapp/plugins/twitterrealtime/controller/twitterrealtime.php
  114. +3 −3 webapp/plugins/twitterrealtime/tests/TestOfTwitterRealtimePlugin.php
  115. +2 −4 webapp/plugins/twitterrealtime/tests/TestOfTwitterRealtimePluginConfigurationController.php
@@ -87,7 +87,7 @@ public function makeModel() {
}
//instantiate Smarty, assign results to view
- $view_mgr = new SmartyThinkUp();
+ $view_mgr = new ViewManager();
$view_mgr->assign('fields', $columns);
$view_mgr->assign('object_name', $this->object_name);
$view_mgr->assign('parent_name', $this->parent_name);
@@ -218,11 +218,11 @@ cat<< END >>'webapp/plugins/'$plugin_name_lcase'/controller/'$plugin_name_lcase'
* @copyright 2012 (Your Name)
*/
-\$webapp = Webapp::getInstance();
-\$webapp->registerPlugin('$plugin_name_lcase', '$1Plugin');
+\$webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
+\$webapp_plugin_registrar->registerPlugin('$plugin_name_lcase', '$1Plugin');
-\$crawler = Crawler::getInstance();
-\$crawler->registerCrawlerPlugin('$1Plugin');
+\$crawler_plugin_registrar = PluginRegistrarCrawler::getInstance();
+\$crawler_plugin_registrar->registerCrawlerPlugin('$1Plugin');
END
@@ -328,9 +328,9 @@ class TestOf$1Plugin extends ThinkUpUnitTestCase {
public function setUp(){
parent::setUp();
- \$webapp = Webapp::getInstance();
- \$webapp->registerPlugin('$1', '$1Plugin');
- \$webapp->setActivePlugin('$1');
+ \$webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
+ \$webapp_plugin_registrar->registerPlugin('$1', '$1Plugin');
+ \$webapp_plugin_registrar->setActivePlugin('$1');
}
public function tearDown() {
@@ -360,8 +360,8 @@ class TestOf$1PluginConfigurationController extends ThinkUpUnitTestCase {
public function setUp(){
parent::setUp();
- \$webapp = Webapp::getInstance();
- \$webapp->registerPlugin('$1', '$1Plugin');
+ \$webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
+ \$webapp_plugin_registrar->registerPlugin('$1', '$1Plugin');
\$_SERVER['SERVER_NAME'] = 'dev.thinkup.com';
}
@@ -44,8 +44,8 @@ class TestOfAccountConfigurationController extends ThinkUpUnitTestCase {
public function setUp(){
parent::setUp();
- $webapp = Webapp::getInstance();
- $webapp->registerPlugin('twitter', 'TwitterPlugin');
+ $webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
+ $webapp_plugin_registrar->registerPlugin('twitter', 'TwitterPlugin');
$this->builders = self::buildData();
$_SERVER['HTTP_HOST'] = "mytesthost";
$_SERVER['SERVER_NAME'] = 'dev.thinkup.com';
@@ -33,7 +33,6 @@
}
class TestOfBackupController extends ThinkUpUnitTestCase {
-
public function setUp() {
parent::setUp();
new BackupMySQLDAO();
@@ -139,7 +138,6 @@ public function testBackup() {
$controller->go();
$results = ob_get_contents();
ob_end_clean();
-
// write downloaded zip file to disk...
$fh = fopen($this->backup_test, 'wb');
fwrite($fh, $results);
View
@@ -45,54 +45,54 @@ public function tearDown() {
* Test Crawler singleton instantiation
*/
public function testCrawlerSingleton() {
- $crawler = Crawler::getInstance();
- $this->assertTrue(isset($crawler));
+ $crawler_plugin_registrar = PluginRegistrarCrawler::getInstance();
+ $this->assertTrue(isset($crawler_plugin_registrar));
//clean copy of crawler, no registered plugins, will throw exception
$this->expectException( new PluginNotFoundException("hellothinkup") );
- $this->assertEqual($crawler->getPluginObject("hellothinkup"), "HelloThinkUpPlugin");
+ $this->assertEqual($crawler_plugin_registrar->getPluginObject("hellothinkup"), "HelloThinkUpPlugin");
//register a plugin
- $crawler->registerPlugin('hellothinkup', 'HelloThinkUpPlugin');
- $this->assertEqual($crawler->getPluginObject("hellothinkup"), "HelloThinkUpPlugin");
+ $crawler_plugin_registrar->registerPlugin('hellothinkup', 'HelloThinkUpPlugin');
+ $this->assertEqual($crawler_plugin_registrar->getPluginObject("hellothinkup"), "HelloThinkUpPlugin");
//make sure singleton still has those values
- $crawler_two = Crawler::getInstance();
- $this->assertEqual($crawler->getPluginObject("hellothinkup"), "HelloThinkUpPlugin");
+ $crawler_plugin_registrar_two = PluginRegistrarCrawler::getInstance();
+ $this->assertEqual($crawler_plugin_registrar->getPluginObject("hellothinkup"), "HelloThinkUpPlugin");
}
/**
* Test Crawler->crawl
*/
public function testCrawl() {
- $crawler = Crawler::getInstance();
+ $crawler_plugin_registrar = PluginRegistrarCrawler::getInstance();
- // $crawler->registerPlugin('nonexistent', 'TestFauxPluginOne');
- // $crawler->registerCrawlerPlugin('TestFauxPluginOne');
+ // $crawler_plugin_registrar->registerPlugin('nonexistent', 'TestFauxPluginOne');
+ // $crawler_plugin_registrar->registerCrawlerPlugin('TestFauxPluginOne');
// $this->expectException( new Exception("The TestFauxPluginOne object does not have a crawl method.") );
- // $crawler->crawl();
+ // $crawler_plugin_registrar->runRegisteredPluginsCrawl();
- $crawler->registerPlugin('hellothinkup', 'HelloThinkUpPlugin');
- $crawler->registerCrawlerPlugin('HelloThinkUpPlugin');
- $this->assertEqual($crawler->getPluginObject("hellothinkup"), "HelloThinkUpPlugin");
+ $crawler_plugin_registrar->registerPlugin('hellothinkup', 'HelloThinkUpPlugin');
+ $crawler_plugin_registrar->registerCrawlerPlugin('HelloThinkUpPlugin');
+ $this->assertEqual($crawler_plugin_registrar->getPluginObject("hellothinkup"), "HelloThinkUpPlugin");
$builders = $this->buildData();
$this->simulateLogin('admin@example.com', true);
- $crawler->crawl();
+ $crawler_plugin_registrar->runRegisteredPluginsCrawl();
$this->simulateLogin('me@example.com');
- $crawler->crawl();
+ $crawler_plugin_registrar->runRegisteredPluginsCrawl();
Session::logout();
$this->expectException(new UnauthorizedUserException('You need a valid session to launch the crawler.'));
- $crawler->crawl();
+ $crawler_plugin_registrar->runRegisteredPluginsCrawl();
}
public function testCrawlUnauthorized() {
$builders = $this->buildData();
- $crawler = Crawler::getInstance();
- $crawler->registerPlugin('hellothinkup', 'HelloThinkUpPlugin');
- $crawler->registerCrawlerPlugin('HelloThinkUpPlugin');
+ $crawler_plugin_registrar = PluginRegistrarCrawler::getInstance();
+ $crawler_plugin_registrar->registerPlugin('hellothinkup', 'HelloThinkUpPlugin');
+ $crawler_plugin_registrar->registerCrawlerPlugin('HelloThinkUpPlugin');
$this->expectException(new UnauthorizedUserException('You need a valid session to launch the crawler.'));
- $crawler->crawl();
+ $crawler_plugin_registrar->runRegisteredPluginsCrawl();
}
public function testCrawlUpgrading() {
@@ -102,13 +102,13 @@ public function testCrawlUpgrading() {
$config->setValue('THINKUP_VERSION', $config->getValue('THINKUP_VERSION') + 10); //set a high version num
$builders = $this->buildData();
- $crawler = Crawler::getInstance();
- $crawler->registerPlugin('hellothinkup', 'HelloThinkUpPlugin');
- $crawler->registerCrawlerPlugin('HelloThinkUpPlugin');
+ $crawler_plugin_registrar = PluginRegistrarCrawler::getInstance();
+ $crawler_plugin_registrar->registerPlugin('hellothinkup', 'HelloThinkUpPlugin');
+ $crawler_plugin_registrar->registerCrawlerPlugin('HelloThinkUpPlugin');
$this->simulateLogin('admin@example.com', true);
$this->expectException(
new InstallerException('ThinkUp needs a database migration, so we are unable to run the crawler.'));
- $crawler->crawl();
+ $crawler_plugin_registrar->runRegisteredPluginsCrawl();
// reset version
$config->setValue('THINKUP_VERSION', $init_db_version);
}
@@ -37,10 +37,10 @@ class TestOfDashboardController extends ThinkUpUnitTestCase {
public function setUp(){
parent::setUp();
- $webapp = Webapp::getInstance();
- $webapp->registerPlugin('twitter', 'TwitterPlugin');
- $webapp->registerPlugin('facebook', 'FacebookPlugin');
- $webapp->registerPlugin('google+', 'GooglePlusPlugin');
+ $webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
+ $webapp_plugin_registrar->registerPlugin('twitter', 'TwitterPlugin');
+ $webapp_plugin_registrar->registerPlugin('facebook', 'FacebookPlugin');
+ $webapp_plugin_registrar->registerPlugin('google+', 'GooglePlusPlugin');
}
public function testConstructor() {
@@ -1,7 +1,7 @@
<?php
/**
*
- * ThinkUp/tests/TestOfInsightsGenerator.php
+ * ThinkUp/tests/TestOfDashboardModuleCacher.php
*
* Copyright (c) 2012 Gina Trapani
*
@@ -30,7 +30,7 @@
require_once THINKUP_WEBAPP_PATH.'_lib/extlib/simpletest/autorun.php';
require_once THINKUP_WEBAPP_PATH.'config.inc.php';
-class TestOfInsightsGenerator extends ThinkUpUnitTestCase {
+class TestOfDashboardModuleCacher extends ThinkUpUnitTestCase {
public function setUp() {
parent::setUp();
}
@@ -54,7 +54,7 @@ public function testGetHotPostVisualizationData() {
)
);
- $result = InsightsGenerator::getHotPostVisualizationData($hot_posts, 'twitter');
+ $result = DashboardModuleCacher::getHotPostVisualizationData($hot_posts, 'twitter');
$this->assertEqual(gettype($result), 'string');
$visualization_object = json_decode($result);
@@ -71,7 +71,7 @@ public function testGetHotPostVisualizationData() {
$this->assertEqual($visualization_object->rows[0]->c[2]->v, 2);
$this->assertEqual($visualization_object->rows[0]->c[3]->v, 1);
- $result = InsightsGenerator::getHotPostVisualizationData($hot_posts, 'facebook');
+ $result = DashboardModuleCacher::getHotPostVisualizationData($hot_posts, 'facebook');
$this->assertEqual(gettype($result), 'string');
$visualization_object = json_decode($result);
@@ -95,7 +95,7 @@ public function testGetClientVisualizationData() {
'Client 2' => 10,
);
- $result = InsightsGenerator::getClientUsageVisualizationData($client_data);
+ $result = DashboardModuleCacher::getClientUsageVisualizationData($client_data);
$this->assertEqual(gettype($result), 'string');
$visualization_object = json_decode($result);
@@ -124,7 +124,7 @@ public function testGetClickStatsVisualizationData() {
'click_count' => 23),
);
- $result = InsightsGenerator::getClickStatsVisualizationData($click_stats);
+ $result = DashboardModuleCacher::getClickStatsVisualizationData($click_stats);
$this->assertEqual(gettype($result), 'string');
$visualization_object = json_decode($result);
@@ -35,8 +35,8 @@ class TestOfGridController extends ThinkUpUnitTestCase {
public function setUp(){
parent::setUp();
- $webapp = Webapp::getInstance();
- $webapp->registerPlugin('twitter', 'TwitterPlugin');
+ $webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
+ $webapp_plugin_registrar->registerPlugin('twitter', 'TwitterPlugin');
}
public function tearDown() {
View
@@ -48,9 +48,10 @@ public function testLoaderRegisterDefault() {
// check default lookup path without additionalPath
$this->assertEqual( Loader::getLookupPath(), array(
+ THINKUP_WEBAPP_PATH . '_lib/',
THINKUP_WEBAPP_PATH . '_lib/model/',
THINKUP_WEBAPP_PATH . '_lib/controller/',
- THINKUP_WEBAPP_PATH . '_lib/model/exceptions/'
+ THINKUP_WEBAPP_PATH . '_lib/exceptions/'
));
// check special classes
@@ -67,9 +68,10 @@ public function testLoaderRegisterWithStringAdditionalPath() {
// check lookup path with single additionalPath
$this->assertEqual( Loader::getLookupPath(), array(
+ THINKUP_WEBAPP_PATH . '_lib/',
THINKUP_WEBAPP_PATH . '_lib/model/',
THINKUP_WEBAPP_PATH . '_lib/controller/',
- THINKUP_WEBAPP_PATH . '_lib/model/exceptions/',
+ THINKUP_WEBAPP_PATH . '_lib/exceptions/',
THINKUP_ROOT_PATH . 'tests/classes'
));
}
@@ -86,9 +88,10 @@ public function testLoaderRegisterWithArrayAdditionalPaths() {
// check lookup path with array additionalPath
$this->assertEqual( Loader::getLookupPath(), array(
+ THINKUP_WEBAPP_PATH . '_lib/',
THINKUP_WEBAPP_PATH . '_lib/model/',
THINKUP_WEBAPP_PATH . '_lib/controller/',
- THINKUP_WEBAPP_PATH . '_lib/model/exceptions/',
+ THINKUP_WEBAPP_PATH . '_lib/exceptions/',
THINKUP_ROOT_PATH . 'tests',
THINKUP_ROOT_PATH . 'tests/classes'
));
@@ -112,7 +115,7 @@ public function testLoaderInstantiateClasses() {
$this->assertClassInstantiates('Instance');
$this->assertClassInstantiates('User');
- $this->assertIsA(new Crawler, 'Crawler');
+ $this->assertIsA(new PluginRegistrarCrawler, 'PluginRegistrarCrawler');
$this->assertIsA(new DAOFactory, 'DAOFactory');
$this->assertIsA(Config::getInstance(), 'Config');
@@ -122,16 +125,18 @@ public function testLoaderInstantiateClasses() {
public function testAdditionalPathAfterInitialRegister() {
Loader::register();
$this->assertEqual( Loader::getLookupPath(), array(
+ THINKUP_WEBAPP_PATH . '_lib/',
THINKUP_WEBAPP_PATH . '_lib/model/',
THINKUP_WEBAPP_PATH . '_lib/controller/',
- THINKUP_WEBAPP_PATH . '_lib/model/exceptions/',
+ THINKUP_WEBAPP_PATH . '_lib/exceptions/',
));
Loader::addPath(THINKUP_ROOT_PATH . 'tests/classes');
$this->assertEqual( Loader::getLookupPath(), array(
+ THINKUP_WEBAPP_PATH . '_lib/',
THINKUP_WEBAPP_PATH . '_lib/model/',
THINKUP_WEBAPP_PATH . '_lib/controller/',
- THINKUP_WEBAPP_PATH . '_lib/model/exceptions/',
+ THINKUP_WEBAPP_PATH . '_lib/exceptions/',
THINKUP_ROOT_PATH . 'tests/classes'
));
}
@@ -1,7 +1,7 @@
<?php
/**
*
- * ThinkUp/tests/TestOfPluginHook.php
+ * ThinkUp/tests/TestOfPluginRegistrar.php
*
* Copyright (c) 2009-2012 Gina Trapani
*
@@ -20,7 +20,7 @@
* You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
* <http://www.gnu.org/licenses/>.
*
- * Test of PluginHook class
+ * Test of PluginRegistrar class
* @license http://www.gnu.org/licenses/gpl.html
* @copyright 2009-2012 Gina Trapani
* @author Gina Trapani <ginatrapani[at]gmail[dot]com>
@@ -29,7 +29,7 @@
require_once THINKUP_WEBAPP_PATH.'_lib/extlib/simpletest/autorun.php';
require_once THINKUP_WEBAPP_PATH.'config.inc.php';
-class TestOfPluginHook extends ThinkUpBasicUnitTestCase {
+class TestOfPluginRegistrar extends ThinkUpBasicUnitTestCase {
/**
* Test registerPlugin
@@ -66,7 +66,7 @@ public function testRegisterPerformAppFunction() {
//register an object without the right method
$test_ph->registerPerformAppFunction('TestFauxPluginOne');
$this->expectException(new
- Exception("The TestFauxPluginOne object does not have a performAppFunction method."));
+ Exception("The TestFauxPluginOne object does not have a performAppFunction function."));
$test_ph->performAppFunction();
}
}
@@ -41,8 +41,8 @@
class TestOfPostController extends ThinkUpUnitTestCase {
public function setUp(){
parent::setUp();
- $webapp = Webapp::getInstance();
- $webapp->registerPlugin('twitter', 'TwitterPlugin');
+ $webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
+ $webapp_plugin_registrar->registerPlugin('twitter', 'TwitterPlugin');
$this->config = Config::getInstance();
}
@@ -39,8 +39,8 @@ class TestOfRegisterController extends ThinkUpUnitTestCase {
public function setUp() {
parent::setUp();
- $webapp = Webapp::getInstance();
- $webapp->registerPlugin('twitter', 'TwitterPlugin');
+ $webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
+ $webapp_plugin_registrar->registerPlugin('twitter', 'TwitterPlugin');
}
public function tearDown() {
@@ -32,8 +32,8 @@ class TestOfThreadJSController extends ThinkUpUnitTestCase {
public function setUp() {
parent::setUp();
- $webapp = Webapp::getInstance();
- $webapp->registerPlugin('embedthread', 'EmbedThreadPlugin');
+ $webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
+ $webapp_plugin_registrar->registerPlugin('embedthread', 'EmbedThreadPlugin');
}
//test plugin not enabled
@@ -115,8 +115,8 @@ public function testBothParamsExistentInstanceNoCSRFToken() {
}
public function testBothParamsExistentInstanceDeactivateCallback() {
- $webapp = Webapp::getInstance();
- $webapp->registerPlugin('twitter', "TwitterPlugin");
+ $webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
+ $webapp_plugin_registrar->registerPlugin('twitter', "TwitterPlugin");
//set up 2 active Twitter instances
$instance_builder_1 = FixtureBuilder::build('instances', array('network_username'=>'julie',
Oops, something went wrong.

0 comments on commit 6225836

Please sign in to comment.