Skip to content

Commit

Permalink
minor test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed May 29, 2024
1 parent c5b7b5a commit 2e7ca4b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions tests/JoinArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function testJoinSaving2(): void
$user->addField('name');
$j = $user->join('contact.test_id');
$j->addField('contact_phone');
$j->addField('test_id', ['type' => 'integer']);
$j->addField('test_id', ['type' => 'bigint']);

$user2 = $user->createEntity();
$user2->set('name', 'John');
Expand Down Expand Up @@ -209,7 +209,7 @@ public function testJoinSaving3(): void
$db = new Persistence\Array_(['user' => [], 'contact' => []]);
$user = new Model($db, ['table' => 'user']);
$user->addField('name');
$user->addField('test_id', ['type' => 'integer']);
$user->addField('test_id', ['type' => 'bigint']);
$j = $user->join('contact', ['masterField' => 'test_id']);
$j->addField('contact_phone');

Expand Down Expand Up @@ -268,7 +268,7 @@ public function testJoinLoading(): void
]);

$user = new Model($db, ['table' => 'user']);
$user->addField('contact_id', ['type' => 'integer']);
$user->addField('contact_id', ['type' => 'bigint']);
$user->addField('name');
$j = $user->join('contact');
$j->addField('contact_phone');
Expand Down Expand Up @@ -306,7 +306,7 @@ public function testJoinUpdate(): void
]);

$user = new Model($db, ['table' => 'user']);
$user->addField('contact_id', ['type' => 'integer']);
$user->addField('contact_id', ['type' => 'bigint']);
$user->addField('name');
$j = $user->join('contact');
$j->addField('contact_phone');
Expand Down Expand Up @@ -383,7 +383,7 @@ public function testJoinDelete(): void
]);

$user = new Model($db, ['table' => 'user']);
$user->addField('contact_id', ['type' => 'integer']);
$user->addField('contact_id', ['type' => 'bigint']);
$user->addField('name');
$j = $user->join('contact');
$j->addField('contact_phone');
Expand Down Expand Up @@ -420,7 +420,7 @@ public function testLoadMissingException(): void
]);

$user = new Model($db, ['table' => 'user']);
$user->addField('contact_id', ['type' => 'integer']);
$user->addField('contact_id', ['type' => 'bigint']);
$user->addField('name');
$j = $user->join('contact');
$j->addField('contact_phone');
Expand Down
2 changes: 1 addition & 1 deletion tests/Model/Smbo/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected function init(): void
$this->addCondition('transfer_document_id', '!=', null);
}

$this->addField('destination_account_id', ['type' => 'integer', 'neverPersist' => true]);
$this->addField('destination_account_id', ['type' => 'bigint', 'neverPersist' => true]);

$this->onHookShort(self::HOOK_BEFORE_SAVE, function () {
// only for new records and when destination_account_id is set
Expand Down
10 changes: 5 additions & 5 deletions tests/ModelAggregateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function testGroupBy(): void
$aggregate = $this->createInvoiceAggregate();

$aggregate->setGroupBy(['client_id'], [
'c' => ['expr' => 'count(*)', 'type' => 'integer'],
'c' => ['expr' => 'count(*)', 'type' => 'bigint'],
]);

self::assertSameExportUnordered([
Expand All @@ -76,7 +76,7 @@ public function testGroupSelect(): void
$aggregate->addField('client');

$aggregate->setGroupBy(['client_id'], [
'c' => ['expr' => 'count(*)', 'type' => 'integer'],
'c' => ['expr' => 'count(*)', 'type' => 'bigint'],
]);
self::fixAllNonAggregatedFieldsInGroupBy($aggregate);

Expand Down Expand Up @@ -130,7 +130,7 @@ public function testGroupSelectExpression(): void
$aggregate->setGroupBy(['client_id'], [
's' => ['expr' => 'sum([amount])', 'type' => 'atk4_money'],
'amount' => ['expr' => 'sum([])', 'type' => 'atk4_money'],
'sum_hasone' => ['expr' => 'sum([order])', 'type' => 'integer'],
'sum_hasone' => ['expr' => 'sum([order])', 'type' => 'bigint'],
]);
self::fixAllNonAggregatedFieldsInGroupBy($aggregate);

Expand Down Expand Up @@ -250,7 +250,7 @@ public function testGroupSelectRef(): void
$aggregate->addField('client');

$aggregate->setGroupBy(['client_id'], [
'c' => ['expr' => 'count(*)', 'type' => 'integer'],
'c' => ['expr' => 'count(*)', 'type' => 'bigint'],
]);
self::fixAllNonAggregatedFieldsInGroupBy($aggregate);

Expand Down Expand Up @@ -345,7 +345,7 @@ public function testAggregateFieldExpressionSql(): void

$aggregate->setGroupBy([$aggregate->expr('{}', ['abc'])], [
'xyz' => ['expr' => 'sum([amount])'],
'sum_hasone' => ['expr' => 'sum([order])', 'type' => 'integer'],
'sum_hasone' => ['expr' => 'sum([order])', 'type' => 'bigint'],
]);

$this->assertSameSql(
Expand Down
2 changes: 1 addition & 1 deletion tests/ModelNestedArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function atomic(\Closure $fx)
]);
$mInner->removeField('_id');
$mInner->idField = 'uid';
$mInner->addField('uid', ['actual' => '_id', 'type' => 'integer']);
$mInner->addField('uid', ['actual' => '_id', 'type' => 'bigint']);
$mInner->addField('name');
$mInner->addField('y', ['actual' => '_birthday', 'type' => 'date']);
$mInner->addCondition('uid', '!=', 3);
Expand Down
2 changes: 1 addition & 1 deletion tests/ModelNestedSqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function atomic(\Closure $fx)
]);
$mInner->removeField('id');
$mInner->idField = 'uid';
$mInner->addField('uid', ['actual' => '_id', 'type' => 'integer']);
$mInner->addField('uid', ['actual' => '_id', 'type' => 'bigint']);
$mInner->addField('name');
$mInner->addField('y', ['actual' => '_birthday', 'type' => 'date']);
$mInner->addCondition('uid', '!=', 3);
Expand Down
4 changes: 2 additions & 2 deletions tests/ReferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function testHasManyDuplicateNameException(): void
{
$user = new Model(null, ['table' => 'user']);
$order = new Model();
$order->addField('user_id', ['type' => 'integer']);
$order->addField('user_id', ['type' => 'bigint']);

$user->hasMany('Orders', ['model' => $order]);

Expand Down Expand Up @@ -247,7 +247,7 @@ protected function init(): void
$this->addField('name');

$this->hasMany('orders', ['model' => [self::$orderModelClass], 'theirField' => 'user_id'])
->addField('orders_count', ['type' => 'integer', 'aggregate' => 'count']);
->addField('orders_count', ['type' => 'bigint', 'aggregate' => 'count']);

$this->analysingOrderModelFields = $this->getReference('orders')->createAnalysingTheirModel()->getFields();

Expand Down
6 changes: 3 additions & 3 deletions tests/SmboTransferTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ protected function setUp(): void

$this->createMigrator()->table('payment')
->id()
->field('document_id', ['type' => 'integer'])
->field('account_id', ['type' => 'integer'])
->field('document_id', ['type' => 'bigint'])
->field('account_id', ['type' => 'bigint'])
->field('cheque_no')
->field('misc_payment', ['type' => 'boolean'])
->field('transfer_document_id', ['type' => 'integer'])
->field('transfer_document_id', ['type' => 'bigint'])
->create();
}

Expand Down

0 comments on commit 2e7ca4b

Please sign in to comment.