Fix tests

This commit is contained in:
Philipp 2021-10-17 23:42:13 +02:00
parent bf224b58f8
commit 0f752ff91b
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
2 changed files with 8 additions and 7 deletions

View file

@ -4,7 +4,6 @@ namespace Friendica\Test\src\Profile\ProfileField\Depository;
use Dice\Dice; use Dice\Dice;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\DI;
use Friendica\Profile\ProfileField\Depository\ProfileField as ProfileFieldDepository; use Friendica\Profile\ProfileField\Depository\ProfileField as ProfileFieldDepository;
use Friendica\Profile\ProfileField\Entity\ProfileField; use Friendica\Profile\ProfileField\Entity\ProfileField;
use Friendica\Profile\ProfileField\Exception\ProfileFieldPersistenceException; use Friendica\Profile\ProfileField\Exception\ProfileFieldPersistenceException;
@ -51,7 +50,7 @@ class ProfileFieldTest extends DatabaseTest
self::expectExceptionMessage('PermissionSet needs to be saved first.'); self::expectExceptionMessage('PermissionSet needs to be saved first.');
self::expectException(ProfileFieldPersistenceException::class); 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, '', '<~>')); $profileField = $this->factory->createFromValues(42, 0, 'public', 'value', $this->permissionSetFactory->createFromString(42, '', '<~>'));
@ -65,7 +64,7 @@ class ProfileFieldTest extends DatabaseTest
*/ */
public function testSaveNew() 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, '', '<~>'))); $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() 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, '', '<~>'))); $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() 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, '', '<~>'))); $profileField = $this->factory->createFromValues(42, 0, 'public', 'value', $this->permissionSetDepository->save($this->permissionSetFactory->createFromString(42, '', '<~>')));

View file

@ -4,7 +4,6 @@ namespace Friendica\Test\src\Security\PermissionSet\Depository;
use Dice\Dice; use Dice\Dice;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\DI;
use Friendica\Security\PermissionSet\Depository\PermissionSet as PermissionSetDepository; use Friendica\Security\PermissionSet\Depository\PermissionSet as PermissionSetDepository;
use Friendica\Security\PermissionSet\Factory\PermissionSet as PermissionSetFactory; use Friendica\Security\PermissionSet\Factory\PermissionSet as PermissionSetFactory;
use Friendica\Test\DatabaseTest; use Friendica\Test\DatabaseTest;
@ -16,6 +15,8 @@ class PermissionSetTest extends DatabaseTest
private $depository; private $depository;
/** @var PermissionSetFactory */ /** @var PermissionSetFactory */
private $factory; private $factory;
/** @var Database */
private $dba;
public function setUp(): void public function setUp(): void
{ {
@ -27,6 +28,7 @@ class PermissionSetTest extends DatabaseTest
$this->depository = $dice->create(PermissionSetDepository::class); $this->depository = $dice->create(PermissionSetDepository::class);
$this->factory = $dice->create(PermissionSetFactory::class); $this->factory = $dice->create(PermissionSetFactory::class);
$this->dba = $dice->create(Database::class);
} }
public function testSelectOneByIdPublic() public function testSelectOneByIdPublic()
@ -47,7 +49,7 @@ class PermissionSetTest extends DatabaseTest
*/ */
public function testSaving() 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, '', '<~>'); $permissionSet = $this->factory->createFromString(42, '', '<~>');