Adding tests for securing private variable inclussion on templates.
[akelos.git] / test / unit / lib / AkPlugin / AkPluginManager.php
blob4e7f5cd386aa51e5129a721833eccdc37d45468e
1 <?php
3 require_once(AK_LIB_DIR.DS.'AkPlugin'.DS.'AkPluginManager.php');
5 class AkPluginManagerTestCase extends AkUnitTest
7 function test_remove_repositories_config()
9 @Ak::file_delete(AK_CONFIG_DIR.DS.'plugin_repositories.txt');
12 function setup()
14 $this->PluginManager =& new AkPluginManager();
15 @Ak::file_delete(AK_TMP_DIR.DS.'plugin_repositories.yaml');
18 function test_should_get_available_repositories()
20 $repositories = $this->PluginManager->getAvailableRepositories();
21 $this->assertTrue(in_array('http://svn.akelos.org/plugins', $repositories));
24 function test_should_add_new_repository()
26 $this->PluginManager->addRepository('http://svn.editam.com/plugins');
27 $this->PluginManager->addRepository('http://svn.example.com/plugins');
28 $repositories = $this->PluginManager->getAvailableRepositories();
29 $this->assertTrue(in_array('http://svn.akelos.org/plugins', $repositories));
30 $this->assertTrue(in_array('http://svn.editam.com/plugins', $repositories));
33 function test_should_remove_repository()
35 $repositories = $this->PluginManager->getAvailableRepositories(true);
36 $this->assertEqual(count($repositories), 3);
38 $this->PluginManager->removeRepository('http://svn.editam.com/plugins');
39 $repositories = $this->PluginManager->getAvailableRepositories(true);
40 $this->assertFalse(in_array('http://svn.editam.com/plugins', $repositories));
41 $this->assertEqual(count($repositories), 2);
43 $this->PluginManager->removeRepository('http://svn.example.com/plugins');
44 $repositories = $this->PluginManager->getAvailableRepositories(true);
45 $this->assertEqual(count($repositories), 1);
48 function test_should_get_remote_plugin_list()
50 $plugins = $this->PluginManager->getPlugins();
51 $this->assertEqual($plugins['acts_as_versioned'], 'http://svn.akelos.org/plugins');
54 function test_should_install_plugin()
56 $this->PluginManager->installPlugin('acts_as_versioned');
57 $this->assertTrue(in_array('acts_as_versioned', $this->PluginManager->getInstalledPlugins()));
60 function test_should_update_plugin()
62 Ak::directory_delete(AK_PLUGINS_DIR.DS.'acts_as_versioned'.DS.'lib');
63 $this->assertFalse(file_exists(AK_PLUGINS_DIR.DS.'acts_as_versioned'.DS.'lib'.DS.'ActsAsVersioned.php'));
64 $this->PluginManager->updatePlugin('acts_as_versioned');
65 $this->assertTrue(file_exists(AK_PLUGINS_DIR.DS.'acts_as_versioned'.DS.'lib'.DS.'ActsAsVersioned.php'));
68 function test_should_uninstall_plugin()
70 $this->PluginManager->uninstallPlugin('acts_as_versioned');
71 $this->assertFalse(is_dir(AK_PLUGINS_DIR.DS.'acts_as_versioned'));
74 function test_should_get_remote_repositories_listing()
76 $repositories = $this->PluginManager->_getRepositoriesFromRemotePage();
77 $this->assertEqual($repositories[0], $this->PluginManager->main_repository);