aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/lib/classes/PluginRepositoryTest.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:07:19 +0200
committerJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:19:12 +0200
commita3da1483a9e689846179159355badfec8073dbec (patch)
tree770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /tests/unit/lib/classes/PluginRepositoryTest.php
current code from svn, revision 62608
Diffstat (limited to 'tests/unit/lib/classes/PluginRepositoryTest.php')
-rw-r--r--tests/unit/lib/classes/PluginRepositoryTest.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/unit/lib/classes/PluginRepositoryTest.php b/tests/unit/lib/classes/PluginRepositoryTest.php
new file mode 100644
index 0000000..aa7366f
--- /dev/null
+++ b/tests/unit/lib/classes/PluginRepositoryTest.php
@@ -0,0 +1,51 @@
+<?php
+/*
+ * plugin_repository_test.php - unit tests for the PluginRepository class
+ *
+ * Copyright (c) 2009 Elmar Ludwig
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+require_once 'lib/plugins/engine/PluginRepository.class.php';
+
+class PluginRepositoryTest extends \Codeception\Test\Unit
+{
+ public function setUp ()
+ {
+ $GLOBALS['SOFTWARE_VERSION'] = '1.9.0';
+ $GLOBALS['CACHING_ENABLE'] = false;
+
+ $url = 'file://'.dirname(__FILE__).'/plugin_repository_test.xml';
+ $this->repository = new PluginRepository($url);
+ }
+
+ public function testGetPlugin ()
+ {
+ $data = $this->repository->getPlugin('Alija');
+
+ $this->assertSame($data['version'], '0.5');
+ $this->assertSame($data['url'],
+ 'http://plugins.studip.de/uploads/Plugins/alija-0.5.zip');
+
+ $this->assertNull($this->repository->getPlugin('Vips'));
+ $this->assertNull($this->repository->getPlugin('Unknown'));
+ }
+
+ public function testGetPlugins ()
+ {
+ $plugins = $this->repository->getPlugins();
+
+ $this->assertEquals(2, count($plugins));
+ $this->assertNotNull($plugins['Alija']);
+ $this->assertNotNull($plugins['TracTickets']);
+
+ $plugins = $this->repository->getPlugins('Ticket');
+
+ $this->assertEquals(1, count($plugins));
+ $this->assertNotNull($plugins['TracTickets']);
+ }
+}