From 7667adf8ea5a40dd4cdd776643bc8397b921578e Mon Sep 17 00:00:00 2001 From: Tigrov Date: Wed, 22 May 2024 22:38:26 +0700 Subject: [PATCH] Fix tests --- tests/ActiveRecordTest.php | 4 ---- tests/Stubs/ActiveRecord/Category.php | 2 +- tests/Stubs/ActiveRecord/Customer.php | 6 +++--- tests/Stubs/ActiveRecord/CustomerClosureField.php | 6 +++--- tests/Stubs/ActiveRecord/CustomerForArrayable.php | 6 +++--- tests/Stubs/ActiveRecord/CustomerWithAlias.php | 10 +++++----- tests/Stubs/ActiveRecord/CustomerWithConstructor.php | 6 +++--- tests/Stubs/ActiveRecord/NullValues.php | 8 ++++---- tests/Stubs/ActiveRecord/Order.php | 2 +- tests/Stubs/ActiveRecord/OrderItemWithNullFK.php | 4 ++-- tests/Stubs/ActiveRecord/OrderWithNullFK.php | 2 +- tests/Stubs/ActiveRecord/Type.php | 4 ++-- tests/Stubs/ActiveRecord/UserAR.php | 2 +- 13 files changed, 29 insertions(+), 33 deletions(-) diff --git a/tests/ActiveRecordTest.php b/tests/ActiveRecordTest.php index 53fd467e7..f61257495 100644 --- a/tests/ActiveRecordTest.php +++ b/tests/ActiveRecordTest.php @@ -882,11 +882,8 @@ public function testGetDirtyAttributesOnNewRecord(): void $this->assertSame( [ - 'name' => null, - 'address' => null, 'status' => 0, 'bool_status' => false, - 'profile_id' => null, ], $customer->getDirtyAttributes() ); @@ -904,7 +901,6 @@ public function testGetDirtyAttributesOnNewRecord(): void 'address' => null, 'status' => 0, 'bool_status' => false, - 'profile_id' => null, ], $customer->getDirtyAttributes() ); diff --git a/tests/Stubs/ActiveRecord/Category.php b/tests/Stubs/ActiveRecord/Category.php index bc85de046..49e4c1561 100644 --- a/tests/Stubs/ActiveRecord/Category.php +++ b/tests/Stubs/ActiveRecord/Category.php @@ -16,7 +16,7 @@ */ final class Category extends ActiveRecord { - protected int|null $id = null; + protected int|null $id; protected string $name; public function getTableName(): string diff --git a/tests/Stubs/ActiveRecord/Customer.php b/tests/Stubs/ActiveRecord/Customer.php index ef527fc36..13b768fca 100644 --- a/tests/Stubs/ActiveRecord/Customer.php +++ b/tests/Stubs/ActiveRecord/Customer.php @@ -18,11 +18,11 @@ class Customer extends ActiveRecord protected int $id; protected string $email; - protected string|null $name = null; - protected string|null $address = null; + protected string|null $name; + protected string|null $address; protected int|null $status = 0; protected bool|string|null $bool_status = false; - protected int|null $profile_id = null; + protected int|null $profile_id; /** * @var int|string diff --git a/tests/Stubs/ActiveRecord/CustomerClosureField.php b/tests/Stubs/ActiveRecord/CustomerClosureField.php index f53951de7..d99ef987e 100644 --- a/tests/Stubs/ActiveRecord/CustomerClosureField.php +++ b/tests/Stubs/ActiveRecord/CustomerClosureField.php @@ -13,11 +13,11 @@ final class CustomerClosureField extends ActiveRecord { protected int $id; protected string $email; - protected string|null $name = null; - protected string|null $address = null; + protected string|null $name; + protected string|null $address; protected int|null $status = 0; protected bool|string|null $bool_status = false; - protected int|null $profile_id = null; + protected int|null $profile_id; public function getTableName(): string { diff --git a/tests/Stubs/ActiveRecord/CustomerForArrayable.php b/tests/Stubs/ActiveRecord/CustomerForArrayable.php index 3011e3ff1..35861a607 100644 --- a/tests/Stubs/ActiveRecord/CustomerForArrayable.php +++ b/tests/Stubs/ActiveRecord/CustomerForArrayable.php @@ -17,11 +17,11 @@ class CustomerForArrayable extends ActiveRecord protected int $id; protected string $email; - protected string|null $name = null; - protected string|null $address = null; + protected string|null $name; + protected string|null $address; protected int|null $status = 0; protected bool|string|null $bool_status = false; - protected int|null $profile_id = null; + protected int|null $profile_id; public function getTableName(): string { diff --git a/tests/Stubs/ActiveRecord/CustomerWithAlias.php b/tests/Stubs/ActiveRecord/CustomerWithAlias.php index 91e36afbc..cfc5ff8e3 100644 --- a/tests/Stubs/ActiveRecord/CustomerWithAlias.php +++ b/tests/Stubs/ActiveRecord/CustomerWithAlias.php @@ -21,11 +21,11 @@ final class CustomerWithAlias extends ActiveRecord public int $id; public string $email; - public string|null $name = null; - public string|null $address = null; - public int|null $status = null; - public bool|string|null $bool_status = null; - public int|null $profile_id = null; + public string|null $name; + public string|null $address; + public int|null $status; + public bool|string|null $bool_status; + public int|null $profile_id; public function getTableName(): string { diff --git a/tests/Stubs/ActiveRecord/CustomerWithConstructor.php b/tests/Stubs/ActiveRecord/CustomerWithConstructor.php index 32baa4035..b94471659 100644 --- a/tests/Stubs/ActiveRecord/CustomerWithConstructor.php +++ b/tests/Stubs/ActiveRecord/CustomerWithConstructor.php @@ -17,11 +17,11 @@ final class CustomerWithConstructor extends ActiveRecord { protected int $id; protected string $email; - protected string|null $name = null; - protected string|null $address = null; + protected string|null $name; + protected string|null $address; protected int|null $status = 0; protected bool|string|null $bool_status = false; - protected int|null $profile_id = null; + protected int|null $profile_id; public function __construct(ConnectionInterface $db, private Aliases $aliases) { diff --git a/tests/Stubs/ActiveRecord/NullValues.php b/tests/Stubs/ActiveRecord/NullValues.php index 18d8a09db..9f79f70e6 100644 --- a/tests/Stubs/ActiveRecord/NullValues.php +++ b/tests/Stubs/ActiveRecord/NullValues.php @@ -18,10 +18,10 @@ final class NullValues extends ActiveRecord { public int $id; - public int|null $var1 = null; - public int|null $var2 = null; - public int|null $var3 = null; - public string|null $stringcol = null; + public int|null $var1; + public int|null $var2; + public int|null $var3; + public string|null $stringcol; public function getTableName(): string { diff --git a/tests/Stubs/ActiveRecord/Order.php b/tests/Stubs/ActiveRecord/Order.php index 3078d6589..8d2eb6763 100644 --- a/tests/Stubs/ActiveRecord/Order.php +++ b/tests/Stubs/ActiveRecord/Order.php @@ -20,7 +20,7 @@ class Order extends ActiveRecord { public const TABLE_NAME = 'order'; - protected int|null $id = null; + protected int|null $id; protected int $customer_id; protected int $created_at; protected float $total; diff --git a/tests/Stubs/ActiveRecord/OrderItemWithNullFK.php b/tests/Stubs/ActiveRecord/OrderItemWithNullFK.php index a0b4c96a4..24c07fc84 100644 --- a/tests/Stubs/ActiveRecord/OrderItemWithNullFK.php +++ b/tests/Stubs/ActiveRecord/OrderItemWithNullFK.php @@ -16,8 +16,8 @@ */ final class OrderItemWithNullFK extends ActiveRecord { - protected int|null $order_id = null; - protected int|null $item_id = null; + protected int|null $order_id; + protected int|null $item_id; protected int $quantity; protected float $subtotal; diff --git a/tests/Stubs/ActiveRecord/OrderWithNullFK.php b/tests/Stubs/ActiveRecord/OrderWithNullFK.php index 9d0cb7aa1..acd10dd97 100644 --- a/tests/Stubs/ActiveRecord/OrderWithNullFK.php +++ b/tests/Stubs/ActiveRecord/OrderWithNullFK.php @@ -17,7 +17,7 @@ final class OrderWithNullFK extends ActiveRecord { protected int $id; - protected int|null $customer_id = null; + protected int|null $customer_id; protected int $created_at; protected float $total; diff --git a/tests/Stubs/ActiveRecord/Type.php b/tests/Stubs/ActiveRecord/Type.php index 4b4c873ae..79c26b0a9 100644 --- a/tests/Stubs/ActiveRecord/Type.php +++ b/tests/Stubs/ActiveRecord/Type.php @@ -33,7 +33,7 @@ class Type extends ActiveRecord public int|null $smallint_col = 1; public string $char_col; public string|null $char_col2 = 'something'; - public string|null $char_col3 = null; + public string|null $char_col3; public float $float_col; public float|null $float_col2 = 1.23; public mixed $blob_col; @@ -43,7 +43,7 @@ class Type extends ActiveRecord public bool|int|string|null $bool_col2 = true; public string|Expression $ts_default; public int|string $bit_col = 0b1000_0010; - public array|null $json_col = null; + public array|null $json_col; public function getTableName(): string { diff --git a/tests/Stubs/ActiveRecord/UserAR.php b/tests/Stubs/ActiveRecord/UserAR.php index 9944cab58..eed0988b6 100644 --- a/tests/Stubs/ActiveRecord/UserAR.php +++ b/tests/Stubs/ActiveRecord/UserAR.php @@ -16,7 +16,7 @@ final class UserAR extends ActiveRecord public string $username; public string $auth_key; public string $password_hash; - public string|null $password_reset_token = null; + public string|null $password_reset_token; public string $email; public int $role = 10; public int $status = 10;