Skip to content

Commit 5d30be7

Browse files
committed
fix phpunit test for postgres
Signed-off-by: Lukas Schaefer <[email protected]>
1 parent d4969f5 commit 5d30be7

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

lib/AppInfo/Application.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ class Application extends App implements IBootstrap {
6565
public const QUOTA_TYPE_IMAGE = 1;
6666
public const QUOTA_TYPE_TRANSCRIPTION = 2;
6767
public const QUOTA_TYPE_SPEECH = 3;
68-
public const QUOTA_FOR_USER = 0;
69-
public const QUOTA_FOR_GROUP = 1;
7068

7169
public const DEFAULT_QUOTAS = [
7270
self::QUOTA_TYPE_TEXT => 0, // 0 = unlimited

lib/Db/QuotaRuleMapper.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,17 @@ public function getRule(int $quotaType, string $userId, array $groups): QuotaRul
5959
)->andWhere(
6060
$qb->expr()->orX(
6161
$qb->expr()->andX(
62-
$qb->expr()->eq('u.entity_type', $qb->createNamedParameter(Application::QUOTA_FOR_USER, IQueryBuilder::PARAM_INT)),
62+
$qb->expr()->eq('u.entity_type', $qb->createNamedParameter('user', IQueryBuilder::PARAM_STR)),
6363
$qb->expr()->eq('u.entity_id', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR))
6464
),
6565
$qb->expr()->andX(
66-
$qb->expr()->eq('u.entity_type', $qb->createNamedParameter(Application::QUOTA_FOR_GROUP, IQueryBuilder::PARAM_INT)),
66+
$qb->expr()->eq('u.entity_type', $qb->createNamedParameter('group', IQueryBuilder::PARAM_STR)),
6767
$qb->expr()->in('u.entity_id', $qb->createNamedParameter($groups, IQueryBuilder::PARAM_STR_ARRAY))
6868
),
6969

7070
)
7171
)->orderBy('r.priority', 'ASC')
7272
->setMaxResults(1);
73-
7473
/** @var QuotaRule $entity */
7574
$entity = $this->findEntity($qb);
7675
return $entity;

lib/Db/QuotaUser.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
* @method int getRuleId()
1616
* @method void setRuleId(int $ruleId)
1717
* @method string getEntityType()
18-
* @method void setEntityType(int $entityType)
19-
* @method int getEntityId()
20-
* @method void setEntityId(int $entityId)
18+
* @method void setEntityType(string $entityType)
19+
* @method string getEntityId()
20+
* @method void setEntityId(string $entityId)
2121
*/
2222
class QuotaUser extends Entity implements JsonSerializable {
2323
/** @var int */
@@ -29,8 +29,8 @@ class QuotaUser extends Entity implements JsonSerializable {
2929

3030
public function __construct() {
3131
$this->addType('rule_id', 'integer');
32-
$this->addType('entity_type', 'integer');
33-
$this->addType('entity_id', 'integer');
32+
$this->addType('entity_type', 'string');
33+
$this->addType('entity_id', 'string');
3434
}
3535

3636
#[ReturnTypeWillChange]

0 commit comments

Comments
 (0)