Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Hooks/BasicEmitterTest.php')
-rw-r--r--tests/lib/Hooks/BasicEmitterTest.php54
1 files changed, 27 insertions, 27 deletions
diff --git a/tests/lib/Hooks/BasicEmitterTest.php b/tests/lib/Hooks/BasicEmitterTest.php
index 948659faaba..1f88dee1032 100644
--- a/tests/lib/Hooks/BasicEmitterTest.php
+++ b/tests/lib/Hooks/BasicEmitterTest.php
@@ -50,28 +50,28 @@ class BasicEmitterTest extends \Test\TestCase {
throw new EmittedException;
}
- /**
- * @expectedException \Test\Hooks\EmittedException
- */
+
public function testAnonymousFunction() {
+ $this->expectException(\Test\Hooks\EmittedException::class);
+
$this->emitter->listen('Test', 'test', function () {
throw new EmittedException;
});
$this->emitter->emitEvent('Test', 'test');
}
- /**
- * @expectedException \Test\Hooks\EmittedException
- */
+
public function testStaticCallback() {
+ $this->expectException(\Test\Hooks\EmittedException::class);
+
$this->emitter->listen('Test', 'test', array('\Test\Hooks\BasicEmitterTest', 'staticCallBack'));
$this->emitter->emitEvent('Test', 'test');
}
- /**
- * @expectedException \Test\Hooks\EmittedException
- */
+
public function testNonStaticCallback() {
+ $this->expectException(\Test\Hooks\EmittedException::class);
+
$this->emitter->listen('Test', 'test', array($this, 'nonStaticCallBack'));
$this->emitter->emitEvent('Test', 'test');
}
@@ -125,10 +125,10 @@ class BasicEmitterTest extends \Test\TestCase {
$this->assertEquals(2, $count, 'Listener called an invalid number of times (' . $count . ') expected 2');
}
- /**
- * @expectedException \Test\Hooks\EmittedException
- */
+
public function testArguments() {
+ $this->expectException(\Test\Hooks\EmittedException::class);
+
$this->emitter->listen('Test', 'test', function ($foo, $bar) {
if ($foo == 'foo' and $bar == 'bar') {
throw new EmittedException;
@@ -137,10 +137,10 @@ class BasicEmitterTest extends \Test\TestCase {
$this->emitter->emitEvent('Test', 'test', array('foo', 'bar'));
}
- /**
- * @expectedException \Test\Hooks\EmittedException
- */
+
public function testNamedArguments() {
+ $this->expectException(\Test\Hooks\EmittedException::class);
+
$this->emitter->listen('Test', 'test', function ($foo, $bar) {
if ($foo == 'foo' and $bar == 'bar') {
throw new EmittedException;
@@ -216,10 +216,10 @@ class BasicEmitterTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- /**
- * @expectedException \Test\Hooks\EmittedException
- */
+
public function testRemoveKeepOtherCallback() {
+ $this->expectException(\Test\Hooks\EmittedException::class);
+
$listener1 = function () {
throw new EmittedException;
};
@@ -234,10 +234,10 @@ class BasicEmitterTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- /**
- * @expectedException \Test\Hooks\EmittedException
- */
+
public function testRemoveKeepOtherMethod() {
+ $this->expectException(\Test\Hooks\EmittedException::class);
+
$listener = function () {
throw new EmittedException;
};
@@ -249,10 +249,10 @@ class BasicEmitterTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- /**
- * @expectedException \Test\Hooks\EmittedException
- */
+
public function testRemoveKeepOtherScope() {
+ $this->expectException(\Test\Hooks\EmittedException::class);
+
$listener = function () {
throw new EmittedException;
};
@@ -264,10 +264,10 @@ class BasicEmitterTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- /**
- * @expectedException \Test\Hooks\EmittedException
- */
+
public function testRemoveNonExistingName() {
+ $this->expectException(\Test\Hooks\EmittedException::class);
+
$listener = function () {
throw new EmittedException;
};