1
0
Fork 0

Fix tests

This commit is contained in:
Philipp Holzer 2021-10-17 23:42:13 +02:00
parent bf224b58f8
commit 0f752ff91b
Signed by: nupplaPhil
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 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, '', '<~>')));

View file

@ -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, '', '<~>');