diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-07-23 11:00:29 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-07-23 11:00:29 +0200 |
commit | 02323eca01231cfa86ea8437e998988043d40455 (patch) | |
tree | 62d1e925060c7a7a4be553a2ef88dc66e88233b1 /tests | |
parent | 9ccf94ca06806ad5312d3ac06b8b25388f3ec5f4 (diff) | |
download | nextcloud-server-02323eca01231cfa86ea8437e998988043d40455.tar.gz nextcloud-server-02323eca01231cfa86ea8437e998988043d40455.zip |
Throw a InvalidArgumentException when a consumer/extension is invalid
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/activitymanager.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/lib/activitymanager.php b/tests/lib/activitymanager.php index a35daeaf494..28caf575948 100644 --- a/tests/lib/activitymanager.php +++ b/tests/lib/activitymanager.php @@ -41,6 +41,9 @@ class Test_ActivityManager extends \Test\TestCase { $this->config ); + $this->activityManager->registerConsumer(function() { + return new NoOpConsumer(); + }); $this->activityManager->registerExtension(function() { return new NoOpExtension(); }); @@ -49,6 +52,40 @@ class Test_ActivityManager extends \Test\TestCase { }); } + public function testGetConsumers() { + $consumers = $this->invokePrivate($this->activityManager, 'getConsumers'); + + $this->assertNotEmpty($consumers); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testGetConsumersInvalidConsumer() { + $this->activityManager->registerConsumer(function() { + return new StdClass(); + }); + + $this->invokePrivate($this->activityManager, 'getConsumers'); + } + + public function testGetExtensions() { + $extensions = $this->invokePrivate($this->activityManager, 'getExtensions'); + + $this->assertNotEmpty($extensions); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testGetExtensionsInvalidExtension() { + $this->activityManager->registerExtension(function() { + return new StdClass(); + }); + + $this->invokePrivate($this->activityManager, 'getExtensions'); + } + public function testNotificationTypes() { $result = $this->activityManager->getNotificationTypes('en'); $this->assertTrue(is_array($result)); @@ -328,3 +365,9 @@ class NoOpExtension implements \OCP\Activity\IExtension { return false; } } + +class NoOpConsumer implements \OCP\Activity\IConsumer { + + public function receive($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority) { + } +} |