From 0f752ff91bcb382a82a3c6c5158fd3b7ba6f94fd Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 17 Oct 2021 23:42:13 +0200 Subject: [PATCH] Fix tests --- .../Profile/ProfileField/Depository/ProfileFieldTest.php | 9 ++++----- .../PermissionSet/Depository/PermissionSetTest.php | 6 ++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/src/Profile/ProfileField/Depository/ProfileFieldTest.php b/tests/src/Profile/ProfileField/Depository/ProfileFieldTest.php index 2218deebb3..c5350d0fed 100644 --- a/tests/src/Profile/ProfileField/Depository/ProfileFieldTest.php +++ b/tests/src/Profile/ProfileField/Depository/ProfileFieldTest.php @@ -4,7 +4,6 @@ namespace Friendica\Test\src\Profile\ProfileField\Depository; use Dice\Dice; use Friendica\Database\Database; -use Friendica\DI; use Friendica\Profile\ProfileField\Depository\ProfileField as ProfileFieldDepository; use Friendica\Profile\ProfileField\Entity\ProfileField; use Friendica\Profile\ProfileField\Exception\ProfileFieldPersistenceException; @@ -51,7 +50,7 @@ class ProfileFieldTest extends DatabaseTest self::expectExceptionMessage('PermissionSet needs to be saved first.'); self::expectException(ProfileFieldPersistenceException::class); - $this->loadFixture(__DIR__ . '/../../../../datasets/api.fixture.php', DI::dba()); + $this->loadFixture(__DIR__ . '/../../../../datasets/api.fixture.php', $this->dba); $profileField = $this->factory->createFromValues(42, 0, 'public', 'value', $this->permissionSetFactory->createFromString(42, '', '<~>')); @@ -65,7 +64,7 @@ class ProfileFieldTest extends DatabaseTest */ public function testSaveNew() { - $this->loadFixture(__DIR__ . '/../../../../datasets/api.fixture.php', DI::dba()); + $this->loadFixture(__DIR__ . '/../../../../datasets/api.fixture.php', $this->dba); $profileField = $this->factory->createFromValues(42, 0, 'public', 'value', $this->permissionSetDepository->save($this->permissionSetFactory->createFromString(42, '', '<~>'))); @@ -87,7 +86,7 @@ class ProfileFieldTest extends DatabaseTest */ public function testUpdateOrder() { - $this->loadFixture(__DIR__ . '/../../../../datasets/api.fixture.php', DI::dba()); + $this->loadFixture(__DIR__ . '/../../../../datasets/api.fixture.php', $this->dba); $profileField = $this->factory->createFromValues(42, 0, 'public', 'value', $this->permissionSetDepository->save($this->permissionSetFactory->createFromString(42, '', '<~>'))); @@ -120,7 +119,7 @@ class ProfileFieldTest extends DatabaseTest */ public function testUpdate() { - $this->loadFixture(__DIR__ . '/../../../../datasets/api.fixture.php', DI::dba()); + $this->loadFixture(__DIR__ . '/../../../../datasets/api.fixture.php', $this->dba); $profileField = $this->factory->createFromValues(42, 0, 'public', 'value', $this->permissionSetDepository->save($this->permissionSetFactory->createFromString(42, '', '<~>'))); diff --git a/tests/src/Security/PermissionSet/Depository/PermissionSetTest.php b/tests/src/Security/PermissionSet/Depository/PermissionSetTest.php index f5d2e22c64..3f36e3bca2 100644 --- a/tests/src/Security/PermissionSet/Depository/PermissionSetTest.php +++ b/tests/src/Security/PermissionSet/Depository/PermissionSetTest.php @@ -4,7 +4,6 @@ namespace Friendica\Test\src\Security\PermissionSet\Depository; use Dice\Dice; use Friendica\Database\Database; -use Friendica\DI; use Friendica\Security\PermissionSet\Depository\PermissionSet as PermissionSetDepository; use Friendica\Security\PermissionSet\Factory\PermissionSet as PermissionSetFactory; use Friendica\Test\DatabaseTest; @@ -16,6 +15,8 @@ class PermissionSetTest extends DatabaseTest private $depository; /** @var PermissionSetFactory */ private $factory; + /** @var Database */ + private $dba; public function setUp(): void { @@ -27,6 +28,7 @@ class PermissionSetTest extends DatabaseTest $this->depository = $dice->create(PermissionSetDepository::class); $this->factory = $dice->create(PermissionSetFactory::class); + $this->dba = $dice->create(Database::class); } public function testSelectOneByIdPublic() @@ -47,7 +49,7 @@ class PermissionSetTest extends DatabaseTest */ public function testSaving() { - $this->loadFixture(__DIR__ . '/../../../../datasets/api.fixture.php', DI::dba()); + $this->loadFixture(__DIR__ . '/../../../../datasets/api.fixture.php', $this->dba); $permissionSet = $this->factory->createFromString(42, '', '<~>');