From 5606993212e819eba2b32d9e22da12ad50063cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Wed, 29 May 2024 11:48:33 +0200 Subject: [PATCH] minor test improvements --- tests/JoinArrayTest.php | 12 ++++++------ tests/Model/Smbo/Transfer.php | 2 +- tests/ModelAggregateTest.php | 10 +++++----- tests/ModelNestedArrayTest.php | 2 +- tests/ModelNestedSqlTest.php | 2 +- tests/ReferenceTest.php | 4 ++-- tests/SmboTransferTest.php | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/JoinArrayTest.php b/tests/JoinArrayTest.php index 4cacc4e51..9b472eecc 100644 --- a/tests/JoinArrayTest.php +++ b/tests/JoinArrayTest.php @@ -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'); @@ -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'); @@ -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'); @@ -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'); @@ -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'); @@ -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'); diff --git a/tests/Model/Smbo/Transfer.php b/tests/Model/Smbo/Transfer.php index c1ae9fd0d..881b19d4e 100644 --- a/tests/Model/Smbo/Transfer.php +++ b/tests/Model/Smbo/Transfer.php @@ -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 diff --git a/tests/ModelAggregateTest.php b/tests/ModelAggregateTest.php index 092acf76f..a338d4a97 100644 --- a/tests/ModelAggregateTest.php +++ b/tests/ModelAggregateTest.php @@ -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([ @@ -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); @@ -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); @@ -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); @@ -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( diff --git a/tests/ModelNestedArrayTest.php b/tests/ModelNestedArrayTest.php index e7da8a9b2..1e3ffea41 100644 --- a/tests/ModelNestedArrayTest.php +++ b/tests/ModelNestedArrayTest.php @@ -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); diff --git a/tests/ModelNestedSqlTest.php b/tests/ModelNestedSqlTest.php index fca1cc8c1..4f264b963 100644 --- a/tests/ModelNestedSqlTest.php +++ b/tests/ModelNestedSqlTest.php @@ -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); diff --git a/tests/ReferenceTest.php b/tests/ReferenceTest.php index 975892930..58afc5891 100644 --- a/tests/ReferenceTest.php +++ b/tests/ReferenceTest.php @@ -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]); @@ -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(); diff --git a/tests/SmboTransferTest.php b/tests/SmboTransferTest.php index 946e8450d..8a1c062e5 100644 --- a/tests/SmboTransferTest.php +++ b/tests/SmboTransferTest.php @@ -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(); }