aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework/Utility/SimpleContainerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/AppFramework/Utility/SimpleContainerTest.php')
-rw-r--r--tests/lib/AppFramework/Utility/SimpleContainerTest.php47
1 files changed, 23 insertions, 24 deletions
diff --git a/tests/lib/AppFramework/Utility/SimpleContainerTest.php b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
index a1cc1e76aeb..93db01d3bc8 100644
--- a/tests/lib/AppFramework/Utility/SimpleContainerTest.php
+++ b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Test\AppFramework\Utility;
use OC\AppFramework\Utility\SimpleContainer;
+use OCP\AppFramework\QueryException;
use Psr\Container\NotFoundExceptionInterface;
interface TestInterface {
@@ -20,42 +21,40 @@ class ClassEmptyConstructor implements IInterfaceConstructor {
}
class ClassSimpleConstructor implements IInterfaceConstructor {
- public $test;
- public function __construct($test) {
- $this->test = $test;
+ public function __construct(
+ public $test,
+ ) {
}
}
class ClassComplexConstructor {
- public $class;
- public $test;
- public function __construct(ClassSimpleConstructor $class, $test) {
- $this->class = $class;
- $this->test = $test;
+ public function __construct(
+ public ClassSimpleConstructor $class,
+ public $test,
+ ) {
}
}
class ClassNullableUntypedConstructorArg {
- public $class;
- public function __construct($class) {
- $this->class = $class;
+ public function __construct(
+ public $class,
+ ) {
}
}
class ClassNullableTypedConstructorArg {
- public $class;
- public function __construct(?\Some\Class $class) {
- $this->class = $class;
+ public function __construct(
+ public ?\Some\Class $class,
+ ) {
}
}
interface IInterfaceConstructor {
}
class ClassInterfaceConstructor {
- public $class;
- public $test;
- public function __construct(IInterfaceConstructor $class, $test) {
- $this->class = $class;
- $this->test = $test;
+ public function __construct(
+ public IInterfaceConstructor $class,
+ public $test,
+ ) {
}
}
@@ -83,7 +82,7 @@ class SimpleContainerTest extends \Test\TestCase {
$this->container->query('something really hard', false);
$this->fail('Expected `QueryException` exception was not thrown');
} catch (\Throwable $exception) {
- $this->assertInstanceOf(\OCP\AppFramework\QueryException::class, $exception);
+ $this->assertInstanceOf(QueryException::class, $exception);
$this->assertInstanceOf(NotFoundExceptionInterface::class, $exception);
}
}
@@ -97,7 +96,7 @@ class SimpleContainerTest extends \Test\TestCase {
$this->container->query('something really hard');
$this->fail('Expected `QueryException` exception was not thrown');
} catch (\Throwable $exception) {
- $this->assertInstanceOf(\OCP\AppFramework\QueryException::class, $exception);
+ $this->assertInstanceOf(QueryException::class, $exception);
$this->assertInstanceOf(NotFoundExceptionInterface::class, $exception);
}
}
@@ -105,7 +104,7 @@ class SimpleContainerTest extends \Test\TestCase {
public function testNotAClass(): void {
- $this->expectException(\OCP\AppFramework\QueryException::class);
+ $this->expectException(QueryException::class);
$this->container->query('Test\AppFramework\Utility\TestInterface');
}
@@ -214,7 +213,7 @@ class SimpleContainerTest extends \Test\TestCase {
public function testConstructorComplexNoTestParameterFound(): void {
- $this->expectException(\OCP\AppFramework\QueryException::class);
+ $this->expectException(QueryException::class);
$object = $this->container->query(
'Test\AppFramework\Utility\ClassComplexConstructor'
@@ -245,7 +244,7 @@ class SimpleContainerTest extends \Test\TestCase {
}
public function testQueryUntypedNullable(): void {
- $this->expectException(\OCP\AppFramework\QueryException::class);
+ $this->expectException(QueryException::class);
$object = $this->container->query(
ClassNullableUntypedConstructorArg::class