From 29be333cec6af40446e864cb3c65f9f2ad0e7e82 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 16 Oct 2021 15:24:40 -0400 Subject: [PATCH] Add test for public value of Depository\PermissionSet->selectOneById --- .../Depository/PermissionSetTest.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/src/Security/PermissionSet/Depository/PermissionSetTest.php diff --git a/tests/src/Security/PermissionSet/Depository/PermissionSetTest.php b/tests/src/Security/PermissionSet/Depository/PermissionSetTest.php new file mode 100644 index 000000000..305769411 --- /dev/null +++ b/tests/src/Security/PermissionSet/Depository/PermissionSetTest.php @@ -0,0 +1,40 @@ +addRules(include __DIR__ . '/../../../../../static/dependencies.config.php') + ->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true]); + DI::init($dice); + + $this->depository = DI::permissionSet(); + } + + public function testSelectOneByIdPublicMissingUid() + { + $this->expectException(\InvalidArgumentException::class); + + $this->depository->selectOneById(PermissionSet::PUBLIC); + } + + public function testSelectOneByIdPublic() + { + $permissionSet = $this->depository->selectOneById(PermissionSet::PUBLIC, 1); + + $this->assertInstanceOf(\Friendica\Security\PermissionSet\Entity\PermissionSet::class, $permissionSet); + } +}